# HG changeset patch # User Mads Kiilerich # Date 2010-09-22 23:23:16 # Node ID 28ddf67198b2fd08c74415d7f6beea0ee3798767 # Parent 5965f369314bb472c90b8a6f673cab8242f88655 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 ... diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2533,7 +2533,11 @@ def log(ui, repo, *pats, **opts): 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) diff --git a/tests/test-log b/tests/test-log --- a/tests/test-log +++ b/tests/test-log @@ -194,5 +194,26 @@ echo '% log -p -R repo' 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 .. diff --git a/tests/test-log.out b/tests/test-log.out --- a/tests/test-log.out +++ b/tests/test-log.out @@ -585,3 +585,48 @@ diff -r 000000000000 -r 24427303d56f a @@ -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 +