perforce - 快速同步特定版本的多个文件

perforce - sync multiple files at specific revisions quickly

有没有办法快速同步特定版本的多个文件。

例如指定文件和修订列表如下: 富#1 小节#4 baz#3

我可以在他 shell 的 foreach 循环中单独同步它们 - 但对于大型列表来说这会很慢。那么有没有 quick/batch 的方法呢?

我知道如何使用标签 - 但在这种情况下,我们必须假设这组文件和修订不存在标签 - 我们拥有的唯一来源是如上所示的列表。

您可以使用文件作为带有 -x 全局选项标志的参数,正如 Bryan 在他的评论中提到的那样。

EXAMPLE - sync

-- Notice the file contents of 'syncfile.txt' with three filenames, at specific revisions.

$ cat syncfile.txt
foo#1
bar#4
baz#3

-- The client workspace currently has all the head revisions.

$ p4 have //depot/test/...
//depot/test/bar#5 - /home/admin/depot/test/bar
//depot/test/baz#4 - /home/admin/depot/test/baz
//depot/test/foo#5 - /home/admin/depot/test/foo

-- Now the file is passed as an argument with the 'sync' command, and the updates display

$ p4 -x syncfile.txt sync
//depot/test/foo#1 - updating /home/admin/depot/test/foo
//depot/test/bar#4 - updating /home/admin/depot/test/bar
//depot/test/baz#3 - updating /home/admin/depot/test/baz

-- Running the 'have' command again to verify that indeed the specific revisions were synced.

$ p4 have //depot/test/...
//depot/test/bar#4 - /home/admin/depot/test/bar
//depot/test/baz#3 - /home/admin/depot/test/baz
//depot/test/foo#1 - /home/admin/depot/test/foo

EXAMPLE - ADD

-- Notice the file contents of 'addfiles.txt' with three filenames.

$ cat addfiles.txt
who
me
you

-- The file is passed as an argument with the 'add' command, and the files listed are added.

$ p4 -x addfiles.txt add
//depot/test/who#1 - opened for add
//depot/test/me#1 - opened for add
//depot/test/you#1 - opened for add

以下是如何在文档中使用“-x”标志的示例:

http://answers.perforce.com/articles/KB_Article/The-x-Flag

http://answers.perforce.com/articles/KB_Article/Adding-a-Directory-Tree

http://answers.perforce.com/articles/KB_Article/Integ-Using-the-x-Global-Option

http://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html

经过评论区的讨论,我明白了一些。

如果标签做你想做的事(基本上是在某个时间点同步到特定工作区中的一组文件),那么就使用它们。

标签影响仓库性能的想法是错误地使用标签。许多从 VSS(和其他一些系统)迁移到 Perforce 的公司和开发组在 perforce 中使用标签,就像他们在 VSS 中使用标签一样——基本上是为了标记时间点。这允许您为版本设置标签,并在需要时返回到该版本。实际上,每个更改列表都是一个时间点。

perforce 中的标签不是这样工作的,当它们被用来基本上复制一个变更列表时,构建系统通常每晚都会创建一个标签,那么它们就是对性能的巨大浪费。

在你的情况下标签是正确的解决方案,我建议你仔细阅读它们并在它们适用于你的场景时使用它们。