python - p4 需要等效的 python 命令 describe

标签 python perforce p4python

我需要 p4 python 中 p4 describe #cl 的等价物。

但是,使用 p4python 运行相同的命令 p4.run_describe("#cl")。我得到口述:

[{'client': 'NonDev1408-Dev', 'digest': ['E41FFB100C73F7B443EE8DE7A0DD966C'], 'desc': 'Merging //ATTE/1507_SWP122 to OCX Main (//ATTE/1408-Dev)\n', 'type': ['text'], 'fileSize': ['33067'], 'status': 'submitted', 'rev': ['49'], 'depotFile': ['//ATTE/1408-Dev/cust/oms/bb/cord9src/src/main/java/amdocs/oms/cust/osact/foundation/NegotiateServiceConnection.java'], 'action': ['integrate'], 'user': 'mohitc', 'change': '243446', 'time': '1432731112', 'path': '//ATTE/1408-Dev/cust/oms/bb/cord9src/src/main/java/amdocs/oms/cust/osact/foundation/*', 'changeType': 'public'}]

相反,我想要像 p4 describe 243446 那样的输出,也就是说,我想要受影响文件之间的差异变化:

Change 243446 by mohitc@NonDev1408-Dev on 2015/05/27 15:51:52

        Merging //ATTE/1507_SWP122 to OCX Main (//ATTE/1408-Dev)

Affected files ...

... //ATTE/1408-Dev/cust/oms/bb/cord9src/src/main/java/amdocs/oms/cust/osact/foundation/NegotiateServiceConnection.java#49 integrate

Differences ...

==== //ATTE/1408-Dev/cust/oms/bb/cord9src/src/main/java/amdocs/oms/cust/osact/foundation/NegotiateServiceConnection.java#49 (text) ====

有没有其他方法可以使用 p4python 产生相同的输出?

最佳答案

试试这个:

import P4

p4 = P4.P4()
try:
    p4.connect()
    info = p4.run("info")
    for key in info[0]:
        print key, "=", info[0][key]
    print
    print


    if 1:
        p4.tagged = 0 

        #This makes the output untagged.
        result = p4.run("describe","5707")
        print result

except P4.P4Exception, ex:
    for w in p4.warnings:
        print w

finally:
    p4.disconnect()

希望对您有所帮助, 仁。

关于python - p4 需要等效的 python 命令 describe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31163174/

相关文章:

python - PyMongo 在大量查询后引发 [errno 49] 无法分配请求的地址

Python 无法打开符号链接(symbolic link)文件

backup - Perforce:将搁置的文件从工作区移动到备份

python - 无法在 python 中使用 p4 模块

python - 为 pandas 数据框中的每一行创建热图

python - 如何按键对字典进行排序?

version-control - 如何在两个时间戳记中查找到perforce软件仓库文件夹的所有 checkin

git - 使用 git-p4 获取整个文件的历史记录

python - 如何在不同步的情况下通过 p4python 读取 depot 的文件夹结构?

perforce - p4python:从仓库获取 diff2