mercurial/cmdutil.py
changeset 22211 76fa261b5fe3
parent 22210 537f55a27101
child 22212 f18aca03ddd9
equal deleted inserted replaced
22210:537f55a27101 22211:76fa261b5fe3
  2480             (dsremoved,        (actions['undelete'], True)),
  2480             (dsremoved,        (actions['undelete'], True)),
  2481             (clean,            (None,                False)),
  2481             (clean,            (None,                False)),
  2482             )
  2482             )
  2483 
  2483 
  2484         for abs, (rel, exact) in sorted(names.items()):
  2484         for abs, (rel, exact) in sorted(names.items()):
  2485             # hash on file in target manifest (or None if missing from target)
       
  2486             mfentry = mf.get(abs)
       
  2487             # target file to be touch on disk (relative to cwd)
  2485             # target file to be touch on disk (relative to cwd)
  2488             target = repo.wjoin(abs)
  2486             target = repo.wjoin(abs)
  2489             def handle(xlist, dobackup):
  2487             def handle(xlist, dobackup):
  2490                 xlist[0].append(abs)
  2488                 xlist[0].append(abs)
  2491                 if (dobackup and not opts.get('no_backup') and
  2489                 if (dobackup and not opts.get('no_backup') and
  2526                 # parent is target, no changes mean no changes
  2524                 # parent is target, no changes mean no changes
  2527                 if node == parent:
  2525                 if node == parent:
  2528                     if exact:
  2526                     if exact:
  2529                         ui.warn(_('no changes needed to %s\n') % rel)
  2527                         ui.warn(_('no changes needed to %s\n') % rel)
  2530                     continue
  2528                     continue
  2531                 # no change in dirstate but parent and target may differ
       
  2532                 if pmf is None:
       
  2533                     # only need parent manifest in this unlikely case,
       
  2534                     # so do not read by default
       
  2535                     pmf = repo[parent].manifest()
       
  2536                 if abs in pmf and mfentry:
       
  2537                     # if version of file is same in parent and target
       
  2538                     # manifests, do nothing
       
  2539                     if (pmf[abs] != mfentry or
       
  2540                         pmf.flags(abs) != mf.flags(abs)):
       
  2541                         handle(actions['revert'], False)
       
  2542                 else:
       
  2543                     handle(actions['remove'], False)
       
  2544 
  2529 
  2545         if not opts.get('dry_run'):
  2530         if not opts.get('dry_run'):
  2546             _performrevert(repo, parents, ctx, actions)
  2531             _performrevert(repo, parents, ctx, actions)
  2547 
  2532 
  2548             if targetsubs:
  2533             if targetsubs: