mercurial/cmdutil.py
changeset 5610 2493a478f395
parent 5609 a783d3627144
child 5716 be367cbafe70
--- a/mercurial/cmdutil.py	Fri Dec 07 02:03:42 2007 -0600
+++ b/mercurial/cmdutil.py	Fri Dec 07 02:29:55 2007 -0600
@@ -286,13 +286,12 @@
             if not dry_run:
                 repo.copy(old, new)
 
-def copy(ui, repo, pats, opts):
+def copy(ui, repo, pats, opts, rename=False):
     # called with the repo lock held
     #
     # hgsep => pathname that uses "/" to separate directories
     # ossep => pathname that uses os.sep to separate directories
     cwd = repo.getcwd()
-    copied = []
     targets = {}
     after = opts.get("after")
     dryrun = opts.get("dry_run")
@@ -359,7 +358,8 @@
                     return True # report a failure
 
         if ui.verbose or not exact:
-            ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
+            action = rename and "moving" or "copying"
+            ui.status(_('%s %s to %s\n') % (action, relsrc, reltarget))
 
         targets[abstarget] = abssrc
 
@@ -378,7 +378,9 @@
                     repo.add([abstarget])
             elif not dryrun:
                 repo.copy(origsrc, abstarget)
-        copied.append((abssrc, relsrc, exact))
+
+        if rename and not dryrun:
+            repo.remove([abssrc], True)
 
     # pat: ossep
     # dest ossep
@@ -482,7 +484,7 @@
     if errors:
         ui.warn(_('(consider using --after)\n'))
 
-    return errors, copied
+    return errors
 
 def service(opts, parentfn=None, initfn=None, runfn=None):
     '''Run a command as a service.'''