git p4 搁置的 cl 获得批准后如何提交 cl

git p4 how to submit a cl after a shelved cl is approved

我目前在 git 维护一个项目。 同一项目的另一个团队正在使用 perforce。 他们不可能使用 git.

我正在尝试使用 git p4 通过以下链接中的指南更新两个存储库。

https://git-scm.com/docs/git-p4

https://developer.atlassian.com/blog/2015/01/work-with-git-and-perforce/

https://owenou.com/git-up-perforce-with-git-p4

但是,我卡在了 Perforce 的 Swarm Review 中。

/home/user/projectgit << folder for git project where I work on
/home/user/projectp4 << workspace folder for git p4

在提交给 Perforce 之前,我必须先搁置我可以通过 git p4 submit --shelved

完成的更新

现在我的 cl 被批准后,我该如何提交?

没有git p4 submit <cl>

我尝试了 git p4 unshelved <cl>,但是我现在如何处理 refs/remote/p4/unsheved/<cl> 中未搁置的提交?

我也尝试使用 p4 submit <cl>(在 git p4 的工作区中),但它抱怨没有要提交的文件。

在此先感谢您的帮助。

I also tried using p4 submit (while in the git p4's workspace) but it complains about no files to commit

可以通过自己调用 p4 命令来做到这一点,但是因为你 运行 遇到了麻烦(并且可能对学习 p4 细节不感兴趣)我建议让 git-p4 为您完成大部分工作。

在您的 git 存储库中,检查您从中执行 git p4 submit --shelve 的 b运行ch(或您使用 git p4 unshelve 创建的提交),然后执行git p4 submit(没有--shelve)。它将从同一提交创建一个新的更改列表,并立即将其提交给 perforce。

您还可以通过删除 git p4 submit --shelve 创建的更改列表来整理 perforce 端。在 p4 工作区中,运行 p4 shelve -d <cl> 后跟 p4 change -d <cl>.

要执行您想要的操作,您可以执行以下操作:

p4 unshelve -s <shelf #> -c <shelf #>
p4 submit -c <shelf #>
p4 revert //...

注意:我从我的 git 存储库中执行此操作,但我在该存储库中有一个有效的 .p4config 文件指向我在其中创建我的书架的 p4 工作区。

您是否尝试过 p4 edit 处理这些文件?如果没有,请尝试以下步骤:

第 1 步,共 4 步)p4 edit源代码:

$: p4 edit <file1> <file2>

第 2 步(共 4 步)p4 edit -t text+x 脚本 and/or 需要执行权限的二进制文件:

p4 edit -t text+x <script1>

第 3 步(共 4 步)检查 p4 opened 以确保列出您想要在新更改列表中的所有文件:

$: p4 opened

第 4 步(共 4 步)p4 shelve 获取新的更改列表。如果你想提交到现有的swarm review,你应该在提交描述中添加现有的swarm review编号(#review-<existing review number>):

$: p4 shelve

假设现有评论编号为 12345678,那么您需要将其添加到描述中,如下所示:

Description:
<tab>I want to add XYZ to this existing changelist #review-12345678 @<reviewer1> @<reviewer2>

<tab>This is a longer description explaining XYZ...