如何检测 Perforce 的“重新打开进行编辑”的使用 从脚本
我正在编写一个与 Perforce 交互的脚本,其中需要能够理解待处理的变更列表。 为此,我使用“p4描述
”和“p4打开
”,它们非常简单。 例如,打开进行编辑的文件显示如下(从打开的 p4 开始):
//source/stuff/things.h#1 add default change (text)
我似乎无法弄清楚如何检测用户已分支文件然后使用在提交该文件之前,对该文件执行“重新打开以进行编辑”命令(相当于在要分支的文件上使用“p4 edit
”)。 集成文件并在提交集成之前使用“重新打开进行编辑”也是如此。 在分支情况下,文件显示为“添加”,没有任何迹象表明还有一个分支正在进行(因此上面的示例可能是真正的添加或重新打开的分支)。 在集成情况下,它显示为“编辑”。 在这两种情况下,在提交更改后,我可以看到文件已分支/集成,但我需要能够对待处理的更改执行此操作。 理论上,我希望看到这样的东西,其中 things.h 是从 tangs.h 分支和编辑的:
//source/stuff/things.h#1 add default change (text)
branch from //source/other/thangs.h#42
有人知道实现此目的的方法吗? 我还要提到,我正在运行 Perforce 的旧版本(从 2004 年开始),所以也许它在较新的版本中是可行的,我只需要更新我的软件。
I'm working on a script to interact with Perforce, which among other things needs to be able to understand pending changelists. For this I use 'p4 describe
' and 'p4 opened
', which are pretty straightforward. For instance, a file opened for edit shows up like this (from p4 opened):
//source/stuff/things.h#1 add default change (text)
What I can't seem to figure out is how to detect cases where a user has branched a file and then used the 'Reopen for edit' command on that file (which amounts to using 'p4 edit
' on the file to be branched) prior to submitting it. Same thing goes for integrating a file and then using 'Reopen for edit' before submitting the integration. In the branch case, the file shows up as an 'add' with no indication that there's also a branch going on (so the above example could be either a true add or a reopened branch). In the integrate case it, shows up as an 'edit'. In both cases, after I submit the change I can see that the file was branched/integrated, but I need to be able to do this for pending changes. In theory I would hope to see something like this, where things.h is being branched and edited from thangs.h:
//source/stuff/things.h#1 add default change (text)
branch from //source/other/thangs.h#42
Does anybody know of a way to accomplish this? I'll also mention that I'm running an old-ish version of Perforce (from 2004), so perhaps it's doable in newer versions and I just need to update my software.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“p4 returned" 几乎完全符合您的要求,但不幸的是它是2007.2新增的。
在用户运行“解决”之前,您可能无法检测到问题,但他们必须在提交之前解决问题。
"p4 resolved" does almost exactly what you want, but unfortunately it is new in 2007.2.
You probably won't be able to detect problems before the user runs "resolve", but they're going to have to resolve before they submit.
我认为在发出“重新打开编辑”时这是不可能的。 正如您已经指出的,重新打开命令会将文件状态更改为不同的状态。 我运行了本地测试(我正在运行2008.2)。 自您的版本以来,强制报告文件的添加/编辑状态的方式似乎确实发生了一些变化,但您尝试做的事情似乎仍然不可能 请
注意,打开的命令现在显示“分支”文件状态而不是添加,我认为它可能已随您的服务器版本一起显示。 但更关键的是:
我尝试使用 -ztag 选项查看是否提供了更多信息:
p4 fstat 也没有帮助。
I do not think that this is possible when issuing a "reopen for edit". As you have already indicated, the reopen command will change a files status to something different. I ran a local test (I'm running 2008.2). There do seem to be some changes in the way that perforce reports on the add/edit status of files since your version, but what you are trying to do still doesn't seem possible
Note that the opened command now shows 'branch' for the file status instead of add which I think it might have shown with your version of the server. But the kicker:
I tried looking with the -ztag option to see if more info was given:
p4 fstat was no help either.