changeset 5604:4b7b21acede0

copy: fix copying back with -A (issue836)
author Matt Mackall <mpm@selenic.com>
date Sun, 02 Dec 2007 18:41:22 -0600
parents 9981b6b19ecf
children e7a9ad999308
files mercurial/cmdutil.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 "