changeset 12343:28642f7fc2cf stable

convert/svn: fix broken symlink renames in svn sink
author Patrick Mezard <pmezard@gmail.com>
date Mon, 20 Sep 2010 21:46:39 +0200
parents 70236d6fd844
children b6173aee4a47
files hgext/convert/subversion.py tests/test-convert-svn-sink tests/test-convert-svn-sink.out
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/hgext/convert/subversion.py	Mon Sep 20 21:46:39 2010 +0200
@@ -1037,7 +1037,7 @@
         # our copyfile method expects to record a copy that has
         # already occurred.  Cross the semantic gap.
         wdest = self.wjoin(dest)
-        exists = os.path.exists(wdest)
+        exists = os.path.lexists(wdest)
         if exists:
             fd, tempname = tempfile.mkstemp(
                 prefix='hg-copy-', dir=os.path.dirname(wdest))
--- a/tests/test-convert-svn-sink	Mon Sep 20 21:46:39 2010 +0200
+++ b/tests/test-convert-svn-sink	Mon Sep 20 21:46:39 2010 +0200
@@ -29,6 +29,7 @@
 echo a > a/a
 mkdir -p a/d1/d2
 echo b > a/d1/d2/b
+ln -s a/missing a/link
 echo % add
 hg --cwd a ci -d '0 0' -A -m 'add a file'
 
@@ -43,6 +44,7 @@
 cmp a/a a-hg-wc/a && echo same || echo different
 
 hg --cwd a mv a b
+hg --cwd a mv link newlink
 echo % rename
 hg --cwd a ci -d '2 0' -m 'rename a file'
 hg --cwd a tip -q
--- a/tests/test-convert-svn-sink.out	Mon Sep 20 21:46:39 2010 +0200
+++ b/tests/test-convert-svn-sink.out	Mon Sep 20 21:46:39 2010 +0200
@@ -1,8 +1,9 @@
 % add
 adding a
 adding d1/d2/b
+adding link
 % modify
-1:e0e2b8a9156b
+1:8231f652da37
 assuming destination a-hg
 initializing svn repository 'a-hg'
 initializing svn working copy 'a-hg-wc'
@@ -17,6 +18,7 @@
  2 1 test d1
  2 1 test d1/d2
  2 1 test d1/d2/b
+ 2 1 test link
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -42,6 +44,8 @@
    action="A">/d1/d2</path>
 <path
    action="A">/d1/d2/b</path>
+<path
+   action="A">/link</path>
 </paths>
 <msg>add a file</msg>
 </logentry>
@@ -49,13 +53,15 @@
 a:
 a
 d1
+link
 
 a-hg-wc:
 a
 d1
+link
 same
 % rename
-2:eb5169441d43
+2:a67e26ccec09
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -68,6 +74,7 @@
  3 1 test d1
  3 1 test d1/d2
  3 1 test d1/d2/b
+ 3 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -81,6 +88,12 @@
    copyfrom-path="/a"
    copyfrom-rev="2"
    action="A">/b</path>
+<path
+   copyfrom-path="/link"
+   copyfrom-rev="2"
+   action="A">/newlink</path>
+<path
+   action="D">/link</path>
 </paths>
 <msg>rename a file</msg>
 </logentry>
@@ -88,12 +101,14 @@
 a:
 b
 d1
+newlink
 
 a-hg-wc:
 b
 d1
+newlink
 % copy
-3:60effef6ab48
+3:0cf087b9ab02
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -107,6 +122,7 @@
  4 1 test d1
  4 1 test d1/d2
  4 1 test d1/d2/b
+ 4 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -126,13 +142,15 @@
 b
 c
 d1
+newlink
 
 a-hg-wc:
 b
 c
 d1
+newlink
 % remove
-4:87bbe3013fb6
+4:07b2e34a5b17
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -145,6 +163,7 @@
  5 1 test d1
  5 1 test d1/d2
  5 1 test d1/d2/b
+ 5 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -161,12 +180,14 @@
 a:
 c
 d1
+newlink
 
 a-hg-wc:
 c
 d1
+newlink
 % executable
-5:ff42e473c340
+5:31093672760b
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -179,6 +200,7 @@
  6 1 test d1
  6 1 test d1/d2
  6 1 test d1/d2/b
+ 6 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry