Perforce Changelist 和搁置命令

Perforce Changelist and shelve command

我是 Perforce 的新手,刚开始使用它。 使用 $p4 sync 命令同步我的代码后,我开始编辑一些文件。

这些文件被添加到我的默认更改列表中。为了与我的团队合作,我想创建一个变更列表。为了创建更改列表,我 运行 $p4 更改并从更改列表描述中删除了 "file1"。现在当我 运行 $p4 打开时。它给出了类似于此的输出。

现在我有以下几个问题:

如果有人能详细回答这些问题就太好了。 Perforce 的任何教程建议也将有很大帮助。

提前致谢。

我推荐的 Perforce 教程是 Perforce 用户指南。这是关于更改列表的部分:

https://www.perforce.com/perforce/r15.1/manuals/intro/chapter.working_in_perforce.html#working_in_perforce.working_with_files.changelists

Which changelist am i currently working on is it default or 111 ??

两者都有!这两个都是您工作区中的待定更改列表。

what is the meaning of (text+k)?

括号里的是"filetype"。 +k 是一个 "filetype modifier",意思是当您提交时,此文件中的关键字(如 $Id$$Revision$$Author$ 等特殊词将自动扩展为适当的值。

When i make changes to file2 and file3 it is getting synced to changelist 111 and when i make changes to file1 it gets synced to default changelist . I am highly confused how is this happening ?

"synced" 还没有任何进展 -- 待定的更改列表只是引用不同文件的容器。当您 shelvesubmit 然后 时,与这些更改列表关联的文件将被发送到服务器,其他客户端将可以访问这些文件。由于 shelvesubmit 是更改列表级别的操作,因此只有那些更改列表中的文件会受到影响——这就是具有不同的待处理更改列表的意义所在。您的工作区中有所有未决文件,但您可以拆分哪些文件在何时发送到服务器(这有点像在 git 中推送不同的分支,但不是——您可以在Perforce 中的每个操作,即使您没有分支,因为每个文件都是单独版本化的,而不是将整个树版本化为一个原子 blob。

Also one more thing i am confused about is if do $p4 shelve will my changes disappear and will be reapplied only when i run unshelve command for the changelist created ?? Is this similar to git stash and git stash apply ?

不,p4 shelve 只会将服务器上搁置的更改与您工作区中的本地文件同步——它本身不会更改您的工作区。 "stashing" 相当于 p4 shelve,然后 p4 revert 以清除工作区更改。 shelve 本身更像是对分支执行 git push —— 你保留本地副本,但现在它也在服务器上(但不是 "master" 历史的一部分) . (虽然这并不完全相同——老实说,如果你是 Perforce 的新手,我会坚持在常规的旧分支中使用常规的旧 "submit",因为这是基本的工作流程。通过书架共享工作需要很多更多的手动工作,因为每个架子就像它自己的小迷你分支,没有版本控制。)