如何从sync-p4python获取所有更改编号

如何从sync-p4python获取所有更改编号,python,perforce,p4python,Python,Perforce,P4python,我定期进行p4同步,并想知道实际同步了什么。 因此,我从p4.run_sync中得到了返回,这是每次更改的dict列表(据我所知) 当我打印钥匙时,它看起来是这样的: sync dict Nr: 0 -------------- * totalFileSize * rev * totalFileCount * clientFile * fileSize * action * depotFile * change sync dict Nr: 1 -------------- * action *

我定期进行p4同步,并想知道实际同步了什么。 因此,我从
p4.run_sync
中得到了返回,这是每次更改的dict列表(据我所知)

当我打印钥匙时,它看起来是这样的:

sync dict Nr: 0 --------------
* totalFileSize
* rev
* totalFileCount
* clientFile
* fileSize
* action
* depotFile
* change
sync dict Nr: 1 --------------
* action
* clientFile
* rev
* depotFile
* fileSize
sync dict Nr: 2 --------------
* action
* clientFile
* rev
* depotFile
* fileSize
因此,只有在第一个dict中才有一个变化数字

我怎么才能找到其他人?我目前浏览了其他dict的
depotFiles
,并从
p4.fstat
中获取了头更改。。但这似乎很有意思

实际上,我希望同步的每个变更编号都能立即获取描述


还是有更合适的方法?谢谢

首先
p4.run_sync()
或任何
p4.run_COMMAND()
返回一个列表而不是dict。列表中的每个元素可以是dict或字符串,具体取决于Performce server支持以及是否禁用标记

从以下文件:

  • 当您运行
    p4.run_sync()
    (相当于
    p4 sync…
    )时,您将获得该目录下所有文件的最新版本
  • 列表中的第一个文件包含Performe同步到的最新更改编号,它不必是修改该文件时所做的更改
  • 变更编号仅对应于该目录下的最新变更
  • 列表中的其余文件将忽略此冗余信息。这就是为什么键
    change
    不是文件列表中其他dict的一部分
对于每个文件,您在
rev
键中获得的修订号与
depotFile
中的完整性能路径相结合,对应于存储库中文件的唯一版本(例如
//depot/branch1/dir1/file1#4

您可以通过
fstat
使用以下信息。(不,这不是一种黑客方式,这是获取与特定文件和修订版对应的变更号的正确方式)


这表明
//depot/branch1/dir1/file1
的第4版作为更改的一部分
12345

非常感谢!您可以将答案缩短为:*否,它的同步中每个文件的dict
列表
,并*将
rev
nr附加到您的fstat查询中。
sync dict Nr: 0 --------------
* totalFileSize
* rev
* totalFileCount
* clientFile
* fileSize
* action
* depotFile
* change
sync dict Nr: 1 --------------
* action
* clientFile
* rev
* depotFile
* fileSize
sync dict Nr: 2 --------------
* action
* clientFile
* rev
* depotFile
* fileSize
Whether the elements of the array are strings or dictionaries depends on
(a) server support for tagged output for the command, and
(b) whether tagged output was disabled by calling p4.tagged = False.
>>> result = p4.run_fstat("//depot/branch1/dir1/file1#4")
>>> print result[0]['headChange']
12345