diff mercurial/cmdutil.py @ 25228:63a57a2727b6

files: recurse into subrepos automatically with an explicit path
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 17 May 2015 22:42:47 -0400
parents 7855d1f5f152
children 5a8398b085ed
line wrap: on
line diff
--- 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")