diff --git a/mercurial/patch.py b/mercurial/patch.py
index b0bb72460c4420b4d66d4ae7b8efdf0809fd27c9_bWVyY3VyaWFsL3BhdGNoLnB5..aca8b10bca6e39344a26271e3d3958feab9d5db5_bWVyY3VyaWFsL3BhdGNoLnB5 100644
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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)
 
diff --git a/tests/test-mq-symlinks b/tests/test-mq-symlinks
index b0bb72460c4420b4d66d4ae7b8efdf0809fd27c9_dGVzdHMvdGVzdC1tcS1zeW1saW5rcw==..aca8b10bca6e39344a26271e3d3958feab9d5db5_dGVzdHMvdGVzdC1tcS1zeW1saW5rcw== 100755
--- a/tests/test-mq-symlinks
+++ b/tests/test-mq-symlinks
@@ -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
diff --git a/tests/test-mq-symlinks.out b/tests/test-mq-symlinks.out
index b0bb72460c4420b4d66d4ae7b8efdf0809fd27c9_dGVzdHMvdGVzdC1tcS1zeW1saW5rcy5vdXQ=..aca8b10bca6e39344a26271e3d3958feab9d5db5_dGVzdHMvdGVzdC1tcS1zeW1saW5rcy5vdXQ= 100644
--- a/tests/test-mq-symlinks.out
+++ b/tests/test-mq-symlinks.out
@@ -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