Converting Labels (CVS2P4)

Info & Tags

Article #:
226
Created:
05/01/07
Modified:
01/09/08

Related Articles

SUMMARY

When converting CVS tags into Perforce labels, users are often surprised to observe that, in addition to the files in the expected branch, many files in other branches are also labeled. Why does cvs2p4 label files in many branches?


DETAILS

Labelling files in many branches is a side effect of differences in both the way CVS and Perforce handle branching and with the way CVS tags work.

When a file has been branched but not yet changed in the child branch, the information in the CVS archive is not sufficient to determine to which branch(es) a label was intended to label. When creating a new branch, CVS does not actually create a new branch revision within the RCS archive; it merely marks the branch point with a symbolic name. This is not a problem for CVS, since the act of checking out a CVS tree using a CVS tag will always retrieve a single CVS revision for every file bearing the tag.

By contrast, the Perforce Server's "lazy copy" mechanism creates a distinct "revision #1" in the child branch at the time the branch is created. Thus, for a given file, the first revisions for multiple Perforce branches may share the same parent branch and revision. In such cases, there's no way for the CVS2P4 converter to know specifically to which child branch a given CVS tag was meant to apply.

Therefore, the CVS2P4 converter includes the first revisions in all of the child branches that share a common branch point in CVS.

Workarounds

In order to set up a Perforce client for the "correct" branch corresponding to a particular CVS tag (now Perforce label), the user must in effect tell the Perforce Server which branch the label is really supposed to be used with. Identifying the appropriate branch for labelling can be done in one of two ways, as noted below.
  1. Restricting the view in the client workspace to files with the "correct" branch for the label used. For example:
    View:
    //depot/prod/rel1_0/... //client/...
    and then:
    p4 sync //...@label
  2. Selectively syncing only the "correct" client branch by providing the branch in in the sync filespec. For example:
    View: 
    //depot/prod/... //client/...
    and then:
    p4 sync //depot/prod/rel1_0/...@label
        
Another approach is for the user to remove the label from all branches except for the "correct" one(s).