perforce:创建当前挂起列表的本地备份

发布于 2024-08-11 10:28:56 字数 136 浏览 4 评论 0原文

无论如何,我有一个包含一些更改文件的待处理列表。现在我想恢复到基础,但又不想丢失我的更改,所以我想将它们备份到某个地方。就像保存每个文件的差异一样。稍后,我想恢复这些更改并继续我的工作。

这可能吗?如果是这样,怎么办?

谢谢!

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

羞稚 2024-08-18 10:28:56

根本不需要外部工具,假设您使用的是 unix 机器(或者在 Windows 下有正确的 cygwin 设置,尚未测试它。)唯一需要注意的是 Perforce 的 p4 diff 会产生与 patch 稍微不兼容的输出,因此您需要它指向您的 unix diff 命令。在您的客户端根目录中,您可以执行

P4DIFF=/usr/bin/diff p4 diff -du > pending-changes.patch

可选操作(如果您想从命令行恢复打开的文件,否则使用 p4v):

p4 revert `p4 opened|awk -F\# '{print $1}'`

稍后您将打开文件进行编辑(可以通过从补丁文件中提取受影响的文件来自动化< code>pending-changes.patch 然后:

patch < pending-patches

根据客户端根目录中的路径布局,您必须使用 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 with patch, therefore you need it to point to your unix diff-command. In your client-root you can do

P4DIFF=/usr/bin/diff p4 diff -du > pending-changes.patch

optional (if you want to revert the open files from the command-line, otherwise use p4v):

p4 revert `p4 opened|awk -F\# '{print $1}'`

Later you would open the files for edit (can be automated by extracting the affected files from the patchfile pending-changes.patch and then:

patch < pending-patches

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.

柠檬心 2024-08-18 10:28:56

你应该能够做一个架子。这是保存更改列表以供将来编辑的一种方法。下面的链接是 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

思念绕指尖 2024-08-18 10:28:56

从 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.

短叹 2024-08-18 10:28:56

另请参阅这个问题:

在不签入的情况下将我的更改列表发送给其他人。

这基本上是同一件事。

See also this question:

Sending my changelist to someone else without checking in.

It's basically the same thing.

℡Ms空城旧梦 2024-08-18 10:28:56
  • 在某个适当的位置创建这些文件的分支
  • 查看已编辑的文件的分支版本
  • 从主干复制编辑过的文件并提交它们
  • 恢复主干上的文件

现在您已经安全地获得了所需的“差异”已存档。当您准备稍后应用这些更改时,只需将它们重新集成到主干中即可。

这就是 Brett 提到的 Python 脚本,确实。这是无需任何特殊工具即可手动完成的方法。

  • Create a branch of these files in some appropriate location
  • Check out the branch versions of the files you have edited
  • Copy the edited files over from the trunk and submit them
  • Revert the files on the trunk

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文