diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1343,14 +1343,13 @@ def export(repo, revs, template='hg-%h.p single(rev, seqno+1, fp) def diffstatdata(lines): - filename = None + filename, adds, removes = None, 0, 0 for line in lines: if line.startswith('diff'): if filename: yield (filename, adds, removes) # set numbers to 0 anyway when starting new file - adds = 0 - removes = 0 + adds, removes = 0, 0 if line.startswith('diff --git'): filename = gitre.search(line).group(1) else: @@ -1360,7 +1359,8 @@ def diffstatdata(lines): adds += 1 elif line.startswith('-') and not line.startswith('---'): removes += 1 - yield (filename, adds, removes) + if filename: + yield (filename, adds, removes) def diffstat(lines): output = [] diff --git a/tests/test-notify b/tests/test-notify --- a/tests/test-notify +++ b/tests/test-notify @@ -84,3 +84,17 @@ hg --cwd b rollback hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \ -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \ -e 's/^Date:.*/Date:/' + +echo % test merge +cd a +hg up -C 0 +echo a >> a +hg ci -Am adda2 -d '2 0' +hg merge +hg ci -m merge -d '3 0' +cd .. + +hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \ + -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \ + -e 's/^Date:.*/Date:/' + diff --git a/tests/test-notify.out b/tests/test-notify.out --- a/tests/test-notify.out +++ b/tests/test-notify.out @@ -164,3 +164,56 @@ diff -r cb9a9f314b8b -r 0647d048b600 a a +a (run 'hg update' to get a working copy) +% test merge +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +created new head +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +pulling from ../a +searching for changes +adding changesets +adding manifests +adding file changes +added 2 changesets with 0 changes to 1 files +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Test: foo +Date: +Subject: adda2 +From: test@test.com +X-Hg-Notification: changeset 0a184ce6067f +Message-Id: +To: baz@test.com, foo@bar + +changeset 0a184ce6067f +description: + adda2 +diffstat: + + a | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diffs (6 lines): + +diff -r cb9a9f314b8b -r 0a184ce6067f a +--- a/a Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:02 1970 +0000 +@@ -1,1 +1,2 @@ + a ++a +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Test: foo +Date: +Subject: merge +From: test@test.com +X-Hg-Notification: changeset 22c88b85aa27 +Message-Id: +To: baz@test.com, foo@bar + +changeset 22c88b85aa27 +description: + merge +(run 'hg update' to get a working copy)