diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -751,7 +751,7 @@ def selectfile(afile_orig, bfile_orig, h 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 diff --git a/tests/test-issue1438 b/tests/test-issue1438 new file mode 100644 --- /dev/null +++ b/tests/test-issue1438 @@ -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 diff --git a/tests/test-issue1438.out b/tests/test-issue1438.out new file mode 100644 --- /dev/null +++ b/tests/test-issue1438.out @@ -0,0 +1,4 @@ +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +applying bad.patch +R link +? bad.patch