patch: teach selectfile about symlinks (
issue1438)
--- a/mercurial/patch.py Mon Feb 16 17:37:23 2009 -0600
+++ b/mercurial/patch.py Mon Feb 16 17:37:23 2009 -0600
@@ -751,7 +751,7 @@
nulla = afile_orig == "/dev/null"
nullb = bfile_orig == "/dev/null"
abase, afile = pathstrip(afile_orig, strip)
- gooda = not nulla and os.path.exists(afile)
+ gooda = not nulla and util.lexists(afile)
bbase, bfile = pathstrip(bfile_orig, strip)
if afile == bfile:
goodb = gooda
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-issue1438 Mon Feb 16 17:37:23 2009 -0600
@@ -0,0 +1,16 @@
+#!/bin/sh
+"$TESTDIR/hghave" symlink || exit 80
+
+rm -rf a
+hg init a
+cd a
+
+ln -s foo link
+hg add link
+hg ci -mbad link
+hg rm link
+hg ci -mok
+hg diff -g -r 0:1 > bad.patch
+hg up 0
+hg import --no-commit bad.patch
+hg st
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-issue1438.out Mon Feb 16 17:37:23 2009 -0600
@@ -0,0 +1,4 @@
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying bad.patch
+R link
+? bad.patch