Patchwork [2,of,7] walkchangerevs: avoid match.files() in conditions

login
register
mail settings
Submitter Martin von Zweigbergk
Date May 21, 2015, 9:32 p.m.
Message ID <9df9ff660c4d0e0d183d.1432243949@waste.org>
Download mbox | patch
Permalink /patch/9222/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Martin von Zweigbergk - May 21, 2015, 9:32 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1432060490 25200
#      Tue May 19 11:34:50 2015 -0700
# Node ID 9df9ff660c4d0e0d183de87a6f76f233e3aa934c
# Parent  2d9c6fe9c552ede353adb4df22da54fddac7b320
walkchangerevs: avoid match.files() in conditions

See 9789b4a7c595 (match: introduce boolean prefix() method,
2014-10-28) for reasons to avoid match.files() in conditions.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1749,7 +1749,8 @@ 
     if not revs:
         return []
     wanted = set()
-    slowpath = match.anypats() or (match.files() and opts.get('removed'))
+    slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
+                                   opts.get('removed'))
     fncache = {}
     change = repo.changectx
 
@@ -1829,7 +1830,7 @@ 
     # Now that wanted is correctly initialized, we can iterate over the
     # revision range, yielding only revisions in wanted.
     def iterate():
-        if follow and not match.files():
+        if follow and match.always():
             ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
             def want(rev):
                 return ff.match(rev) and rev in wanted