Commits

Patrick Mézard committed 28642f7

convert/svn: fix broken symlink renames in svn sink

  • Participants
  • Parent commits 70236d6
  • Branches stable

Comments (0)

Files changed (3)

File hgext/convert/subversion.py

         # 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))

File tests/test-convert-svn-sink

 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'
 
 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

File tests/test-convert-svn-sink.out

 % 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'
  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
    action="A">/d1/d2</path>
 <path
    action="A">/d1/d2/b</path>
+<path
+   action="A">/link</path>
 </paths>
 <msg>add a file</msg>
 </logentry>
 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...
  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
    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>
 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...
  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
 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...
  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
 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...
  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