diff mercurial/scmutil.py @ 29758:2372182e505b

match: added matchessubrepo method to matcher Previously there were three local implementations of this function in cmdutil.files, cmdutil.remove and scmutil.addremove.
author Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
date Tue, 09 Aug 2016 09:02:51 +0000
parents 2dd8c225e94c
children 98976e3cae57
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Aug 08 22:06:07 2016 -0700
+++ b/mercurial/scmutil.py	Tue Aug 09 09:02:51 2016 +0000
@@ -948,17 +948,9 @@
     ret = 0
     join = lambda f: os.path.join(prefix, f)
 
-    def matchessubrepo(matcher, subpath):
-        if matcher.exact(subpath):
-            return True
-        for f in matcher.files():
-            if f.startswith(subpath):
-                return True
-        return False
-
     wctx = repo[None]
     for subpath in sorted(wctx.substate):
-        if opts.get('subrepos') or matchessubrepo(m, subpath):
+        if opts.get('subrepos') or m.matchessubrepo(subpath):
             sub = wctx.sub(subpath)
             try:
                 submatch = matchmod.subdirmatcher(subpath, m)