changeset 35462:5bec509dc1ff

log: make "slowpath" condition slightly more readable Before 8e0e334bad42 and 6c76c42a5893, the condition was "anypats() or (files() and --removed)". This can be read as "<match is actually slow> or <walk files including removed revs>". So "not always()" (i.e. walk file revs) seems more appropriate here. The logic should be unchanged: not anypats() => always() or isexact() or prefix() isexact() => not always() prefix() => not always()
author Yuya Nishihara <yuya@tcha.org>
date Tue, 19 Dec 2017 21:41:39 +0900
parents 2c47986505ff
children b520c8f98e1e
files mercurial/cmdutil.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Dec 18 11:23:51 2017 -0800
+++ b/mercurial/cmdutil.py	Tue Dec 19 21:41:39 2017 +0900
@@ -2193,8 +2193,7 @@
     if not revs:
         return []
     wanted = set()
-    slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
-                                   opts.get('removed'))
+    slowpath = match.anypats() or (not match.always() and opts.get('removed'))
     fncache = {}
     change = repo.changectx
 
@@ -2390,8 +2389,7 @@
     # platforms without shell expansion (windows).
     wctx = repo[None]
     match, pats = scmutil.matchandpats(wctx, pats, opts)
-    slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
-                                   opts.get('removed'))
+    slowpath = match.anypats() or (not match.always() and opts.get('removed'))
     if not slowpath:
         for f in match.files():
             if follow and f not in wctx: