p4python:获取 diff2 形式的仓库 [英] p4python: get diff2 form depot

查看:63
本文介绍了p4python:获取 diff2 形式的仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检索下一个命令的输出(其中 p4 是标准的 perforce 客户端):

I want to retrieve output of the next command (where p4 is standard perforce client):

p4 diff2 //depot/...#1 //depot/...#2

在终端它产生这样的东西:

In terminal it is producing something like this:

==== //depot/bin/build.sh#1 (xtext) - //depot/bin/build.sh#2 (xtext) ==== content
1a2
> #added something 2
9c10
< fi---
> fi
==== //depot/bin/README#1 - <none> ===
==== //depot/bin/status_ok#1 - <none> ===

假设我在 python 中有下一个脚本:

Let's assume that I have next script in python:

from P4 import P4
p4 = P4()
p4.port = "1818"
p4.host = "localhost"
p4.user = "psih"
p4.client = "build_verificator_ws2"
p4.connect()
changes = p4.run_diff2("//depot/...#1", "//depot/...#2")
print changes
p4.disconnect()

执行 python 脚本后,我会收到类似这样的信息:

After execution python script I will receive something like that:

[{'status': 'content', 'depotFile2': '//depot/bin/build.sh', 'rev': '1', 'rev2': '2', 'type': 'xtext', 'depotFile': '//depot/bin/build.sh', 'type2': 'xtext'}, {'status': 'left only', 'type': 'text', 'rev': '1', 'depotFile': '//depot/bin/README'}, {'status': 'left only', 'type': 'text', 'rev': '1', 'depotFile': '//depot/bin/status_ok'}]

软件仓库中有修订但没有差异的文件列表.

List of files in depot with revisions but no diffs.

有什么建议吗?

推荐答案

答案是使用未标记的响应:

The answer is in using a non-tagged response:

changes = p4.run_diff2("//depot/...#1", "//depot/...#2", tagged=False)

这篇关于p4python:获取 diff2 形式的仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆