如何使用python脚本获取Mercurial的每个修订版的文件计数 [英] How to get the file count for each revision of mercurial using python script
本文介绍了如何使用python脚本获取Mercurial的每个修订版的文件计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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?
推荐答案
您可以使用 status
:
>>> changes = client.status(rev=[start, end], modified=True, added=True)
>>> len(changes)
6
我现已找到,您也可以这样做:
>>> changes = client.status(change=[start, end])
>>> len(changes)
6
这篇关于如何使用python脚本获取Mercurial的每个修订版的文件计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文