Using Working Folders in Version Control

Source Control HOWTO - Chapter 5

two repository versions of a file.  When I am working on a feature, I periodically like to review the recent changes in the repository.  Unless those changes look likely to disrupt my own work, I usually proceed to retrieve the latest versions of things so that my working folder stays up to date.

In CVS, the command to update a working folder is [rather conveniently] called 'update.'  In Vault, this operation is done with the Get Latest Version command.  The screen dump below is the corresponding dialog box:

Best Practice: Don't get too Far Behind

Update your working folder as often as you can. I want to update my working folder to contain all of the changes available on the server, so I have invoked the Get Latest Version operation starting at the very top folder of my repository.  The Recursive checkbox in the dialog above indicates that this operation will recursively apply to every subfolder.

Note that this dialog box gives me a few choices for how I may want to handle situations where a change has happened on both the client and the server.  Let us suppose for a moment that I am not using exclusive checkouts and that somebody else has also modified sgdmgui_props.cpp.  In this case, I have three choices available when I want to update my working folder:

  • Overwrite my working file .  This effect here is similar to an Undo.  My changes will be lost.  Use with care.
  • Attempt automatic merge .  The Vault client will attempt to construct a file which contains my changes and the changes which were made on the server.  If the automerge succeeds, my working file will end up in the "Edited" status.  If the automerge fails, the status of my working file will be "Needs Merge", and the Vault client will nag and pester me until I resolve the situation.
  • Do not overwrite/Merge later .  This option leaves my working file untouched.  However, the status of the file will change to "Needs Merge".  Vault will not allow me to checkin my changes until I affirm that I have done the right thing and merged in the changes from the repository.

Note also that the "Prompt for modified files" checkbox allows me to specify that I want the Vault client to allow me to choose between these options for every file that ends up in this situation.

As you can see, the Get Latest Version dialog box includes a few other options which I won't describe in detail here.  Other SCM tools have similar abilities, although the user interface may be very different.  In any case, it's a good idea to update your working folder as often as you can.

Commit Changes

In most situations, I eventually decide that my changes are Good and should be sent back to the repository so they can become a permanent part of the history of my project.  In Vault, Subversion and CVS, the command is called Commit.  The following screen dump shows the Commit dialog box from Vault:

Note that the listbox at the top contains all of the items in my pending change set.  In this particular example, I only have two changes, but this listbox typically has a scrollbar and contains lots of items.  I can review all of the operations and choose exactly which ones I want to commit to the repository.  It is possible that I may want to checkin only some of my currently pending changes.  (Perforce has a nifty solution to this problem.  The user can have multiple pending change sets, so that changes can be

About the author

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, is the place to go for what is happening in software development and delivery.  Join the conversation now!