Bug 2368 - import misses changes on renamed symlinks
Summary: import misses changes on renamed symlinks
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-08 08:33 UTC by Wagner Bruna
Modified: 2012-05-13 04:57 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wagner Bruna 2010-09-08 08:33 UTC
Reported on http://bugs.debian.org/595679 as an mq issue. A simpler test,
with plain import:

hg init test
cd test
ln -s foo foo
hg add foo
hg ci -m 0

ls -l foo
# shows foo -> foo

hg mv foo bar
ln -sf bar bar

ls -l bar
# shows bar -> bar

hg diff --git > change
hg update --clean .
hg import change -m 1

ls -l bar
# shows bar -> foo
Comment 1 Patrick Mézard 2010-09-19 13:45 UTC
Fix on a train. I will push it tomorrow (after running stable tests). I am
sure there are many other exists/lexists bugs in patch.py.


diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -923,7 +923,7 @@
     if afile == bfile:
         goodb = gooda
     else:
-        goodb = not nullb and os.path.exists(bfile)
+        goodb = not nullb and os.path.lexists(bfile)
     createfunc = hunk.createfile
     missing = not goodb and not gooda and not createfunc()
 
diff --git a/tests/test-mq-symlinks b/tests/test-mq-symlinks
--- a/tests/test-mq-symlinks
+++ b/tests/test-mq-symlinks
@@ -55,3 +55,14 @@
 hg qpop
 hg qpush
 hg st -c
+
+echo '% replace broken symlink with another broken symlink'
+ln -s linka linka
+hg add linka
+hg qnew link
+hg mv linka linkb
+ln -sf linkb linkb
+hg qnew --git movelink
+hg qpop
+hg qpush
+$TESTDIR/readlink.py linkb
diff --git a/tests/test-mq-symlinks.out b/tests/test-mq-symlinks.out
--- a/tests/test-mq-symlinks.out
+++ b/tests/test-mq-symlinks.out
@@ -29,3 +29,9 @@
 C b
 C c
 C s
+% replace broken symlink with another broken symlink
+popping movelink
+now at: link
+applying movelink
+now at: movelink
+linkb -> linkb
Comment 2 HG Bot 2010-09-20 15:00 UTC
Fixed by http://hg.intevation.org/mercurial/crew/rev/b0bb72460c44
Patrick Mezard <pmezard@gmail.com>
patch: fix target when patching broken symlinks (issue2368)
Comment 3 Patrick Mézard 2010-09-21 11:57 UTC
In main, resolving
Comment 4 Bugzilla 2012-05-12 09:12 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:12 EDT  ---

This bug was previously known as _bug_ 2368 at http://mercurial.selenic.com/bts/issue2368