# HG changeset patch # User Patrick Mezard # Date 2010-09-20 19:46:39 # Node ID 28642f7fc2cfa40aad78ec6447d780e5b1283060 # Parent 70236d6fd84480422d01316b3ba44dac64bdf11b convert/svn: fix broken symlink renames in svn sink diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -1037,7 +1037,7 @@ class svn_sink(converter_sink, commandli # 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)) diff --git a/tests/test-convert-svn-sink b/tests/test-convert-svn-sink --- a/tests/test-convert-svn-sink +++ b/tests/test-convert-svn-sink @@ -29,6 +29,7 @@ hg init a 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 @@ ls a a-hg-wc 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 diff --git a/tests/test-convert-svn-sink.out b/tests/test-convert-svn-sink.out --- a/tests/test-convert-svn-sink.out +++ b/tests/test-convert-svn-sink.out @@ -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 @@ At revision 2. 2 1 test d1 2 1 test d1/d2 2 1 test d1/d2/b + 2 1 test link /d1/d2 /d1/d2/b +/link add a file @@ -49,13 +53,15 @@ At revision 2. 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 @@ At revision 3. 3 1 test d1 3 1 test d1/d2 3 1 test d1/d2/b + 3 3 test newlink /b +/newlink +/link rename a file @@ -88,12 +101,14 @@ At revision 3. 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 @@ At revision 4. 4 1 test d1 4 1 test d1/d2 4 1 test d1/d2/b + 4 3 test newlink