[PATCH 2 of 4] Replace match.files with match.anyfiles as appropriate

Martin Geisler mg at aragost.com
Thu Sep 23 10:03:20 CDT 2010


# HG changeset patch
# User Martin Geisler <mg at aragost.com>
# Date 1285253484 -7200
# Node ID f25293364dda43c039550527f3130bd900c2c995
# Parent  fe6086f0af535e5ce27c15ab25b91c630b448339
Replace match.files with match.anyfiles as appropriate

When we are not interested in the file names themselves, then
match.anyfiles is clearer than match.files.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1104,7 +1104,7 @@
     if not revs:
         return []
     wanted = set()
-    slowpath = match.anypats() or (match.files() and opts.get('removed'))
+    slowpath = match.anypats() or (match.anyfiles() and opts.get('removed'))
     fncache = {}
     change = util.cachefunc(repo.changectx)
 
@@ -1113,7 +1113,7 @@
     # wanted: a cache of filenames that were changed (ctx.files()) and that
     # match the file filtering conditions.
 
-    if not slowpath and not match.files():
+    if not slowpath and not match.anyfiles():
         # No files, no patterns.  Display all revs.
         wanted = set(revs)
     copies = []
@@ -1256,7 +1256,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 not match.anyfiles():
             ff = followfilter(onlyfirst=opts.get('follow_first'))
             def want(rev):
                 return ff.match(rev) and rev in wanted
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -494,7 +494,7 @@
         if matchfn == match.exact: # match.exact
             exact = True
             dirignore = util.always # skip step 2
-        elif match.files() and not match.anypats(): # match.match, no patterns
+        elif match.anyfiles() and not match.anypats(): # match.match, no patterns
             skipstep3 = True
 
         files = sorted(match.files())
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -863,7 +863,7 @@
             merge = len(wctx.parents()) > 1
 
             if (not force and merge and match and
-                (match.files() or match.anypats())):
+                (match.anyfiles() or match.anypats())):
                 raise util.Abort(_('cannot partially commit a merge '
                                    '(do not specify files or patterns)'))
 
@@ -888,7 +888,7 @@
                     changes[0].insert(0, '.hgsubstate')
 
             # make sure all explicit patterns are matched
-            if not force and match.files():
+            if not force and match.anyfiles():
                 matched = set(changes[0] + changes[1] + changes[2])
 
                 for f in match.files():


More information about the Mercurial-devel mailing list