perforce:创建当前挂起列表的本地备份
无论如何,我有一个包含一些更改文件的待处理列表。现在我想恢复到基础,但又不想丢失我的更改,所以我想将它们备份到某个地方。就像保存每个文件的差异一样。稍后,我想恢复这些更改并继续我的工作。
这可能吗?如果是这样,怎么办?
谢谢!
in perforce, i have a pending list with some changed files. now i want to revert to the base, but without loosing my changes, so i want to back them up somewhere. like saving the DIFFs of each file. at a later time, i want to restore those changes and continue my work.
is this possible? if so, how?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根本不需要外部工具,假设您使用的是 unix 机器(或者在 Windows 下有正确的 cygwin 设置,尚未测试它。)唯一需要注意的是 Perforce 的
p4 diff
会产生与patch
稍微不兼容的输出,因此您需要它指向您的 unix diff 命令。在您的客户端根目录中,您可以执行可选操作(如果您想从命令行恢复打开的文件,否则使用 p4v):
稍后您将打开文件进行编辑(可以通过从补丁文件中提取受影响的文件来自动化< code>pending-changes.patch 然后:
根据客户端根目录中的路径布局,您必须使用 patch 的
-p#num
选项来应用补丁干净地。there is no need for external tools at all, assuming you are on a unix machine (or have a proper cygwin setup under Windows, haven't tested it.) The only caveat is that Perforce's
p4 diff
produces an output that is slightly incompatible withpatch
, therefore you need it to point to your unix diff-command. In your client-root you can dooptional (if you want to revert the open files from the command-line, otherwise use p4v):
Later you would open the files for edit (can be automated by extracting the affected files from the patchfile
pending-changes.patch
and then:Depending on your path-layout in your client-root, you have to use the
-p#num
option of patch to get the patch applied cleanly.你应该能够做一个架子。这是保存更改列表以供将来编辑的一种方法。下面的链接是 Perforce 的 Python 插件,它实现了搁置。另外,我知道 Practical Perforce 有几种方法可以在无需外部脚本的情况下搁置当前更改。我面前没有这本书,但今晚我会尝试更新这个问题。
http://public.perforce.com/wiki/P4_Shelve
You should be able to do a shelve. It's a way of saving a changelist for future editing. The link below is a Python add-in for Perforce that implements shelve. Also, I know that Practical Perforce has a couple of ways to shelve current changes without an external script. I don't have the book in front of me but I'll try to update this question tonight when I do.
http://public.perforce.com/wiki/P4_Shelve
从 P4Shelve 链接到的 P4tar 看起来非常有用,并且在客户端上执行操作,而不是比在服务器上分支。
当然,我很快就会考虑做类似的事情。
Linked to from P4Shelve, is P4tar which looks very useful, and does the operations on the client, rather than branching on the server.
Certainly I'll be looking into doing similar things soon.
另请参阅这个问题:
在不签入的情况下将我的更改列表发送给其他人。
这基本上是同一件事。
See also this question:
Sending my changelist to someone else without checking in.
It's basically the same thing.
现在您已经安全地获得了所需的“差异”已存档。当您准备稍后应用这些更改时,只需将它们重新集成到主干中即可。
这就是 Brett 提到的 Python 脚本,确实。这是无需任何特殊工具即可手动完成的方法。
Now you've got those "diffs" you wanted safely archived. When your ready to apply those changes later on, just integrate them back into the trunk.
This is what the Python script, that Brett mentioned, does. This is the way to do it manually without any special tools.