Changes Between Labels

Info & Tags

Article #:
43
Created:
04/25/07
Modified:
05/16/08
Tags:
changelist, labels

TASK

How do I find out what changed between two labels?

SOLUTION

Differences in File Names

To see which files are different between two labels, first output the labels' contents to two text files:

p4 files //...@label > label.out
p4 files //...@label2 > label2.out

Then, diff the two output files label.out and label2.out. This will show which files revisions have changed between the two labels as well as show which files are in one label but not in the other.

Example

p4diff.exe label.out label2.out  (Windows)
diff label.out label2.out (Unix)

Differences in File Content

To display the actual content diffs for files that exist in labels, use the following command. You might want to redirect this output to a file — it could be large:

p4 diff2 //...@label1 //...@label2

The above command will produce output for files that exist in one label but not the other. For example:

==== <none> - //depot/test/file#1 ====

Differences in Changelists

To get an approximate idea of which changelists were submitted between label1 and label2, retrieve the highest changelist number in each label, then list the changelists in that range that affected the files in the labels' views:

p4 changes -m1 @label1       [say this is 200]
p4 changes -m1 @label2 [and say this is 250]
p4 changes //labelview/...@201,@250

Use the path listed in the "View" fields of the labels' specs for labelview.

The above command will be less accurate if some files in label1 are newer than their counterparts in label2, while some files in label2 are newer than their counterparts in label1, or if the View: fields are different between the two labels.

Finally, do not use the following command, since it will not do the expected:

p4 changes @label1,@label2

The above command does not include changes to files that exist in one label but not the other. Therefore, keep in mind that adds and deletes will cause the above command to completely ignore those files unless they are listed in both labels simultaneously and where the second label contains a revision of the file which is equal to or greater than the first.

For illustration;

@label1 - foo#2
@label2 - foo#1

p4 changes @label1,@label2
[no results]

p4 changes @label2,@label1
Change 17 on 2008/05/05 by marc@fasty

Note: Perforce revision ranges, when labels are involved, operate on the intersection of the files.