log: do not use exact matcher for --patch --follow without file (issue4319) stable
authorYuya Nishihara <yuya@tcha.org>
Fri, 01 Aug 2014 21:36:56 +0900
branchstable
changeset 21966 be94ed4baa5d
parent 21965 fd7839d1107d
child 21969 42418c49b0d2
log: do not use exact matcher for --patch --follow without file (issue4319) e2530d4a47c1 is valid only if file argument is specified. If no pattern specified, it can simply fall back to the original matcher.
mercurial/cmdutil.py
tests/test-log.t
--- a/mercurial/cmdutil.py	Thu Jul 31 16:32:12 2014 -0500
+++ b/mercurial/cmdutil.py	Fri Aug 01 21:36:56 2014 +0900
@@ -1629,7 +1629,7 @@
 
     filematcher = None
     if opts.get('patch') or opts.get('stat'):
-        if follow:
+        if follow and not match.always():
             # _makelogfilematcher expects its files argument to be relative to
             # the repo root, so use match.files(), not pats.
             filematcher = _makelogfilematcher(repo, match.files(), followfirst)
--- a/tests/test-log.t	Thu Jul 31 16:32:12 2014 -0500
+++ b/tests/test-log.t	Fri Aug 01 21:36:56 2014 +0900
@@ -260,6 +260,98 @@
   +a
   
 
+log -pf, but no args
+
+  $ hg log -pf
+  changeset:   3:2ca5ba701980
+  user:        test
+  date:        Thu Jan 01 00:00:04 1970 +0000
+  summary:     d
+  
+  diff -r f8954cd4dc1f -r 2ca5ba701980 a
+  --- a/a	Thu Jan 01 00:00:03 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -a
+  diff -r f8954cd4dc1f -r 2ca5ba701980 b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:04 1970 +0000
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r f8954cd4dc1f -r 2ca5ba701980 d
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/d	Thu Jan 01 00:00:04 1970 +0000
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r f8954cd4dc1f -r 2ca5ba701980 g
+  --- a/g	Thu Jan 01 00:00:03 1970 +0000
+  +++ b/g	Thu Jan 01 00:00:04 1970 +0000
+  @@ -1,2 +1,2 @@
+   f
+  -g
+  +f
+  
+  changeset:   2:f8954cd4dc1f
+  user:        test
+  date:        Thu Jan 01 00:00:03 1970 +0000
+  summary:     c
+  
+  diff -r d89b0a12d229 -r f8954cd4dc1f b
+  --- a/b	Thu Jan 01 00:00:02 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -a
+  diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/dir/b	Thu Jan 01 00:00:03 1970 +0000
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r d89b0a12d229 -r f8954cd4dc1f f
+  --- a/f	Thu Jan 01 00:00:02 1970 +0000
+  +++ b/f	Thu Jan 01 00:00:03 1970 +0000
+  @@ -1,1 +1,2 @@
+   f
+  +f
+  diff -r d89b0a12d229 -r f8954cd4dc1f g
+  --- a/g	Thu Jan 01 00:00:02 1970 +0000
+  +++ b/g	Thu Jan 01 00:00:03 1970 +0000
+  @@ -1,1 +1,2 @@
+   f
+  +g
+  
+  changeset:   1:d89b0a12d229
+  user:        test
+  date:        Thu Jan 01 00:00:02 1970 +0000
+  summary:     b
+  
+  diff -r 9161b9aeaf16 -r d89b0a12d229 b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:02 1970 +0000
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r 9161b9aeaf16 -r d89b0a12d229 g
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/g	Thu Jan 01 00:00:02 1970 +0000
+  @@ -0,0 +1,1 @@
+  +f
+  
+  changeset:   0:9161b9aeaf16
+  user:        test
+  date:        Thu Jan 01 00:00:01 1970 +0000
+  summary:     a
+  
+  diff -r 000000000000 -r 9161b9aeaf16 a
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:01 1970 +0000
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r 000000000000 -r 9161b9aeaf16 f
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/f	Thu Jan 01 00:00:01 1970 +0000
+  @@ -0,0 +1,1 @@
+  +f
+  
+
 log -vf dir/b
 
   $ hg log -vf dir/b