[PATCH] buggy diff in notify with multiple changesets
Aurelien Jacobs
aurel at gnuage.org
Mon May 15 18:21:19 CDT 2006
Hi,
I encountered a bug in notify used within the incoming hook.
Here is the test case:
echo eee >> a
hg ci -m "add eee to a"
echo fff >> a
hg ci -m "add fff to a"
hg push
The resulting mail for the second commit is perfect, but the
mail for the first commit contains the following diff :
-------------------------
description:
add eee to a
diffs (9 lines):
diff -r 8b686fcea81d -r 747e06a1f9ee a
--- a/a Mon May 15 01:12:11 2006 +0200
+++ b/a Tue May 16 00:49:22 2006 +0200
@@ -32,3 +32,5 @@ ooo
ooo
aaa
aaa
+eee
+fff
-------------------------
So as you can see, it contains a merge of the two commits.
The attached patch fix this issue.
Aurel
-------------- next part --------------
# HG changeset patch
# User "Aurelien Jacobs <aurel at gnuage.org>"
# Node ID 13e23fb88fc902d64cff048dfa68aa6721b4f07f
# Parent ba7afc7dd9013e2805098d19a6371f12d916fe25
notify changeset diff should be against current node instead of tip
diff -r ba7afc7dd901 -r 13e23fb88fc9 hgext/notify.py
--- a/hgext/notify.py Wed May 10 16:55:55 2006 -0500
+++ b/hgext/notify.py Tue May 16 01:19:15 2006 +0200
@@ -228,14 +228,13 @@ class notifier(object):
mail = self.ui.sendmail()
mail.sendmail(templater.email(msg['From']), self.subs, msgtext)
- def diff(self, node):
+ def diff(self, node, ref):
maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
if maxdiff == 0:
return
fp = templater.stringio()
prev = self.repo.changelog.parents(node)[0]
- commands.dodiff(fp, self.ui, self.repo, prev,
- self.repo.changelog.tip())
+ commands.dodiff(fp, self.ui, self.repo, prev, ref)
difflines = fp.getvalue().splitlines(1)
if maxdiff > 0 and len(difflines) > maxdiff:
self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
@@ -260,8 +259,9 @@ def hook(ui, repo, hooktype, node=None,
count = end - start
for rev in xrange(start, end):
n.node(repo.changelog.node(rev))
+ n.diff(node, repo.changelog.tip())
else:
count = 1
n.node(node)
- n.diff(node)
+ n.diff(node, node)
n.send(node, count)
More information about the Mercurial
mailing list