代码之家  ›  专栏  ›  技术社区  ›  Charlie

如何从脚本中检测使用Perforce的“重新打开以进行编辑”

  •  0
  • Charlie  · 技术社区  · 16 年前

    我正在编写一个与Perforce交互的脚本,Perforce需要能够理解挂起的变更列表。为此,我使用' p4 describe p4 opened 这是非常简单的。例如,打开进行编辑的文件显示如下(从p4 Open开始):

    //source/stuff/things.h#1 add default change (text)
    

    不能 p4 edit '在要分支的文件上),然后再提交。集成一个文件,然后在提交集成之前使用“重新打开以进行编辑”也是如此。在分支的情况下,文件显示为“add”,不表示还有分支正在进行(因此上面的示例可以是真正的add,也可以是重新打开的分支)。在integrate案例中,它显示为“edit”。在这两种情况下,在我提交更改后,我可以看到文件被分支/集成,但我需要能够对挂起的更改执行此操作。从理论上讲,我希望看到这样的情况,在这里,things.h是从Thang分支和编辑的。h:

    //source/stuff/things.h#1 add default change (text)
      branch from //source/other/thangs.h#42
    

    有人知道实现这一目标的方法吗?我还要提到的是,我正在运行一个旧版本的Perforce(从2004年开始),所以也许它在新版本中是可行的,我只需要更新我的软件。

    2 回复  |  直到 16 年前
        1
  •  2
  •   Paul Du Bois    16 年前

    " p4 resolved “它几乎完全符合您的要求,但不幸的是,它在2007年是新的。

    [C:\dfp\Common\Code\Python]p4 opened foo.py
    //buddha/Common/Code/Python/foo.py#1 - add default change (kxtext)
    
    [C:\dfp\Common\Code\Python]p4 resolved foo.py
    c:\dfp\Common\Code\Python\foo.py - branch from //buddha/Common/Code/Python/memdump.py#1,#30
    

        2
  •  0
  •   Mark    16 年前

    我认为在发布“重新打开进行编辑”时,这是不可能的。正如您已经指出的,reopen命令将文件状态更改为其他状态。我运行了一个本地测试(我正在运行2008.2)。自您的版本以来,perforce报告文件添加/编辑状态的方式似乎确实发生了一些变化,但您尝试执行的操作似乎仍然不可能

    d:\sandbox\ctg_test>p4 integ test.txt test_branch.txt
    //ctg_test/test_branch.txt#1 - branch/sync from //ctg_test/Test.txt#1,#15
    
    d:\sandbox\ctg_test>p4 opened
    //ctg_test/test_branch.txt#1 - branch default change (text)
    

    请注意,opened命令现在显示文件状态的“branch”,而不是add,我认为它可能在您的服务器版本中显示了add。但是踢球者:

    d:\sandbox\ctg_test>p4 edit test_branch.txt
    //ctg_test/test_branch.txt#1 - reopened for add
    
    d:\sandbox\ctg_test>p4 opened
    //ctg_test/test_branch.txt#1 - add default change (text)
    

    d:\sandbox\ctg_test>p4 -ztag opened
    ... depotFile //ctg_test/test_branch.txt
    ... clientFile //client-mark.allender/ctg_test/test_branch.txt
    ... rev 1
    ... action add
    ... change default
    ... type text
    ... user mark.allender
    ... client client-mark.allender
    

    p4 fstat也没有帮助。