changeset 7121:b801d6e5dc83

rename: handle renaming to a target marked removed
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Oct 2008 04:26:09 -0500
parents db7557359636
children 3cf699e89e48 42db22108d85
files mercurial/cmdutil.py mercurial/localrepo.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Oct 17 12:12:33 2008 +0200
+++ b/mercurial/cmdutil.py	Sat Oct 18 04:26:09 2008 -0500
@@ -398,12 +398,12 @@
             if state not in 'mn' and not dryrun:
                 repo.dirstate.normallookup(abstarget)
         else:
-            if repo.dirstate[origsrc] == 'a':
+            if repo.dirstate[origsrc] == 'a' and origsrc == abssrc:
                 if not ui.quiet:
                     ui.warn(_("%s has not been committed yet, so no copy "
                               "data will be stored for %s.\n")
                             % (repo.pathto(origsrc, cwd), reltarget))
-                if abstarget not in repo.dirstate and not dryrun:
+                if repo.dirstate[abstarget] in '?r' and not dryrun:
                     repo.add([abstarget])
             elif not dryrun:
                 repo.copy(origsrc, abstarget)
--- a/mercurial/localrepo.py	Fri Oct 17 12:12:33 2008 +0200
+++ b/mercurial/localrepo.py	Sat Oct 18 04:26:09 2008 -0500
@@ -1149,7 +1149,7 @@
                                "symbolic link\n") % dest)
             else:
                 wlock = self.wlock()
-                if dest not in self.dirstate:
+                if self.dirstate[dest] in '?r':
                     self.dirstate.add(dest)
                 self.dirstate.copy(source, dest)
         finally: