Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
28362:b7e192240c41 | 28387:97175d9bf7cf |
---|---|
2338 fm.write('path', fmt, m.rel(f)) | 2338 fm.write('path', fmt, m.rel(f)) |
2339 ret = 0 | 2339 ret = 0 |
2340 | 2340 |
2341 for subpath in sorted(ctx.substate): | 2341 for subpath in sorted(ctx.substate): |
2342 def matchessubrepo(subpath): | 2342 def matchessubrepo(subpath): |
2343 return (m.always() or m.exact(subpath) | 2343 return (m.exact(subpath) |
2344 or any(f.startswith(subpath + '/') for f in m.files())) | 2344 or any(f.startswith(subpath + '/') for f in m.files())) |
2345 | 2345 |
2346 if subrepos or matchessubrepo(subpath): | 2346 if subrepos or matchessubrepo(subpath): |
2347 sub = ctx.sub(subpath) | 2347 sub = ctx.sub(subpath) |
2348 try: | 2348 try: |
2349 submatch = matchmod.narrowmatcher(subpath, m) | 2349 submatch = matchmod.narrowmatcher(subpath, m) |
2350 if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0: | 2350 recurse = m.exact(subpath) or subrepos |
2351 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0: | |
2351 ret = 0 | 2352 ret = 0 |
2352 except error.LookupError: | 2353 except error.LookupError: |
2353 ui.status(_("skipping missing subrepository: %s\n") | 2354 ui.status(_("skipping missing subrepository: %s\n") |
2354 % m.abs(subpath)) | 2355 % m.abs(subpath)) |
2355 | 2356 |