如何在 Perforce 中快速查找/删除所有空变更列表?
我想知道尝试删除已提交的更改列表有什么意义,因为已提交的更改列表不应该为空。
但后来我正在使用教程库,并在整个分支上使用 obliterate 命令,我可以看到在某些情况下您可能会得到空的已提交变更列表(需要使用 -f 标志删除)。
但是,我不知道如何使用命令行找到它们,因为我不知道如何查找没有关联文件的更改列表。
有没有简单的方法可以做到这一点?
谢谢,
托马斯
I was wondering what could be the point in trying to delete committed changelists, because a committed changelist is not supposed to be empty.
But then I am playing with the tutorial depot, and using the obliterate command on a whole branch, I can see there are situation where you can end up with empty committed changelists (that need deletion with the -f flag).
However, I don't know how to find them with the command line, as I don't know how to look for changelists with no files associated with.
Is there an easy way to do that ?
Thanks,
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(4)
由于我在 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;
请注意,事实上,在所有情况下,它都不是一个非常聪明的脚本:它尝试删除绝对是每个提交的变更列表,并且强制阻止这样做,因为如果文件与其关联,您将收到错误。
我想脚本的结果应该发送到日志并进行解析,以便仅突出显示相关行。
运行该脚本将产生类似于以下内容的输出:
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.
Cheers,
Thomas
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
啊!
在问这个问题之前我应该浏览更多文档...
http://public.perforce.com/wiki/Perforce_Command_Line_Recipes
Duh。
托马斯
Ah !
I should have browse more documentation before asking this...
http://public.perforce.com/wiki/Perforce_Command_Line_Recipes
Duh.
Thomas