问题
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