我有一个经典的Perforce仓库。给定是一个目录列表,其中每个目录代表一个分支。有没有办法检测给定的变更列表是否删除了分支中的所有文件(从而删除了整个分支(?
例如:
//depot/branch1
//depot/branch2
我试过:p4 sync -n //depot/branch1/...@<CHANGELIST>
同步整个分支。-n
是模拟或预览同步。但是返回的输出对我没有帮助。还有其他选择如何检测吗?
C:Perforcetest>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:Perforcetest>p4 files dir/...
//stream/main/dir/bar#2 - delete change 119 (text)
//stream/main/dir/foo#2 - delete change 119 (text)
C:Perforcetest>p4 files -e dir/...
dir/... - no such file(s).
所以做:
p4 files -e //depot/branch1/...
如果它显示no such file(s)
则该目录中的所有内容都已删除。
如果要检查某个提交的变更列表的状态,只需将变更列表添加为修订说明符:
C:Perforcetest>p4 files -e dir/...@119
dir/...@119 - no such file(s).
C:Perforcetest>p4 files -e dir/...@118
//stream/main/dir/bar#1 - add change 106 (text)
//stream/main/dir/foo#1 - add change 106 (text)
在这个例子中,我们可以说更改@119
是删除目录的那个,因为那个 changelist 文件不存在,但在前一个文件中它们存在。
这在流库中的工作方式相同:
C:Perforcetest>p4 switch foo
C:Perforcetest>p4 files ...
//stream/foo/dir/bar#2 - delete change 131 (text)
//stream/foo/dir/foo#2 - delete change 131 (text)
C:Perforcetest>p4 files -e ...
... - no such file(s).