patch: do not overwrite broken untracked symlinks stable
authorPatrick Mezard <pmezard@gmail.com>
Mon, 20 Sep 2010 21:42:11 +0200
branchstable
changeset 12341 aca8b10bca6e
parent 12340 b0bb72460c44
child 12342 70236d6fd844
patch: do not overwrite broken untracked symlinks
mercurial/patch.py
tests/test-mq-symlinks
tests/test-mq-symlinks.out
--- a/mercurial/patch.py	Mon Sep 20 21:42:11 2010 +0200
+++ b/mercurial/patch.py	Mon Sep 20 21:42:11 2010 +0200
@@ -25,7 +25,7 @@
 
 def copyfile(src, dst, basedir):
     abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]]
-    if os.path.exists(absdst):
+    if os.path.lexists(absdst):
         raise util.Abort(_("cannot create %s: destination already exists") %
                          dst)
 
--- a/tests/test-mq-symlinks	Mon Sep 20 21:42:11 2010 +0200
+++ b/tests/test-mq-symlinks	Mon Sep 20 21:42:11 2010 +0200
@@ -66,3 +66,9 @@
 hg qpop
 hg qpush
 $TESTDIR/readlink.py linkb
+echo '% check patch does not overwrite untracked symlinks'
+hg qpop
+ln -s linkbb linkb
+hg qpush
+
+true
\ No newline at end of file
--- a/tests/test-mq-symlinks.out	Mon Sep 20 21:42:11 2010 +0200
+++ b/tests/test-mq-symlinks.out	Mon Sep 20 21:42:11 2010 +0200
@@ -35,3 +35,10 @@
 applying movelink
 now at: movelink
 linkb -> linkb
+% check patch does not overwrite untracked symlinks
+popping movelink
+now at: link
+applying movelink
+patch failed, unable to continue (try -v)
+patch failed, rejects left in working dir
+errors during apply, please fix and refresh movelink