Reputation: 3229
I have a classic Perforce depot. Given is a list of directories where each directory represents a branch. Is there any way to detect if a given changelist deletes all files in the branch (and therefore deletes the entire branch)?
E.g:
//depot/branch1
//depot/branch2
I tried: p4 sync -n //depot/branch1/...@<CHANGELIST>
to sync the entire branch. -n
is to simulate, or to preview, a sync. But the returned output doesn't help me. Is there any other option how to detect that?
Upvotes: 0
Views: 64
Reputation: 71517
C:\Perforce\test>p4 help files
files -- List files in the depot
p4 files [ -a ] [ -A ] [ -e ] [-i] [ -m max ] file[revRange] ...
...
The -e flag displays files with an action of anything other than
deleted, purged or archived. Typically this revision is always
available to sync or integrate from.
C:\Perforce\test>p4 files dir/...
//stream/main/dir/bar#2 - delete change 119 (text)
//stream/main/dir/foo#2 - delete change 119 (text)
C:\Perforce\test>p4 files -e dir/...
dir/... - no such file(s).
So do:
p4 files -e //depot/branch1/...
If it says no such file(s)
then everything in that directory has been deleted.
If you want to check the state as of a certain submitted changelist, just add the changelist as a revision specifier:
C:\Perforce\test>p4 files -e dir/...@119
dir/...@119 - no such file(s).
C:\Perforce\test>p4 files -e dir/...@118
//stream/main/dir/bar#1 - add change 106 (text)
//stream/main/dir/foo#1 - add change 106 (text)
In this example we can tell that change @119
specifically was the one to delete the directory because at that changelist files don't exist, but at the prior one they do.
This works the same way in a stream depot:
C:\Perforce\test>p4 switch foo
C:\Perforce\test>p4 files ...
//stream/foo/dir/bar#2 - delete change 131 (text)
//stream/foo/dir/foo#2 - delete change 131 (text)
C:\Perforce\test>p4 files -e ...
... - no such file(s).
Upvotes: 2