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

Working with check-in, checkout, and revert

From: Fundamentals of Software Version Control

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

Okay, we've got Perforce and all of its tools installed, but unlike some of the other tools we're using in this course, Perforce works directly with the file system as opposed to having the GUI client be integrated and automatically create folders and files from inside that client. So what we need to do now is open the Windows Explorer and switch to our Work directory. And inside here, we're going to create a directory within a workspace called p1.

Working with check-in, checkout, and revert

Okay, we've got Perforce and all of its tools installed, but unlike some of the other tools we're using in this course, Perforce works directly with the file system as opposed to having the GUI client be integrated and automatically create folders and files from inside that client. So what we need to do now is open the Windows Explorer and switch to our Work directory. And inside here, we're going to create a directory within a workspace called p1.

Now if we switch back to the Perforce client, you don't see it yet, but once we click this, Refresh, there is our folder p1. Perforce manages files, not folders, meaning we have to actually create a file in order to get Perforce to add this folder to our workspace. So we'll come back here, we'll go inside p1, and we'll right-click and say New Text File, and we'll put in ReadMe.txt. Doesn't have to have anything in it. In our case, let's come back to Perforce, refresh again, and now we open up p1, you can see ReadMe.txt.

You can notice that this has blank icon that means that Perforce recognizes that that's not in the depot. The way we add it to the depot is we right-click on it, and we say Mark for Add. Perforce can have a whole bunch of pending changes lists. You can have something you're working on over here and something you're working on over there and the default change list. For everything we're doing in the course, we're going to use the default change list, so I'm just going to click Don't show this dialog again. But you can create multiple change lists if you want to be working on certain things and hold back changes and not check them in until you're ready.

But in our case, we're going to be checking in the changes every time we make a change. All right, now that we've marked that for add, we can see a few things. First of all, down here at the bottom, you can see the fact that this in fact has been marked for add. This is actually the command-line version of that command, and you can see what I meant about the fact that there is all these complicated flags in order to simply just add a file to the repository. You can also see over here in the Details pane where the actual file is, where it's going to go on the repository, which revision it is the date and time, the type of the file and which kind of file Perforce thinks it is.

Perforce's file types have to do, whether they're text or binary, so that knows which kinds of different thing to do when doing differencing and merging. So we've got our file, it's got now a text icon, and it's got a plus, meaning it's marked for add. And so let's go ahead and add that in to the repository, and we'll say Submit. And this is the Changelist Submit dialog we're going to say Create folder p1 with ReadMe. And we'll say Submit, and now you can see we have a nice little green dot there indicating that it's up to date in the repository, and our working set has the latest version.

Now let's add some code and understand the lifecycle working with Perforce. The content we're going to use is from the new project's Haiku Error Messages page. These aren't actual Haikus, but they kind of feel like one. We're going to pick one that's happened to us all before we started using version control. Again, we have to create files by using the Windows File Explorer or our Text Editor, not Perforce. So we come back here, we'll right-click once again and say New Text Document, and I'm going to call this thing f1.c.

And Windows is very kind and asks us if we want to make sure we got the right kind of file, because it will decide to open Visual Studio when we double-click on this to edit it, so we're going to go ahead and do that. In this case, f1.c is going to say main () printf With searching comes loss, and the presence of absence, My Novel\" not found. With Visual Studio we can simply click Save All, and that saves the file, and now we can switch back to Perforce and add it to the repository, come back to our workspace, refresh it once again, now we can see the file.

Once again we have a plain icon, we will right-click, Mark for Add, and then we'll Submit, and we'll say Initial Commit of f1.c. Once again, we can see all the command line operations down here in the log. Now, to see the history of what we've done so far, we can right-click on our p1 folder in the workspace and select Folder History. And now you can see the list of Changelists we've done with this folder.

Changelist 1 we created the p1 folder by adding the read me ReadMe. Changelist 2, we did an initial commit of p1. Unlike SVN and Git and Mercurial, Perforce is a locking version control system, so before we can edit this we have to check it out. You notice we have a green dot but we don't have anything that tells us we can edit it. So with Perforce you have to right-click here and say Check Out. Now you can also do Check Out and Open if you want to open with the default tools, so we'll just do that, Check Out and Open.

Once again, it opens Visual Studio. Now let's change My Novel to a more modern error message. We'll say Website not found. And we'll save it, and we'll Exit Visual Studio, and now you can see it shows here in the History that f1.c is pending a change, and let's save that file and check it in again. So once again, we'll do a Submit, and we'll say Change My Novel to Website and submit it.

Now we might want to look at the history of the file, so what we can do now is we can come down here and say File History, and over here, since we have the History window open, we can see that here's the file history of the file. So if we select these two lines together and say Diff Selected, it'll open up Diff tool and show us the changes we've just made. One of the cool tools that Perforce has is something called the Time-lapse View.

Now right now it's only going to show two different versions, but here is version 1, there's version 2, and if we had more-- which we'll see later--we'll actually be able to see the file as it changes over time. All right, now we're going to make one more change. Again, we're going to Check Out and Open, and we're going to change Website to Webpage, Save it and Exit Visual Studio. And now again, we're going to Diff this against what they call the Have Revision, which is the Head Revision, and you can see what's in the depot here. This is the depot side with the purple triangle as Website, and what we haven't checked in is web page.

But remember we have saved it, so now we're going to do is we're going to revert. We're going to right-click here and Revert. Now the Revert dialog says what are we going to revert. In this case, we're going to Revert our edit. We right-click here, and now if we go and Diff this against the Have version, you're going to see that it says Website in both cases because we've updated our workspace with the content that we had originally. All right, now we reverted to a particular version.

Now if we want to actually revert to a specific version, for example, we can come back here to the initial version and right-click on here and say Rollback to Revision. This is going to allow us to roll back to anything that we want to. So for example, we could roll back to the previous version, or we can roll back to a specific revision, we can roll back to a specific changelist, a Date and a Time or a Label. So you've got a very flexible manipulation of files within Perforce. So in this case, we're going to roll back to Revision 1, and they give you a predefined changelist description. We're going to run it, and now we're going just kind of come down here and Open this up and see that we're back to My Novel.

Now remember, all the different versions are still inside the repository. You haven't lost anything. So for example, if we come back here and we do another rollback, we can roll back to the Changelist, and we can browse for the Changelist and go all the way back to Change My Novel to Website and submit that. And now when we Open the file you can see we're back to Website.

So that's the basic workflow for using check-ins and check-outs and reversion and rollback in Perforce. Now let's move on to tagging, which is called labeling in Perforce, and see how we can use that.

Show transcript

This video is part of

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

49 video lessons · 11614 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.