log: include unmodified-in-merge files in log diff/stat (issue2383)

f02da4369319 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 ...
This commit is contained in:
Mads Kiilerich 2010-09-23 01:23:16 +02:00
parent b0f0118486
commit 48773bdeed
3 changed files with 72 additions and 2 deletions

View File

@ -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)

View File

@ -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 ..

View File

@ -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