hgext/convert/bzr.py
changeset 8423 eb7be0e752d9
parent 8165 78658990c725
child 8434 4a3e7c380834
child 8783 6556d4145122
--- a/hgext/convert/bzr.py	Thu May 14 22:59:12 2009 +0200
+++ b/hgext/convert/bzr.py	Fri May 15 16:12:09 2009 +0200
@@ -73,12 +73,22 @@
     def getfile(self, name, rev):
         revtree = self.sourcerepo.revision_tree(rev)
         fileid = revtree.path2id(name)
-        if fileid is None or revtree.kind(fileid) not in supportedkinds:
+        kind = None
+        if fileid is not None:
+            kind = revtree.kind(fileid)
+        if kind not in supportedkinds:
             # the file is not available anymore - was deleted
             raise IOError(_('%s is not available in %s anymore') %
                     (name, rev))
-        sio = revtree.get_file(fileid)
-        return sio.read()
+        if kind == 'symlink':
+            target = revtree.get_symlink_target(fileid)
+            if target is None:
+                raise util.Abort(_('%s.%s symlink has no target')
+                                 % (name, rev))
+            return target
+        else:
+            sio = revtree.get_file(fileid)
+            return sio.read()
 
     def getmode(self, name, rev):
         return self._modecache[(name, rev)]