diff svnwrap/svn_swig_wrapper.py @ 97:0d3a2a7cefa3

hg_delta_editor: fix symlink prefix confusion - SubversionRepo.get_file() strips the symlink prefix - Enforce that hg_delta_editor symlink data always contains the prefix. The alternative was seducing and more consistent with hg content but it makes the code more complicated since svn:special can be set before or after the content is set, and we need it in apply_textdelta() This issue fixes jQuery repository conversion at r3674.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 20 Nov 2008 22:41:15 -0600
parents 7486c6f6cccc
children 04c92c2c4501
line wrap: on
line diff
--- a/svnwrap/svn_swig_wrapper.py
+++ b/svnwrap/svn_swig_wrapper.py
@@ -431,10 +431,10 @@ class SubversionRepo(object):
     def get_file(self, path, revision):
         """Return content and mode of file at given path and revision.
 
-        Content is raw svn content, symlinks content is still prefixed
-        by 'link '. Mode is 'x' if file is executable, 'l' if a symlink,
-        the empty string otherwise. If the file does not exist at this
-        revision, raise IOError.
+        "link " prefix is dropped from symlink content. Mode is 'x' if
+        file is executable, 'l' if a symlink, the empty string
+        otherwise. If the file does not exist at this revision, raise
+        IOError.
         """
         mode = ''
         out = cStringIO.StringIO()
@@ -451,6 +451,10 @@ class SubversionRepo(object):
                 raise IOError()
             raise
         data = out.getvalue()
+        if mode  == 'l':
+            linkprefix = "link "
+            if data.startswith(linkprefix):
+                data = data[len(linkprefix):]
         return data, mode
 
     def proplist(self, path, revision, recurse=False):