mercurial/cmdutil.py
changeset 17746 6d218e47cf9b
parent 17676 f87683a1b02a
child 17788 9912baaae7df
--- a/mercurial/cmdutil.py	Thu Sep 13 17:57:43 2012 -0700
+++ b/mercurial/cmdutil.py	Thu Sep 13 23:50:45 2012 -0700
@@ -1111,6 +1111,17 @@
                 wanted.add(rev)
                 if copied:
                     copies.append(copied)
+
+        # We decided to fall back to the slowpath because at least one
+        # of the paths was not a file. Check to see if at least one of them
+        # existed in history, otherwise simply return
+        if slowpath:
+            for path in match.files():
+                if path == '.' or path in repo.store:
+                    break
+                else:
+                    return []
+
     if slowpath:
         # We have to read the changelog to match filenames against
         # changed files
@@ -1286,6 +1297,18 @@
                     raise util.Abort(
                         _('cannot follow nonexistent file: "%s"') % f)
                 slowpath = True
+
+        # We decided to fall back to the slowpath because at least one
+        # of the paths was not a file. Check to see if at least one of them
+        # existed in history - in that case, we'll continue down the
+        # slowpath; otherwise, we can turn off the slowpath
+        if slowpath:
+            for path in match.files():
+                if path == '.' or path in repo.store:
+                    break
+            else:
+                slowpath = False
+
     if slowpath:
         # See walkchangerevs() slow path.
         #