merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 16 Jul 2014 17:35:04 -0500
changeset 21877 dbbae63865a6
parent 21875 33020e87f8c5 (current diff)
parent 21876 584bbfd1b50d (diff)
child 21878 e2530d4a47c1
merge with stable
mercurial/cmdutil.py
tests/test-log.t
--- a/mercurial/cmdutil.py	Sat Jul 12 20:07:24 2014 +0900
+++ b/mercurial/cmdutil.py	Wed Jul 16 17:35:04 2014 -0500
@@ -1488,7 +1488,7 @@
 
     return iterate()
 
-def _makelogfilematcher(repo, pats, followfirst):
+def _makelogfilematcher(repo, files, followfirst):
     # When displaying a revision with --patch --follow FILE, we have
     # to know which file of the revision must be diffed. With
     # --follow, we want the names of the ancestors of FILE in the
@@ -1502,7 +1502,7 @@
     wctx = repo[None]
 
     def populate():
-        for fn in pats:
+        for fn in files:
             for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
                 for c in i:
                     fcache.setdefault(c.linkrev(), set()).add(c.path())
@@ -1627,7 +1627,9 @@
     filematcher = None
     if opts.get('patch') or opts.get('stat'):
         if follow:
-            filematcher = _makelogfilematcher(repo, pats, followfirst)
+            # _makelogfilematcher expects its files argument to be relative to
+            # the repo root, so use match.files(), not pats.
+            filematcher = _makelogfilematcher(repo, match.files(), followfirst)
         else:
             filematcher = lambda rev: match
 
--- a/tests/test-log.t	Sat Jul 12 20:07:24 2014 +0900
+++ b/tests/test-log.t	Wed Jul 16 17:35:04 2014 -0500
@@ -223,6 +223,43 @@
   +a
   
 
+log -pf b inside dir
+
+  $ hg --cwd=dir log -pf b
+  changeset:   2:f8954cd4dc1f
+  user:        test
+  date:        Thu Jan 01 00:00:03 1970 +0000
+  summary:     c
+  
+  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
+  
+  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
+  
+  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
+  
+
 log -vf dir/b
 
   $ hg log -vf dir/b