如何在Perforce中快速查找/删除所有空的更改列表?

Tho*_*iol 6 perforce administration changelist

我想知道在尝试删除已提交的更改列表时可能有什么意义,因为提交的更改列表不应该为空.

但后来我正在使用教程库,并在整个分支上使用obliterate命令,我可以看到有一种情况,你可以最终得到空的已提交的更改列表(需要使用-f标志删除).

但是,我不知道如何使用命令行找到它们,因为我不知道如何查找没有与之关联的文件的更改列表.

有一个简单的方法吗?

谢谢,

托马斯

Tho*_*iol 6

啊!

在询问之前我应该​​浏览更多文档...

http://public.perforce.com/wiki/Perforce_Command_Line_Recipes

描述:删除所有空提交的更改列表.
Shell命令:p4更改-s submitted | cut -d"" - f 2 | xargs -n1 p4更改-d -f
Powershell:p4更改-s submitted | %{p4 change -d -f $ _.split()[1]}
px:px -F%更改%更改-s提交| px -X- change -d -f
撰稿人:Sam Stafford,Philip Kania,Shawn Hladky

咄.

托马斯


Tho*_*iol 0

由于我在 Windows 上,我创建了一个小脚本,在 PERL 中执行完全相同的操作,而不是 Shell、powershell 或 px :):

#*******************************************************************************
# Module:  delete_empty_changelist.pl
# Purpose: A script to delete empty changelist
# 

@list = `p4 changes -s submitted`;

foreach $chg (@list)
{
 $chgnbr = (split /\s+/, $chg)[1];
 print `p4 change -d -f $chgnbr`;
 }     
exit 0;
Run Code Online (Sandbox Code Playgroud)

请注意,事实上,在所有情况下,它都不是一个非常聪明的脚本:它尝试绝对删除每个提交的更改列表,并且强制阻止这样做,因为如果文件与其关联,您将收到错误。

我想脚本的结果应该发送到日志并进行解析,以便仅突出显示相关行。

运行该脚本将产生类似于以下内容的输出:

Change 857 has 1 files associated with it and can't be deleted.
Change 856 has 1 fixes associated with it and can't be deleted.
Change 855 has 1 fixes associated with it and can't be deleted.
Change 854 deleted.
Change 853 has 1 fixes associated with it and can't be deleted.
Change 852 has 8 files associated with it and can't be deleted.
Change 851 has 1 files associated with it and can't be deleted.
Change 850 has 2 files associated with it and can't be deleted.
Change 849 has 2 files associated with it and can't be deleted.
Change 846 deleted.
Change 845 has 2 files associated with it and can't be deleted.
Run Code Online (Sandbox Code Playgroud)

干杯,

托马斯