--- 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)