log: include unmodified-in-merge files in log diff/stat (issue2383) stable
authorMads Kiilerich <mads@kiilerich.com>
Thu, 23 Sep 2010 01:23:16 +0200
branchstable
changeset 12382 28ddf67198b2
parent 12381 5965f369314b
child 12383 f1e8d6f6e682
child 12384 ffcceca7406d
log: include unmodified-in-merge files in log diff/stat (issue2383) f786fc4b8764 assumed that walkchangerevs called prep with all relevant matched filenames, but actually it only contains the names of files changed in the relevant changeset. That meant that log diff/stat of merges missed the diff for files only changed in the other branch. This is a minimal fix for making sure we only use fns when we are following and thus will have problems with merges anyway ...
mercurial/commands.py
tests/test-log
tests/test-log.out
--- a/mercurial/commands.py	Thu Sep 23 01:51:17 2010 +0200
+++ b/mercurial/commands.py	Thu Sep 23 01:23:16 2010 +0200
@@ -2533,7 +2533,11 @@
 
         revmatchfn = None
         if opts.get('patch') or opts.get('stat'):
-            revmatchfn = cmdutil.match(repo, fns, default='path')
+            if opts.get('follow') or opts.get('follow_first'):
+                # note: this might be wrong when following through merges
+                revmatchfn = cmdutil.match(repo, fns, default='path')
+            else:
+                revmatchfn = matchfn
 
         displayer.show(ctx, copies=copies, matchfn=revmatchfn)
 
--- a/tests/test-log	Thu Sep 23 01:51:17 2010 +0200
+++ b/tests/test-log	Thu Sep 23 01:23:16 2010 +0200
@@ -194,5 +194,26 @@
 cd dir
 hg log -p -R .. ../a
 
+cd ..
 
-exit 0
+echo '% issue2383'
+
+hg init issue2383
+cd issue2383
+echo a > a
+hg ci -Am0
+echo b > b
+hg ci -Am1
+hg co 0
+echo b > a
+hg ci -m2
+hg merge
+echo c > a
+hg ci -m3
+echo
+echo % diff
+hg diff --rev 2:3
+echo
+echo % log
+hg log -vpr 3
+cd ..
--- a/tests/test-log.out	Thu Sep 23 01:51:17 2010 +0200
+++ b/tests/test-log.out	Thu Sep 23 01:23:16 2010 +0200
@@ -585,3 +585,48 @@
 @@ -0,0 +1,1 @@
 +a
 
+% issue2383
+adding a
+adding b
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+created new head
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+
+% diff
+diff -r b09be438c43a -r 8e07aafe1edc a
+--- a/a	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +1,1 @@
+-b
++c
+diff -r b09be438c43a -r 8e07aafe1edc b
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/b	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++b
+
+% log
+changeset:   3:8e07aafe1edc
+tag:         tip
+parent:      2:b09be438c43a
+parent:      1:925d80f479bb
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       a
+description:
+3
+
+
+diff -r b09be438c43a -r 8e07aafe1edc a
+--- a/a	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +1,1 @@
+-b
++c
+diff -r b09be438c43a -r 8e07aafe1edc b
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/b	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++b
+