【问题标题】:Get local location for Perforce opened files获取 Perforce 打开文件的本地位置
【发布时间】:2014-06-24 22:42:00
【问题描述】:

我想编写一个脚本来处理已编辑的文件。 p4 opened 给出了一个很好的列表,但它使用的是 depot 语法。有没有办法以本地语法获取输出,以便我可以将结果传递给我的脚本?

我在 Linux 上运行 Perforce。

【问题讨论】:

    标签: linux perforce


    【解决方案1】:

    p4 where 会告诉你仓库文件在本地的位置。

    您需要获取p4 opened 的输出并使用p4 where 将每个软件仓库路径转换为本地路径。

    This answer 可能会提供一些提示。

    编辑:还要查看p4 -ztag opened 是否适合您的需求。 -ztag 经常产生更详细但对脚本友好的输出。

    【讨论】:

    • @StephenRasku 查看我对-ztag 的编辑。如果您在脚本中使用 p4 opened-ztag 可能会有所帮助。
    【解决方案2】:

    如果你只想要文件的客户端语法,你可以使用 'p4 -Ztag opens' 命令,例如以下任一示例:

    $ p4 -Ztag opened | grep clientFile
    ... clientFile //admin14streams/depot/www/dev/Jam.html
    ... clientFile //admin14streams/depot/www/dev/Jambase.html
    ... clientFile //admin14streams/depot/www/dev/Jamfile.html
    ... clientFile //admin14streams/depot/www/dev/Jamlang.html
    ... clientFile //admin14streams/depot/www/dev/images/jamgraph-jam.gif
    ... clientFile //admin14streams/depot/www/dev/index.html
    
    
    $ p4 -Ztag opened | grep clientFile | cut -d ' ' -f3
    //admin14streams/depot/www/dev/Jam.html
    //admin14streams/depot/www/dev/Jambase.html
    //admin14streams/depot/www/dev/Jamfile.html
    //admin14streams/depot/www/dev/Jamlang.html
    //admin14streams/depot/www/dev/images/jamgraph-jam.gif
    //admin14streams/depot/www/dev/index.html
    

    “p4 where”命令将为您提供本地文件系统 但是,如果这是您想要的位置。

    $ p4 where //depot/www/dev/Jam.html
    //depot/www/dev/Jam.html //admin14streams/depot/www/dev/Jam.html /home/bruno/myspaces/admin14streams/depot/www/dev/Jam.html
    
    
    $ p4 -Ztag where //depot/www/dev/Jam.html
    ... depotFile //depot/www/dev/Jam.html
    ... clientFile //admin14streams/depot/www/dev/Jam.html
    ... path /home/bruno/myspaces/admin14streams/depot/www/dev/Jam.html
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-17
      • 1970-01-01
      • 2020-05-10
      • 1970-01-01
      • 1970-01-01
      • 2012-03-06
      • 2014-05-03
      • 1970-01-01
      相关资源
      最近更新 更多