[PATCH stable] log: fix missing diff output for hg log -p in sub directory

Yuya Nishihara yuya at tcha.org
Fri Jul 2 09:51:19 CDT 2010


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1278082146 -32400
# Branch stable
# Node ID 33bb2fe4b0f39698f0b55b86e8cac8a8ff635cb1
# Parent  239f3210c970615dc1d5f861a92b61b4662a71a5
log: fix missing diff output for hg log -p in sub directory

prep(ctx, fns) receives paths relative to repository root, not cwd.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2519,7 +2519,7 @@ def log(ui, repo, *pats, **opts):
 
         revmatchfn = None
         if opts.get('patch') or opts.get('stat'):
-            revmatchfn = cmdutil.match(repo, fns)
+            revmatchfn = cmdutil.match(repo, fns, default='path')
 
         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
@@ -181,4 +181,8 @@ hg log -b . -b test
 echo '% log -b 2'
 hg log -b 2
 
+echo '% log -p --cwd dir (in subdir)'
+mkdir dir
+hg log -p --cwd dir
+
 exit 0
diff --git a/tests/test-log.out b/tests/test-log.out
--- a/tests/test-log.out
+++ b/tests/test-log.out
@@ -464,3 +464,53 @@ user:        test
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     commit on default
 
+% log -p --cwd dir (in subdir)
+changeset:   3:f5d8de11c2e2
+branch:      test
+tag:         tip
+parent:      1:d32277701ccb
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     commit on test
+
+diff -r d32277701ccb -r f5d8de11c2e2 c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/c	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++c
+
+changeset:   2:c3a4f03cc9a7
+parent:      0:24427303d56f
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     commit on default
+
+diff -r 24427303d56f -r c3a4f03cc9a7 c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/c	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++c
+
+changeset:   1:d32277701ccb
+branch:      test
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     commit on test
+
+diff -r 24427303d56f -r d32277701ccb 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
+
+changeset:   0:24427303d56f
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     commit on default
+
+diff -r 000000000000 -r 24427303d56f a
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++a
+


More information about the Mercurial-devel mailing list