简体   繁体   English

p4 CLI:如何查找尚未“添加”以执行控制的新文件

[英]p4 CLI: How to find new files not yet “added” to perforce control

I have looked at different ways of doing this using diff. 我已经看过使用diff完成此操作的不同方法。 The first option I tried is: 我尝试的第一个选项是:

p4 diff -sa

Opened files that are different from the revision in the depot, or missing. 已打开的文件与软件仓库中的修订版本不同或丢失。

Initially I figured that this was a file with write permission bit set that did not exist in the depot. 最初,我发现这是一个在仓库中不存在设置了写许可权位的文件。 However, I have since learned p4 doesn't use mode bits to track opened/unopened states as I first thought. 但是,从那以后,我就了解到p4并不像我最初想到的那样使用模式位来跟踪打开/未打开的状态。

Next I figured this option would work: 接下来,我认为此选项可以工作:

p4 diff -sl

Every unopened file, along with the status of 'same', 'diff' or 'missin' as compared to its revision in the depot. 每个未打开的文件,以及与软件仓库中版本相比的“相同”,“差异”或“缺失”状态。

This would be okay, except "unopened" is not inclusive of "untracked" files. 可以,除非“未打开”不包括“未跟踪”文件。 Although, when I ran this, it produced something quite different that contradicts the documentation; 虽然,当我运行它时,它产生了与文档相矛盾的完全不同的东西。 it output pretty much everything that was tracked, but also output everything that wasn't tracked, but flagged them as 'same'. 它输出几乎所有被跟踪的内容,但也输出所有未被跟踪的内容,但将它们标记为“相同”。 Maybe this means that it hasn't been added and doesn't exist in the depot, so the client is the same as the depot...? 也许这意味着它尚未添加,并且在仓库中不存在,因此客户端与仓库相同...? In my SVN biased opinion, a rather pointless option. 以我对SVN的偏见,这是一个毫无意义的选择。

Then there is the 'opened' option. 然后是“打开”选项。 But this does exactly that. 但这确实做到了。 It lists all the files in the depot that have been opened on the client; 它列出了软件仓库中已在客户端上打开的所有文件; so not the files modified on the client not yet added. 因此尚未在客户端上修改的文件尚未添加。

So is there an option I am missing somewhere, that will provide some valuable answer, like SVN and CVS are able to do with one simple command? 那么,我在某处缺少一个选项,它将提供一些有价值的答案,例如SVN和CVS能够使用一个简单的命令来完成吗?

$ svn status
A added
M modified
R deleted
? untracked
L locked
C conflict

Or: 要么:

$ cvs -q up -Pd

Well, there exists "p4 status", which is very similar in both purpose and behavior to "svn status". 好吧,存在“ p4状态”,其目的和行为都与“ svn状态”非常相似。

For more ideas, see: http://answers.perforce.com/articles/KB_Article/Working-Disconnected-From-The-Perforce-Server 有关更多想法,请参阅: http : //answers.perforce.com/articles/KB_Article/Working-Disconnected-From-The-Perforce-Server

Okay, looking around and playing with the 'add' command, it seems that a read-only add will output successful message if the file is not currently controlled: 好的,环顾四周并使用“ add”命令,如果当前未控制文件,则只读add似乎会输出成功消息:

$ p4 add -n -f somefile
//source/somefile#1 - opened for add

I applied this to the following command and pretty much get what I need: 我将此应用到以下命令,几乎可以得到我所需要的:

$ find . -type f | while read f ; do p4 add -f -n "$f" | grep -e '- opened for add' >/dev/null && echo "A $f"; done
A ./somefile

Or if you're not bothered about local paths: 或者,如果您不担心本地路径:

$ find . -type f | xargs -l1 p4 add -f -n | grep -e '- opened for add'
//source/somefile#1 - opened for add

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM