mercurial/cmdutil.py
changeset 22212 f18aca03ddd9
parent 22211 76fa261b5fe3
child 22213 f1debbcd71cd
equal deleted inserted replaced
22211:76fa261b5fe3 22212:f18aca03ddd9
  2482             )
  2482             )
  2483 
  2483 
  2484         for abs, (rel, exact) in sorted(names.items()):
  2484         for abs, (rel, exact) in sorted(names.items()):
  2485             # target file to be touch on disk (relative to cwd)
  2485             # target file to be touch on disk (relative to cwd)
  2486             target = repo.wjoin(abs)
  2486             target = repo.wjoin(abs)
  2487             def handle(xlist, dobackup):
  2487             # search the entry in the dispatch table.
       
  2488             # if the file is in any of these sets, it was touched in the working
       
  2489             # directory parent and we are sure it needs to be reverted.
       
  2490             for table, (xlist, dobackup) in disptable:
       
  2491                 if abs not in table:
       
  2492                     continue
       
  2493                 if xlist is None:
       
  2494                     if exact:
       
  2495                         ui.warn(_('no changes needed to %s\n') % rel)
       
  2496                     break
  2488                 xlist[0].append(abs)
  2497                 xlist[0].append(abs)
  2489                 if (dobackup and not opts.get('no_backup') and
  2498                 if (dobackup and not opts.get('no_backup') and
  2490                     os.path.lexists(target) and
  2499                     os.path.lexists(target) and
  2491                     abs in ctx and repo[None][abs].cmp(ctx[abs])):
  2500                     abs in ctx and repo[None][abs].cmp(ctx[abs])):
  2492                     bakname = "%s.orig" % rel
  2501                     bakname = "%s.orig" % rel
  2497                 if ui.verbose or not exact:
  2506                 if ui.verbose or not exact:
  2498                     msg = xlist[1]
  2507                     msg = xlist[1]
  2499                     if not isinstance(msg, basestring):
  2508                     if not isinstance(msg, basestring):
  2500                         msg = msg(abs)
  2509                         msg = msg(abs)
  2501                     ui.status(msg % rel)
  2510                     ui.status(msg % rel)
  2502             # search the entry in the dispatch table.
       
  2503             # if the file is in any of this sets, it was touched in the working
       
  2504             # directory parent and we are sure it needs to be reverted.
       
  2505             for table, (action, backup) in disptable:
       
  2506                 if abs not in table:
       
  2507                     continue
       
  2508                 if action is None:
       
  2509                     if exact:
       
  2510                         ui.warn(_('no changes needed to %s\n') % rel)
       
  2511 
       
  2512                 else:
       
  2513                     handle(action, backup)
       
  2514                 break
  2511                 break
  2515             else:
  2512             else:
  2516                 # Not touched in current dirstate.
  2513                 # Not touched in current dirstate.
  2517 
  2514 
  2518                 # file is unknown in parent, restore older version or ignore.
  2515                 # file is unknown in parent, restore older version or ignore.