match: rename "narrowmatcher" to "subdirmatcher" (API)
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 05 Feb 2016 21:09:32 -0800
changeset 28017 d3f1b7ee5e70
parent 28016 a2be6f0f58fb
child 28018 3feadb0b6c34
match: rename "narrowmatcher" to "subdirmatcher" (API) I keep mistaking "narrowmatcher" for narrowhg's narrowmatcher. "subdirmatcher" seems more to the point anyway.
hgext/largefiles/overrides.py
mercurial/archival.py
mercurial/cmdutil.py
mercurial/context.py
mercurial/match.py
mercurial/scmutil.py
mercurial/subrepo.py
--- a/hgext/largefiles/overrides.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/hgext/largefiles/overrides.py	Fri Feb 05 21:09:32 2016 -0800
@@ -963,7 +963,7 @@
     if subrepos:
         for subpath in sorted(ctx.substate):
             sub = ctx.workingsub(subpath)
-            submatch = match_.narrowmatcher(subpath, matchfn)
+            submatch = match_.subdirmatcher(subpath, matchfn)
             sub._repo.lfstatus = True
             sub.archive(archiver, prefix, submatch)
 
@@ -1011,7 +1011,7 @@
 
     for subpath in sorted(ctx.substate):
         sub = ctx.workingsub(subpath)
-        submatch = match_.narrowmatcher(subpath, match)
+        submatch = match_.subdirmatcher(subpath, match)
         sub._repo.lfstatus = True
         sub.archive(archiver, prefix + repo._path + '/', submatch)
 
--- a/mercurial/archival.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/archival.py	Fri Feb 05 21:09:32 2016 -0800
@@ -331,7 +331,7 @@
     if subrepos:
         for subpath in sorted(ctx.substate):
             sub = ctx.workingsub(subpath)
-            submatch = matchmod.narrowmatcher(subpath, matchfn)
+            submatch = matchmod.subdirmatcher(subpath, matchfn)
             total += sub.archive(archiver, prefix, submatch)
 
     if total == 0:
--- a/mercurial/cmdutil.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/cmdutil.py	Fri Feb 05 21:09:32 2016 -0800
@@ -1142,7 +1142,7 @@
                 # node2 (inclusive). Thus, ctx2's substate won't contain that
                 # subpath. The best we can do is to ignore it.
                 tempnode2 = None
-            submatch = matchmod.narrowmatcher(subpath, match)
+            submatch = matchmod.subdirmatcher(subpath, match)
             sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
                      stat=stat, fp=fp, prefix=prefix)
 
@@ -2254,7 +2254,7 @@
     for subpath in sorted(wctx.substate):
         sub = wctx.sub(subpath)
         try:
-            submatch = matchmod.narrowmatcher(subpath, match)
+            submatch = matchmod.subdirmatcher(subpath, match)
             if opts.get('subrepos'):
                 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
             else:
@@ -2283,7 +2283,7 @@
     for subpath in sorted(wctx.substate):
         sub = wctx.sub(subpath)
         try:
-            submatch = matchmod.narrowmatcher(subpath, match)
+            submatch = matchmod.subdirmatcher(subpath, match)
             subbad, subforgot = sub.forget(submatch, prefix)
             bad.extend([subpath + '/' + f for f in subbad])
             forgot.extend([subpath + '/' + f for f in subforgot])
@@ -2340,7 +2340,7 @@
         if subrepos or matchessubrepo(subpath):
             sub = ctx.sub(subpath)
             try:
-                submatch = matchmod.narrowmatcher(subpath, m)
+                submatch = matchmod.subdirmatcher(subpath, m)
                 if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0:
                     ret = 0
             except error.LookupError:
@@ -2369,7 +2369,7 @@
         if subrepos or matchessubrepo(m, subpath):
             sub = wctx.sub(subpath)
             try:
-                submatch = matchmod.narrowmatcher(subpath, m)
+                submatch = matchmod.subdirmatcher(subpath, m)
                 if sub.removefiles(submatch, prefix, after, force, subrepos):
                     ret = 1
             except error.LookupError:
@@ -2467,7 +2467,7 @@
     for subpath in sorted(ctx.substate):
         sub = ctx.sub(subpath)
         try:
-            submatch = matchmod.narrowmatcher(subpath, matcher)
+            submatch = matchmod.subdirmatcher(subpath, matcher)
 
             if not sub.cat(submatch, os.path.join(prefix, sub._path),
                            **opts):
--- a/mercurial/context.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/context.py	Fri Feb 05 21:09:32 2016 -0800
@@ -365,7 +365,7 @@
                     # node1 and node2 (inclusive). Thus, ctx2's substate
                     # won't contain that subpath. The best we can do ignore it.
                     rev2 = None
-                submatch = matchmod.narrowmatcher(subpath, match)
+                submatch = matchmod.subdirmatcher(subpath, match)
                 s = sub.status(rev2, match=submatch, ignored=listignored,
                                clean=listclean, unknown=listunknown,
                                listsubrepos=True)
--- a/mercurial/match.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/match.py	Fri Feb 05 21:09:32 2016 -0800
@@ -334,13 +334,13 @@
     m.bad = badfn
     return m
 
-class narrowmatcher(match):
+class subdirmatcher(match):
     """Adapt a matcher to work on a subdirectory only.
 
     The paths are remapped to remove/insert the path as needed:
 
     >>> m1 = match('root', '', ['a.txt', 'sub/b.txt'])
-    >>> m2 = narrowmatcher('sub', m1)
+    >>> m2 = subdirmatcher('sub', m1)
     >>> bool(m2('a.txt'))
     False
     >>> bool(m2('b.txt'))
--- a/mercurial/scmutil.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/scmutil.py	Fri Feb 05 21:09:32 2016 -0800
@@ -913,7 +913,7 @@
         if opts.get('subrepos') or matchessubrepo(m, subpath):
             sub = wctx.sub(subpath)
             try:
-                submatch = matchmod.narrowmatcher(subpath, m)
+                submatch = matchmod.subdirmatcher(subpath, m)
                 if sub.addremove(submatch, prefix, opts, dry_run, similarity):
                     ret = 1
             except error.LookupError:
--- a/mercurial/subrepo.py	Wed Feb 03 18:59:35 2016 +0000
+++ b/mercurial/subrepo.py	Fri Feb 05 21:09:32 2016 -0800
@@ -774,7 +774,7 @@
         ctx = self._repo[rev]
         for subpath in ctx.substate:
             s = subrepo(ctx, subpath, True)
-            submatch = matchmod.narrowmatcher(subpath, match)
+            submatch = matchmod.subdirmatcher(subpath, match)
             total += s.archive(archiver, prefix + self._path + '/', submatch)
         return total