mercurial/cmdutil.py
changeset 29802 35560189677c
parent 29795 142ae01820a3
child 29819 2cec6eaf3610
--- a/mercurial/cmdutil.py	Sun Aug 14 14:46:24 2016 +0900
+++ b/mercurial/cmdutil.py	Tue Aug 16 08:15:12 2016 +0000
@@ -2416,10 +2416,10 @@
         ret = 0
 
     for subpath in sorted(ctx.substate):
-        if subrepos or m.matchessubrepo(subpath):
+        submatch = matchmod.subdirmatcher(subpath, m)
+        if (subrepos or m.exact(subpath) or any(submatch.files())):
             sub = ctx.sub(subpath)
             try:
-                submatch = matchmod.subdirmatcher(subpath, m)
                 recurse = m.exact(subpath) or subrepos
                 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
                     ret = 0
@@ -2448,12 +2448,11 @@
     count = 0
     for subpath in subs:
         count += 1
-        if subrepos or m.matchessubrepo(subpath):
+        submatch = matchmod.subdirmatcher(subpath, m)
+        if subrepos or m.exact(subpath) or any(submatch.files()):
             ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
-
             sub = wctx.sub(subpath)
             try:
-                submatch = matchmod.subdirmatcher(subpath, m)
                 if sub.removefiles(submatch, prefix, after, force, subrepos,
                                    warnings):
                     ret = 1