copy: fix copying back with -A (issue836)
authorMatt Mackall <mpm@selenic.com>
Sun, 02 Dec 2007 18:41:22 -0600
changeset 5604 4b7b21acede0
parent 5589 9981b6b19ecf
child 5605 e7a9ad999308
copy: fix copying back with -A (issue836)
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sun Dec 02 18:11:59 2007 -0600
+++ b/mercurial/cmdutil.py	Sun Dec 02 18:41:22 2007 -0600
@@ -366,7 +366,11 @@
         if ui.verbose or not exact:
             ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
         targets[abstarget] = abssrc
-        if abstarget != origsrc:
+        if abstarget == origsrc: # copying back a copy?
+            if repo.dirstate[abstarget] not in 'mn':
+                if not opts.get('dry_run'):
+                    repo.add([abstarget])
+        else:
             if repo.dirstate[origsrc] == 'a':
                 if not ui.quiet:
                     ui.warn(_("%s has not been committed yet, so no copy "