WinCVS 1.3 QuickStart Guide

27 Aug 2002 14:54

WinCVS 1.2 Daily Use Guide
WinCVS 1.3 Daily Use Guide
CVS Docs
More CVS Information
CfgMgmt Home
Contents
Newsgroups

View CVS Repository

Configure WinCVS

Get Files

Lock Files
View Your Changes

Merge Files

Watch Files

Diff Files

Check in Changes

Add New Files

Import

Remove Files

 

Your ad here


Much More Free CVS Software Is Available

See the CVS Software page


Get a List of CVS Modules

Modules are used to check out files from CVS.

From the command line, enter:

cvs co -c


View the CVS Repository

Products like SourceSafe show the checked-in directory tree graphically.  CVS and WinCVS don't have this feature.  Instead, use CVSWeb.

If CVSWeb is installed per the instructions, you can view the repository at 
http://tiger/cgi-bin/cvsweb/cvsweb.cgi/.


WinCVS DST Bug

WinCVS has a bug during daylight savings time which causes files to be "red" (which means they've been changed) incorrectly.  See here.


Configure WinCVS

When WinCVS starts, you should see the following dialog box.  If not, press control-F1 or select Preferences from the Admin window.

The values you enter in the General tab vary depending on how you connect to your CVS repository.  This particular tab is only used when using the "checkout" and "import" commands.

Click the Globals tab.

Un-check "Checkout read-only".  Click on the WinCvs tab.

Check "External Diff Program."  Then enter the full path of windiff.exe on your machine (this is installed with Microsoft Visual C++, or with the command line tools mentioned in the Installation section).  Click OK.


Get Files

Select "Change Browser Location" from the View menu.

Select the root directory of your sandbox, and click OK.  Then select "Checkout module" from the Create menu.

Select a module to check out.  Note that you can type in a sub-folder in the module e.g., build/options.  There is no "official" way to browse a repository yet.

Check out to the folder you selected in the "Browse for Folder" dialog.


Lock Files

Two developers can modify the same files at the same time.  This can be a problem with binary files so CVS provides a locking mechanism.  A file that is locked by one developer can not be "committed" by another developer.

Highlight the file and choose "Reserved edit" from the Trace menu

.

Files are automatically unlocked when they are checked in.  To unlock a file without checking it in, select "Unlock selection" from the Trace menu.

If you lock a file and later abandon your changes, you must unlock it; otherwise the file will remain locked forever.  It is generally not a good idea to leave files locked for more than two or three days.


Watch Files for Edits

High contention files can be watched for edits.  This scheme follows a publish/subscribe model.  When someone intends to change a file, she issues the "edit" command which notifies the developers that have set up "watches" for it.  Watch notifications are sent via email.  Notifications are also sent when files are committed.

To set up a watch on a file, select the file and choose "Add a Watch" from the Trace menu.

To let the world know when you're modifying a file, select "Edit selection" from the Trace menu.

If you don't intend to check in your changes, select "Unedit" from the Trace menu.


View Your Changes

Select the file and select Query / Diff Selection.  

In the next dialog box, check "Use the external diff"


Merge Files

Two developers can modify the same file at the same time.  One of the developers will have to merge in the other developer's changes before committing the file.  If you don't check in your changes frequently you will be merging a lot.  It's best to communicate with your team members to make sure you don't step on each other's toes.

Consider the case when someone has modified and committed a file that you've been working on.  Now you have to merge in the other developer's changes.  This process is called "updating."

Click on the file or folder to update.  Select "Update selection" from the Modify menu.

Alas, it's not that simple.  A merge conflict will result if two developers modify the same portion of a file.  If a merge conflict is detected, WinCVS displays a red C icon next to the file.  It's up to the developer to resolve conflicts by hand.  CVS will not let you commit a file that has unresolved merge conflicts in it.

During an update, CVS modifies the file to show you the conflicting edits.  But not to worry -- the original file is saved to another file like foo.cpp.#1.5 before the merge takes place, so you will not lose your work.

  • The beginning of the conflict is marked with <<<<<<<
  • The end of the uncommitted changes are marked with =======
  • The end of the committed changes are marked with >>>>>>>

For example, a file that has a merge conflict might have the following text:

<<<<<<< driver.c 
exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); 
======= 
exit(!!nerr); 
>>>>>>> 1.6

Obviously, the <<<, >>>, and === lines need to be deleted.  But that isn't enough to resolve the conflict.  Both sets of changes must be resolved into a single set of changes that make logical sense.  Typically conflicts require consulting both parties that made the changes.

In the above example, the developer would have to decide which line is "better."  Let's say the first line is preferable.  So the above text should be replaced by:

exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);

  • Another handy way to resolve conflicts is to use the Graph feature to see other developers' modifications.  This is discussed in the next section.
  • Click here for more information on merge conflicts.
  • Click here for a Windows merge conflict editor.

Diff Files

You can see changes that you have made to a file before checking in.  Or, you can see the complete revision history of a file.

Select the file in question and choose Graph... from the Query menu.

A dialog box appears presenting you with plenty of choices:

For a cleaner view, you may want to click on "Do not print tag names."

This window allows you to shift-click on any two revision "boxes" and then click the diff icon () in the toolbar.


Commit Changes

You can check in individual files or all files that have been changed in a directory and its subdirectories.  Modified files are marked by placing a red document icon next to them.

Select the file or folder that you want to check in and select "Commit" from the Modify menu.

Enter your check-in comments and click OK.


Add New Files

If the new file or folder is n a folder that has already been checked into CVS, highlight the item and select "Add selection" from the Modify menu.

Then, select "Commit" from the Modify menu.


Import New Files

This process is cumbersome if you have a lot of files.  There is another mechanism called "Import."  With Import, the new folder you add should not contain CVS administrative folders (called 'CVS').  They can be anywhere.

Select "Import module" from the Create menu.

The following dialog appears:

Highlight the folder that contains the files that you want to check in and click OK.  WinCVS will scan the files and try to guess which files are binary and which are text.  The following dialog box will appear:

The following dialog box, which is invoked via the Edit button, gives you the opportunity to specify whether files with a given extension is BINARY or TEXT, or whether to IGNORE (do not check in) all files with that extension:

Click OK.  Click Continue in the Import Filter window.

In the "Select the module name..." edit box, enter the location where the files should be added to CVS.  

The vendor and release tags can be anything and are meant to help you locate source code later.  These are the names of CVS tags.  For example, if you're importing Apache 1.2 source code, you can enter "Apache" as the vendor and "1.2" as the release tag.

Please see more information regarding the created branch tags and the cvs admin -b command.

Click OK.

Next, check-out the files you just imported into your sandbox.  The files you just checked in should be "abandoned;" in other words, you should only modify the files from your sandbox; otherwise you will lose your changes.


Remove Files

Files, once checked in, can not be permanently removed from CVS.  They are moved into a folder called "Attic".  However, removed files will be removed from everyone's sandbox when they do an "update".

Highlight the file or folder to remove.  Select "Erase selection" from the Modify menu.  Then select "Commit" from the Modify menu.