mercurial/cmdutil.py
changeset 28017 d3f1b7ee5e70
parent 27985 79139c7a88bd
child 28027 14033c5dd261
equal deleted inserted replaced
28016:a2be6f0f58fb 28017:d3f1b7ee5e70
  1140             except KeyError:
  1140             except KeyError:
  1141                 # A subrepo that existed in node1 was deleted between node1 and
  1141                 # A subrepo that existed in node1 was deleted between node1 and
  1142                 # node2 (inclusive). Thus, ctx2's substate won't contain that
  1142                 # node2 (inclusive). Thus, ctx2's substate won't contain that
  1143                 # subpath. The best we can do is to ignore it.
  1143                 # subpath. The best we can do is to ignore it.
  1144                 tempnode2 = None
  1144                 tempnode2 = None
  1145             submatch = matchmod.narrowmatcher(subpath, match)
  1145             submatch = matchmod.subdirmatcher(subpath, match)
  1146             sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
  1146             sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
  1147                      stat=stat, fp=fp, prefix=prefix)
  1147                      stat=stat, fp=fp, prefix=prefix)
  1148 
  1148 
  1149 class changeset_printer(object):
  1149 class changeset_printer(object):
  1150     '''show changeset information when templating not requested.'''
  1150     '''show changeset information when templating not requested.'''
  2252                 ui.status(_('adding %s\n') % match.rel(f))
  2252                 ui.status(_('adding %s\n') % match.rel(f))
  2253 
  2253 
  2254     for subpath in sorted(wctx.substate):
  2254     for subpath in sorted(wctx.substate):
  2255         sub = wctx.sub(subpath)
  2255         sub = wctx.sub(subpath)
  2256         try:
  2256         try:
  2257             submatch = matchmod.narrowmatcher(subpath, match)
  2257             submatch = matchmod.subdirmatcher(subpath, match)
  2258             if opts.get('subrepos'):
  2258             if opts.get('subrepos'):
  2259                 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
  2259                 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
  2260             else:
  2260             else:
  2261                 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
  2261                 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
  2262         except error.LookupError:
  2262         except error.LookupError:
  2281         forget = [f for f in forget if match.exact(f)]
  2281         forget = [f for f in forget if match.exact(f)]
  2282 
  2282 
  2283     for subpath in sorted(wctx.substate):
  2283     for subpath in sorted(wctx.substate):
  2284         sub = wctx.sub(subpath)
  2284         sub = wctx.sub(subpath)
  2285         try:
  2285         try:
  2286             submatch = matchmod.narrowmatcher(subpath, match)
  2286             submatch = matchmod.subdirmatcher(subpath, match)
  2287             subbad, subforgot = sub.forget(submatch, prefix)
  2287             subbad, subforgot = sub.forget(submatch, prefix)
  2288             bad.extend([subpath + '/' + f for f in subbad])
  2288             bad.extend([subpath + '/' + f for f in subbad])
  2289             forgot.extend([subpath + '/' + f for f in subforgot])
  2289             forgot.extend([subpath + '/' + f for f in subforgot])
  2290         except error.LookupError:
  2290         except error.LookupError:
  2291             ui.status(_("skipping missing subrepository: %s\n")
  2291             ui.status(_("skipping missing subrepository: %s\n")
  2338                     or any(f.startswith(subpath + '/') for f in m.files()))
  2338                     or any(f.startswith(subpath + '/') for f in m.files()))
  2339 
  2339 
  2340         if subrepos or matchessubrepo(subpath):
  2340         if subrepos or matchessubrepo(subpath):
  2341             sub = ctx.sub(subpath)
  2341             sub = ctx.sub(subpath)
  2342             try:
  2342             try:
  2343                 submatch = matchmod.narrowmatcher(subpath, m)
  2343                 submatch = matchmod.subdirmatcher(subpath, m)
  2344                 if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0:
  2344                 if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0:
  2345                     ret = 0
  2345                     ret = 0
  2346             except error.LookupError:
  2346             except error.LookupError:
  2347                 ui.status(_("skipping missing subrepository: %s\n")
  2347                 ui.status(_("skipping missing subrepository: %s\n")
  2348                                % m.abs(subpath))
  2348                                % m.abs(subpath))
  2367             return False
  2367             return False
  2368 
  2368 
  2369         if subrepos or matchessubrepo(m, subpath):
  2369         if subrepos or matchessubrepo(m, subpath):
  2370             sub = wctx.sub(subpath)
  2370             sub = wctx.sub(subpath)
  2371             try:
  2371             try:
  2372                 submatch = matchmod.narrowmatcher(subpath, m)
  2372                 submatch = matchmod.subdirmatcher(subpath, m)
  2373                 if sub.removefiles(submatch, prefix, after, force, subrepos):
  2373                 if sub.removefiles(submatch, prefix, after, force, subrepos):
  2374                     ret = 1
  2374                     ret = 1
  2375             except error.LookupError:
  2375             except error.LookupError:
  2376                 ui.status(_("skipping missing subrepository: %s\n")
  2376                 ui.status(_("skipping missing subrepository: %s\n")
  2377                                % join(subpath))
  2377                                % join(subpath))
  2465         err = 0
  2465         err = 0
  2466 
  2466 
  2467     for subpath in sorted(ctx.substate):
  2467     for subpath in sorted(ctx.substate):
  2468         sub = ctx.sub(subpath)
  2468         sub = ctx.sub(subpath)
  2469         try:
  2469         try:
  2470             submatch = matchmod.narrowmatcher(subpath, matcher)
  2470             submatch = matchmod.subdirmatcher(subpath, matcher)
  2471 
  2471 
  2472             if not sub.cat(submatch, os.path.join(prefix, sub._path),
  2472             if not sub.cat(submatch, os.path.join(prefix, sub._path),
  2473                            **opts):
  2473                            **opts):
  2474                 err = 0
  2474                 err = 0
  2475         except error.RepoLookupError:
  2475         except error.RepoLookupError: