--- a/hgkeeper.py Tue Apr 07 21:04:37 2020 -0500
+++ b/hgkeeper.py Tue Apr 07 23:38:27 2020 -0500
@@ -21,7 +21,7 @@
@templatefilter(b'md5', intype=bytes)
- return hashlib_md5(text).hexdigest()
+ return hashlib_md5(text).hexdigest().encode('ascii') def _diffstattmplgen(orig, context, ctx, statgen, parity):
@@ -38,21 +38,22 @@
template = b'diffstatlink' if filename in files else b'diffstatnolink'
- b'removepct': pct(removes),
- b'parity': next(parity),
+ b'removepct': pct(removes), + b'parity': next(parity), + yield context.process(template, data) # right now we just capture the starting line numbers as that's all we need
RE_DIFF = re.compile(r'^@@ -(\d+),\d+ \+(\d+),\d+ @@')
@@ -153,8 +154,8 @@
diffhunks = patch.diffhunks(repo, basectx, ctx, m, opts=diffopts)
for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1):
- filea, fileb = "/dev/null", "/dev/null"
+ filea, fileb = b'/dev/null', b'/dev/null' @@ -177,15 +178,15 @@
args = (lines, blockno, lineidprefix, filea, reva, fileb, revb)
l = templateutil.mappedgenerator(_prettyprintdifflines, args)
- changetype = 'modified'
- if filea == '/dev/null':
- elif fileb == '/dev/null':
+ changetype = b'modified' + if filea == b'/dev/null': + elif fileb == b'/dev/null': + changetype = b'removed'
+ changetype = b'renamed'
b'changetype': changetype,
@@ -196,6 +197,8 @@
extensions.wrapfunction(webutil, "_diffstattmplgen", _diffstattmplgen)