Mercurial > hg
comparison hgext/convert/bzr.py @ 8423:eb7be0e752d9
convert/bzr: fix symlinks target (issue1626/2)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 15 May 2009 16:12:09 +0200 |
parents | 78658990c725 |
children | 4a3e7c380834 6556d4145122 |
comparison
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): |