Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Working with check-in, checkout, revert, and tracking history

From: Fundamentals of Software Version Control

Video: Working with check-in, checkout, revert, and tracking history

All right, we've got a working HG repository. It's time to add some files and check it in. Mercurial is different than some of the other systems because we have to do one piece of initialization globally before we can start checking things in. What we have to do is to create a file in the user profile called Mercurial.ini, and inside of it we had to put in our username and email address. So we'll say Notepad, %userprofile%\Mercurial.ini. It doesn't exist, we do want to create it.

Working with check-in, checkout, revert, and tracking history

All right, we've got a working HG repository. It's time to add some files and check it in. Mercurial is different than some of the other systems because we have to do one piece of initialization globally before we can start checking things in. What we have to do is to create a file in the user profile called Mercurial.ini, and inside of it we had to put in our username and email address. So we'll say Notepad, %userprofile%\Mercurial.ini. It doesn't exist, we do want to create it.

I copied the text that we need onto the clipboard, so you will type in ui, then username = and here you will put in your username, and over here you'll put your email address. Just remember, this is not a real email address. Don't try sending email there. Okay, now we have got Mercurial fully initialized. We can start putting in some code. So let's open up Notepad and create our file. The code we are going to put in has some content from the new project's haiku error messages page.

We'll pick one that's happen to all of us before we start using Version Control "With searching comes loss\n", "and the presence of absence:/n", and then the kicker "My Novel\" not found.\n". Well, at least this one will never happen to you again, now that you are going to be a Version Control expert. All right. We'll save it. Now if we do hg status, you can see that HG sees it but doesn't know what to do with the file.

So we need to tell it that this is a new file for the repository, hg add f1.c. Okay, now we can ask Hg the status again and see that it's got the file ready to add. So finally, remembering that we set up our Mercurial.ini file at the top here, we'll check it in, and everything would be fine, hg commit -m "Initial Checkin". All right. Now if we ask Hg status again, you will see there is nothing going on, and then we see hg log, and you can see that it puts out five lines for each changeset.

If you look at the first line, you can see the changeset identifier. Now in Mercurial there is two numbers, one-- 0 in this case--is the local identifier that you can use for doing things like reverting and versions. We'll see that later on in this movie. The second is a hash that's used to uniquely identify this changeset so that when this changeset is for example exported or pushed to a remote repository, they can make sure that they can uniquely identify that from other changeset zeroes that might come in from other users.

You can see our user as we set it up in the Mercurial.ini file, the date, the summary and so forth where you see tag: tip--that's the same as Git Head--and it essentially says this changeset was added to the most recent version of repository. So this is the top or the tip of the iceberg here that has everything in it, that's the very latest stuff. So, now let's make another change so we can see Hg's versioning in action. We'll open up our file, and we'll change My Novel to Website and then we'll save it.

This time we are going to do hg commit, but we are not going to put a message audit on the command line here, we are going to let it open up Notepad so that we can put in a multi-line message. So we'll say Change My Novel to Website, This is a better change for modern times. We'll save it. Now if say hg log, you will see that you only see the summary.

If you want to see the full commit messages, you have to say hg log -v. And there you can see in our changeset, number 1 there. It's--instead of saying summary, it now says description. All right. So now let's make another change and then examine how to revert or rollback. Once again, we'll open up f1.c, and we'll change Website to Webpage, and we'll save it. If we run hg diff, you can see that if we committed this change. It would change Website to Webpage, and you can see it shows you the difference between what's in your working set and what's in the repository.

Note in our case, we only have one file. If you had 25 files, when you said hg diff, it would show the difference in all of the files. You can ask it to show you the differences in only a single file by typing hg diff f1.c. Now in our case, that's exactly the same since we only have one file, but you understand now how to see the difference for an individual file. There is a lot of additional options on the diff command so that you can ask it to show you the difference between different times, and you can also ask it to show you the difference between the working set and a specific changeset.

If we do hg log, we can see that we have changeset 1 and changeset 0. So if we say hg diff -r 0, it will show us the difference between our current working set which has web page and the initial Checkin which had My Novel. All right. So now let's roll back to our most recent commit, and we do that by saying hg revert in our file name, we type out f1.c, and you can see now we are back to website. Finally, you can also revert to any revision, not just the topmost one by using the revert command and specifying a changeset so that we'll do hg revert -r 0 f1.c, and again we type out f1.c. You can see we are back to My Novel.

Now, note none of your changes in the repository have been lost, you are just updating the working set. So if we just say hg revert f1.c, you can see we are back to website. So that's the basics of checking in and checking out and reverting with Hg. Now let's move on to talking about tagging.

Show transcript

This video is part of

Image for Fundamentals of Software Version Control
Fundamentals of Software Version Control

49 video lessons · 11989 viewers

Michael Lehman
Author

 
Expand all | Collapse all
  1. 2m 12s
    1. Welcome
      56s
    2. What you should know before taking this course
      23s
    3. Using the exercise files
      53s
  2. 25m 8s
    1. Overview of software version control
      2m 51s
    2. Understanding version control concepts
      5m 14s
    3. Demo one: Getting started
      11m 1s
    4. Demo two: Handling the "oops"
      6m 2s
  3. 11m 3s
    1. The history of version control
      3m 44s
    2. Terminology
      4m 27s
    3. Exploring centralized vs. distributed systems
      2m 52s
  4. 28m 42s
    1. Getting files in and out of a repository
      4m 38s
    2. Saving changes and tracking history
      2m 47s
    3. Reverting to a prior version
      1m 42s
    4. Creating tags and labels
      1m 5s
    5. Branching and merging
      4m 10s
    6. Exploring workflow integration and continuous builds
      2m 46s
    7. Using graphical user interface (GUI) tools
      2m 39s
    8. Integrating a version control system with an integrated development environment (IDE)
      2m 50s
    9. Examining shell integration
      3m 26s
    10. Looking at forward and reverse integration
      2m 39s
  5. 25m 59s
    1. Installation and setup
      3m 31s
    2. Creating a repository and a project
      5m 10s
    3. Working with check-in, checkout, and revert
      6m 12s
    4. Tagging
      1m 34s
    5. Branching and merging
      5m 32s
    6. Working with GUI clients and IDE integration
      4m 0s
  6. 16m 13s
    1. Installation and setup
      55s
    2. Working with check-in, checkout, and revert
      9m 34s
    3. Tagging
      1m 7s
    4. Branching and merging
      4m 37s
  7. 26m 41s
    1. Installation and setup
      3m 47s
    2. Creating a repository and a project
      6m 15s
    3. Working with check-in, checkout, and revert
      8m 31s
    4. Tracking history and tagging
      2m 15s
    5. Branching and merging
      5m 53s
  8. 19m 25s
    1. Installation and setup
      3m 1s
    2. Creating a repository and a project
      1m 6s
    3. Working with check-in, checkout, and revert
      6m 39s
    4. Tagging
      2m 13s
    5. Branching and merging
      3m 44s
    6. Working with GUI clients and IDE integration
      2m 42s
  9. 16m 54s
    1. Installation and setup
      1m 48s
    2. Creating a repository and a project
      59s
    3. Working with check-in, checkout, revert, and tracking history
      6m 9s
    4. Tagging
      1m 50s
    5. Branching and merging
      4m 29s
    6. Exploring GUI and shell integration
      1m 39s
  10. 3m 38s
    1. Selecting a software version control that is right for you
      2m 30s
    2. Next steps
      1m 8s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Fundamentals of Software Version Control.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.