hgext/convert/bzr.py
changeset 8423 eb7be0e752d9
parent 8165 78658990c725
child 8434 4a3e7c380834
child 8783 6556d4145122
equal deleted inserted replaced
8418:592c454477c6 8423:eb7be0e752d9
    71         return [info.rev_id]
    71         return [info.rev_id]
    72 
    72 
    73     def getfile(self, name, rev):
    73     def getfile(self, name, rev):
    74         revtree = self.sourcerepo.revision_tree(rev)
    74         revtree = self.sourcerepo.revision_tree(rev)
    75         fileid = revtree.path2id(name)
    75         fileid = revtree.path2id(name)
    76         if fileid is None or revtree.kind(fileid) not in supportedkinds:
    76         kind = None
       
    77         if fileid is not None:
       
    78             kind = revtree.kind(fileid)
       
    79         if kind not in supportedkinds:
    77             # the file is not available anymore - was deleted
    80             # the file is not available anymore - was deleted
    78             raise IOError(_('%s is not available in %s anymore') %
    81             raise IOError(_('%s is not available in %s anymore') %
    79                     (name, rev))
    82                     (name, rev))
    80         sio = revtree.get_file(fileid)
    83         if kind == 'symlink':
    81         return sio.read()
    84             target = revtree.get_symlink_target(fileid)
       
    85             if target is None:
       
    86                 raise util.Abort(_('%s.%s symlink has no target')
       
    87                                  % (name, rev))
       
    88             return target
       
    89         else:
       
    90             sio = revtree.get_file(fileid)
       
    91             return sio.read()
    82 
    92 
    83     def getmode(self, name, rev):
    93     def getmode(self, name, rev):
    84         return self._modecache[(name, rev)]
    94         return self._modecache[(name, rev)]
    85 
    95 
    86     def getchanges(self, version):
    96     def getchanges(self, version):