英文:
different between p4 sync ...#123456 and p4 sync ... #123456
问题
尊敬的,
最近我发现在使用p4 sync命令时犯了一个错误,我在“...”和@123456之间多加了一个空格。
本应该是**"p4 sync ...@123456"
,但我却使用了"p4 sync ... @123456"
**。
有人能帮忙解释一下这个错误命令可能会导致什么问题吗?我自己没有感觉到任何区别,但有人告诉我这是错误的,我想了解并找出更多信息。
谢谢。
王阳
英文:
Dear,
I found I made a mistake recently by using p4 sync command, where I put extra space between "..." and @123456.
It supposed to be "p4 sync ...@123456", but I used "p4 sync ... @123456"
Could anyone help explain what it can happen with this wrong command ? I didn't feel diffference, but someone told me it is wrong, I would like to understand and figure out more here.
Thanks.
Wangyang
答案1
得分: 1
Spaces separate arguments (in any CLI app, including p4
).
Perforce允许您将文件规范和修订规范合并为单个参数。当它们结合在一起时,您会得到它们的交集。
大多数p4命令操作文件时接受多个参数,当指定多个参数时,等效于在每个参数上单独调用命令,因此通常的效果是一个并集(尽管并非所有命令都是幂等的或可组合的,因此可能存在使其不完全是并集操作的相互作用)。
因此:
p4 sync ...@123456
意味着“同步当前目录...
下的所有内容到修订版本@123456
”。
p4 sync ... @123456
与以下内容相同:
p4 sync ...
p4 sync @123456
也就是说,“同步当前目录...
下的所有内容到最新修订版本,然后同步工作区中的所有内容到修订版本@123456
”。
如果当前目录是工作区根目录,那么这些操作的最终效果将是相同的(尽管命令可能在将所有内容同步到#head
之前将其同步回@123456
时进行一些额外的工作)。如果当前目录是工作区中的子文件夹,效果将非常不同,因为第一个版本的命令会将工作区中的许多其他内容同步到修订版本@123456
,而第一个版本的命令不会。
英文:
Spaces separate arguments (in any CLI app, including p4
).
Perforce lets you combine a file specification and a revision specification into a single argument. When they're combined, you get their intersection.
Most p4 commands that operate on files accept multiple arguments, and when multiple arguments are specified, it's equivalent to invoking the command on each arg individually, so the net effect is usually a union (although not all commands are idempotent or combinable, so interactions that make it not exactly a union operation are possible).
Hence:
p4 sync ...@123456
means "sync everything under the current directory ...
to the revision @123456
".
p4 sync ... @123456
means the same as:
p4 sync ...
p4 sync @123456
that is, "sync everything under the current directory ...
to the head revision, and then sync everything in the workspace to the revision @123456
."
If the current directory is the workspace root, then the net effect of these operations will be the same (although the command might do some extra work in syncing everything to #head
before it syncs it back to @123456
). If the current directory is a subfolder in the workspace, the effect will be very different since you'll sync a bunch of other stuff in your workspace to @123456
that the first version of the command wouldn't.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论