3

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

例如,指定文件和修订列表,如下所示: foo#1 bar#4 baz#3

我可以在他的 shell 中的 foreach 循环中单独同步这些 - 但这对于大型列表来说会很慢。那么有没有一种快速/批量的方法呢?

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

4

2 回答 2

3

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

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

于 2015-01-14T19:37:54.393 回答
1

在评论中讨论之后,我现在理解得更好了。

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

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

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

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

于 2015-01-15T12:35:56.803 回答