mercurial/cmdutil.py
changeset 25228 63a57a2727b6
parent 25169 7855d1f5f152
child 25256 5a8398b085ed
--- a/mercurial/cmdutil.py	Wed May 20 01:06:09 2015 +0900
+++ b/mercurial/cmdutil.py	Sun May 17 22:42:47 2015 -0400
@@ -2297,12 +2297,16 @@
         fm.write('path', fmt, m.rel(f))
         ret = 0
 
-    if subrepos:
-        for subpath in sorted(ctx.substate):
+    for subpath in sorted(ctx.substate):
+        def matchessubrepo(subpath):
+            return (m.always() or m.exact(subpath)
+                    or any(f.startswith(subpath + '/') for f in m.files()))
+
+        if subrepos or matchessubrepo(subpath):
             sub = ctx.sub(subpath)
             try:
                 submatch = matchmod.narrowmatcher(subpath, m)
-                if sub.printfiles(ui, submatch, fm, fmt) == 0:
+                if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0:
                     ret = 0
             except error.LookupError:
                 ui.status(_("skipping missing subrepository: %s\n")