【问题标题】:git p4 how to submit a cl after a shelved cl is approvedgit p4 如何在搁置的 cl 获得批准后提交 cl
【发布时间】:2019-01-18 04:56:35
【问题描述】:

我目前在 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 &lt;cl&gt;

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

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

提前感谢您的帮助。

【问题讨论】:

    标签: git version-control perforce git-p4


    【解决方案1】:

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

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

    在您的 git 存储库中,签出您执行 git p4 submit --shelve 的分支(或您使用 git p4 unshelve 创建的提交),然后执行 git p4 submit(不是 --shelve)。它将从同一个提交中创建一个新的更改列表,并立即将其提交给 perforce。

    您还可以通过删除 git p4 submit --shelve 创建的更改列表来整理 perforce 方面。在 p4 工作区中,运行 p4 shelve -d &lt;cl&gt;,然后运行 ​​p4 change -d &lt;cl&gt;

    【讨论】:

      【解决方案2】:

      要做你想做的事,你可以执行以下操作:

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

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

      【讨论】:

        【解决方案3】:

        您是否尝试过p4 edit'ing 那些文件?如果没有,请尝试以下步骤:

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

        $: p4 edit <file1> <file2>
        

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

        p4 edit -t text+x <script1>
        

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

        $: p4 opened
        

        第 4 步(共 4 步)p4 shelve 获取新的更改列表。如果要提交到现有的 swarm 审核,则应在提交描述中添加现有的 swarm 审核编号 (#review-&lt;existing review number&gt;):

        $: 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...
        

        【讨论】:

          猜你喜欢
          • 2021-12-27
          • 1970-01-01
          • 2012-11-04
          • 1970-01-01
          • 1970-01-01
          • 2013-12-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多