changeset 7783:2c5b2abfb8be

patch: teach selectfile about symlinks (issue1438)
author Matt Mackall <mpm@selenic.com>
date Mon, 16 Feb 2009 17:37:23 -0600
parents 140429276b63
children 8a217626bb0c
files mercurial/patch.py tests/test-issue1438 tests/test-issue1438.out
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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