diff mercurial/cmdutil.py @ 28387:97175d9bf7cf stable

files: don't recurse into subrepos without a path or -S (issue5127) The 'm.always()' check was needed for when a path to 'sub1' is given, and 'sub1' contains a subrepo itself. But that also caused the automatic recursion when no path was given. Instead, force -S when printing a subrepo if the subpath is an exact match (which will unconditionally recurse once in the nested subrepo).
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 06 Mar 2016 14:30:34 -0500
parents c407583cf5f6
children 3072ce740945
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Jan 26 22:44:29 2016 +0900
+++ b/mercurial/cmdutil.py	Sun Mar 06 14:30:34 2016 -0500
@@ -2340,14 +2340,15 @@
 
     for subpath in sorted(ctx.substate):
         def matchessubrepo(subpath):
-            return (m.always() or m.exact(subpath)
+            return (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, subrepos) == 0:
+                recurse = m.exact(subpath) or subrepos
+                if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
                     ret = 0
             except error.LookupError:
                 ui.status(_("skipping missing subrepository: %s\n")