mercurial/commands.py
changeset 5610 2493a478f395
parent 5589 9981b6b19ecf
child 5636 7e6ddde68a23
equal deleted inserted replaced
5609:a783d3627144 5610:2493a478f395
   452     This command takes effect in the next commit. To undo a copy
   452     This command takes effect in the next commit. To undo a copy
   453     before that, see hg revert.
   453     before that, see hg revert.
   454     """
   454     """
   455     wlock = repo.wlock(False)
   455     wlock = repo.wlock(False)
   456     try:
   456     try:
   457         errs, copied = cmdutil.copy(ui, repo, pats, opts)
   457         return cmdutil.copy(ui, repo, pats, opts)
   458     finally:
   458     finally:
   459         del wlock
   459         del wlock
   460     return errs
       
   461 
   460 
   462 def debugancestor(ui, index, rev1, rev2):
   461 def debugancestor(ui, index, rev1, rev2):
   463     """find the ancestor revision of two revisions in a given index"""
   462     """find the ancestor revision of two revisions in a given index"""
   464     r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
   463     r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
   465     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
   464     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
  2060     This command takes effect in the next commit. To undo a rename
  2059     This command takes effect in the next commit. To undo a rename
  2061     before that, see hg revert.
  2060     before that, see hg revert.
  2062     """
  2061     """
  2063     wlock = repo.wlock(False)
  2062     wlock = repo.wlock(False)
  2064     try:
  2063     try:
  2065         errs, copied = cmdutil.copy(ui, repo, pats, opts)
  2064         return cmdutil.copy(ui, repo, pats, opts, rename=True)
  2066         names = []
       
  2067         for abs, rel, exact in copied:
       
  2068             if ui.verbose or not exact:
       
  2069                 ui.status(_('removing %s\n') % rel)
       
  2070             names.append(abs)
       
  2071         if not opts.get('dry_run'):
       
  2072             repo.remove(names, True)
       
  2073         return errs
       
  2074     finally:
  2065     finally:
  2075         del wlock
  2066         del wlock
  2076 
  2067 
  2077 def revert(ui, repo, *pats, **opts):
  2068 def revert(ui, repo, *pats, **opts):
  2078     """restore individual files or dirs to an earlier state
  2069     """restore individual files or dirs to an earlier state