How to get the file count for each revision of mercurial using python script

我怕爱的太早我们不能终老 提交于 2020-01-06 02:48:08

问题


import sys
import hglib
import re 

# figure out what repo path to use

if len(sys.argv) > 1:
    repo1 = sys.argv[1]    

# connect to hg
client1 = hglib.open(repo1)

for data1 in client1.log("date('>2015-06-01') and date('<2015-09-16')"):

    m = re.findall("\w+\\-\d+", data1.desc.upper())
    if len(m)> 0:     
        data_row = [data1.rev,data1.author,data1.branch,data1.desc,m[0]] 

This script gives the revision,author,branch,description . I want to get count of files for each revision. How can this be done?


回答1:


You can use status:

>>> changes = client.status(rev=[start, end], modified=True, added=True)
>>> len(changes)
6

I've now found you can also do:

>>> changes = client.status(change=[start, end])
>>> len(changes)
6


来源:https://stackoverflow.com/questions/32345436/how-to-get-the-file-count-for-each-revision-of-mercurial-using-python-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!