Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 15410:9e99d2bbb1b1
add: support adding explicit files in subrepos
Change the behavior of the add command such that explicit paths in
subrepos are always added. This eliminates the previous behavior
where if you called "hg add" for an explicit path in a subrepo
without specifying the -S option, it would be silently ignored.
If you specify patterns, or no arguments at all, the -S option
will still be needed to activate recursion into subrepos.
author | David M. Carr <david@carrclan.us> |
---|---|
date | Wed, 02 Nov 2011 01:17:11 -0400 |
parents | cd6f10dccf16 |
children | 36d7a0c7505f |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Nov 01 23:53:29 2011 -0400 +++ b/mercurial/cmdutil.py Wed Nov 02 01:17:11 2011 -0400 @@ -1165,15 +1165,19 @@ if ui.verbose or not exact: ui.status(_('adding %s\n') % match.rel(join(f))) - if listsubrepos: - for subpath in wctx.substate: - sub = wctx.sub(subpath) - try: - submatch = matchmod.narrowmatcher(subpath, match) + for subpath in wctx.substate: + sub = wctx.sub(subpath) + try: + submatch = matchmod.narrowmatcher(subpath, match) + if listsubrepos: bad.extend(sub.add(ui, submatch, dryrun, prefix)) - except error.LookupError: - ui.status(_("skipping missing subrepository: %s\n") - % join(subpath)) + else: + for f in sub.walk(submatch): + if submatch.exact(f): + bad.extend(sub.add(ui, submatch, dryrun, prefix)) + except error.LookupError: + ui.status(_("skipping missing subrepository: %s\n") + % join(subpath)) if not dryrun: rejected = wctx.add(names, prefix)