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

时间:2015-01-14 09:58:01

标签: sync perforce revisions

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

例如,指定文件和修订列表,如下所示: FOO#1 酒吧#4 巴兹#3

我可以在shell中的foreach循环中单独同步这些 - 但这对于大型列表来说会很慢。这样做有快速/批量的方法吗?

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

2 个答案:

答案 0 :(得分:3)

您可以将文件用作带有-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

答案 1 :(得分:1)

在评论中讨论后,我现在明白了一点。

如果标签符合您的要求(基本上在某个时间点同步到特定工作区中的一组文件),则使用它们。

如果出现影响仓库性能的标签的想法,则标签使用不正确。从VSS(和其他一些系统)迁移到Perforce的许多公司和开发团队都像在VSS中使用标签一样使用标签 - 基本上是为了标记一个时间点。这允许您为版本设置标签,如果需要,可以返回到该标签。在perforce中,每个变更列表都是一个时间点。

perforce中的标签不能像这样工作,当它们习惯于基本复制更改列表时,通常构建系统会每晚创建一个标签,然后它们会大大浪费性能。

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

相关问题