[PATCH 2 of 3] revert: rename working directory matcher 'm' -> 'wmatch'

Matt Harbison mharbison72 at gmail.com
Wed Mar 25 23:20:56 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1427333998 14400
#      Wed Mar 25 21:39:58 2015 -0400
# Node ID 781d27e7fcd3a438d02bf2e1a9ba0a85537da6b9
# Parent  6e1b26088b8eca13825a91e4e1e3547c2e89f6a0
revert: rename working directory matcher 'm' -> 'wmatch'

Further down in the function, 'm' is reassigned to a matcher for a list of
files.  At the bottom of the function, another matcher is created to figure out
what subrepos need to be reverted.  For consistency with 5b85a5bc5bbb, this will
be changed to a working directory matcher.

We don't just recreate the working directory matcher based on 'pats' however,
because reusing the original working directory matcher will allow the 'pats'
parameter to be converted to a matcher.  That will allow better subrepo support,
and dropping the scmutil.match monkey patching done by largefiles.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2809,11 +2809,11 @@
         ## filling of the `names` mapping
         # walk dirstate to fill `names`
 
-        m = scmutil.match(repo[None], pats, opts)
-        if not m.always() or node != parent:
-            m.bad = lambda x, y: False
-            for abs in repo.walk(m):
-                names[abs] = m.rel(abs), m.exact(abs)
+        wmatch = scmutil.match(repo[None], pats, opts)
+        if not wmatch.always() or node != parent:
+            wmatch.bad = lambda x, y: False
+            for abs in repo.walk(wmatch):
+                names[abs] = wmatch.rel(abs), wmatch.exact(abs)
 
             # walk target manifest to fill `names`
 
@@ -2826,12 +2826,12 @@
                 for f in names:
                     if f.startswith(path_):
                         return
-                ui.warn("%s: %s\n" % (m.rel(path), msg))
-
-            m.bad = badfn
-            for abs in ctx.walk(m):
+                ui.warn("%s: %s\n" % (wmatch.rel(path), msg))
+
+            wmatch.bad = badfn
+            for abs in ctx.walk(wmatch):
                 if abs not in names:
-                    names[abs] = m.rel(abs), m.exact(abs)
+                    names[abs] = wmatch.rel(abs), wmatch.exact(abs)
 
             # Find status of all file in `names`.
             m = scmutil.matchfiles(repo, names)
@@ -2839,10 +2839,10 @@
             changes = repo.status(node1=node, match=m,
                                   unknown=True, ignored=True, clean=True)
         else:
-            changes = repo.status(match=m)
+            changes = repo.status(match=wmatch)
             for kind in changes:
                 for abs in kind:
-                    names[abs] = m.rel(abs), m.exact(abs)
+                    names[abs] = wmatch.rel(abs), wmatch.exact(abs)
 
             m = scmutil.matchfiles(repo, names)
 


More information about the Mercurial-devel mailing list