[PATCH 2 of 2] changeset templater: ability to display diffstat
Alexander Solovyov
piranha at piranha.org.ua
Tue Jan 13 18:33:52 UTC 2009
# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1231871526 -7200
# Node ID f782065b3df22b39122de3ff6f9ae797359f61f0
# Parent 13ea6795429ea3273b023133f4d0261cbdb4086b
changeset templater: ability to display diffstat
diff -r 13ea6795429e -r f782065b3df2 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py Tue Jan 13 20:28:06 2009 +0200
+++ b/mercurial/cmdutil.py Tue Jan 13 20:32:06 2009 +0200
@@ -827,6 +827,16 @@
node=hex(changes[0])))
return self.t('manifest', **args)
+ def showdiffstat(**args):
+ diff = ''.join(patch.diff(self.repo, log.parents(changenode)[0],
+ changenode))
+ files, adds, removes = 0, 0, 0
+ for i in patch.diffstatdata(diff.splitlines()):
+ files += 1
+ adds += i[1]
+ removes += i[2]
+ return '%s: +%s/-%s' % (files, adds, removes)
+
defprops = {
'author': changes[1],
'branches': showbranches,
@@ -843,6 +853,7 @@
'rev': rev,
'tags': showtags,
'extras': showextras,
+ 'diffstat': showdiffstat,
}
props = props.copy()
props.update(defprops)
More information about the Mercurial-devel
mailing list