<div dir="ltr"><div>Hm sorry, that was the the wrong patch version. I'm gonna send again with whitespace fixed if it's worth it and i guess i should patch against default for this.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 17, 2016 at 7:56 AM, Hannes Oldenburg <span dir="ltr"><<a href="mailto:hannes.christian.oldenburg@gmail.com" target="_blank">hannes.christian.oldenburg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Hannes Oldenburg <a href="mailto:zerstroyer@gmail.com">zerstroyer@gmail.com</a><br>
# Date 1468660399 0<br>
#      Sat Jul 16 09:13:19 2016 +0000<br>
# Branch stable<br>
# Node ID eb4a974d3a18826632600dabe82c8fe453b65e20<br>
# Parent  a7d1532b26a17bbaace43124cd415dcb709b08e2<br>
cmdutil: extract duplicate definitions of matchessubrepo in files() and remove()<br>
<br>
diff -r a7d1532b26a1 -r eb4a974d3a18 mercurial/cmdutil.py<br>
--- a/mercurial/cmdutil.py      Sat Jul 02 09:41:40 2016 -0700<br>
+++ b/mercurial/cmdutil.py      Sat Jul 16 09:13:19 2016 +0000<br>
@@ -2396,6 +2396,10 @@<br>
     forgot.extend(f for f in forget if f not in rejected)<br>
     return bad, forgot<br>
<br>
+def matchessubrepo(m,subpath):<br>
+    return (m.exact(subpath)<br>
+            or any(f.startswith(subpath + '/') for f in m.files()))<br>
+<br>
 def files(ui, ctx, m, fm, fmt, subrepos):<br>
     rev = ctx.rev()<br>
     ret = 1<br>
@@ -2413,11 +2417,7 @@<br>
         ret = 0<br>
<br>
     for subpath in sorted(ctx.substate):<br>
-        def matchessubrepo(subpath):<br>
-            return (m.exact(subpath)<br>
-                    or any(f.startswith(subpath + '/') for f in m.files()))<br>
-<br>
-        if subrepos or matchessubrepo(subpath):<br>
+        if subrepos or matchessubrepo(m,subpath):<br>
             sub = ctx.sub(subpath)<br>
             try:<br>
                 submatch = matchmod.subdirmatcher(subpath, m)<br>
@@ -2448,14 +2448,6 @@<br>
     total = len(subs)<br>
     count = 0<br>
     for subpath in subs:<br>
-        def matchessubrepo(matcher, subpath):<br>
-            if matcher.exact(subpath):<br>
-                return True<br>
-            for f in matcher.files():<br>
-                if f.startswith(subpath):<br>
-                    return True<br>
-            return False<br>
-<br>
         count += 1<br>
         if subrepos or matchessubrepo(m, subpath):<br>
             ui.progress(_('searching'), count, total=total, unit=_('subrepos'))<br>
_______________________________________________<br>
Mercurial-devel mailing list<br>
<a href="mailto:Mercurial-devel@mercurial-scm.org">Mercurial-devel@mercurial-scm.org</a><br>
<a href="https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel" rel="noreferrer" target="_blank">https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div><br></div>