Mercurial > hg
changeset 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 | b7e192240c41 |
children | b1d35e2e1af6 |
files | mercurial/cmdutil.py tests/test-subrepo-deep-nested-change.t |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
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")
--- a/tests/test-subrepo-deep-nested-change.t Tue Jan 26 22:44:29 2016 +0900 +++ b/tests/test-subrepo-deep-nested-change.t Sun Mar 06 14:30:34 2016 -0500 @@ -297,6 +297,12 @@ sub1/sub2/folder/bar (glob) sub1/sub2/x.txt (glob) + $ hg files + .hgsub + .hgsubstate + foo/bar/abc (glob) + main + $ hg files -S -r '.^' sub1/sub2/folder sub1/sub2/folder/test.txt (glob)