equal
deleted
inserted
replaced
18 # bazaar imports |
18 # bazaar imports |
19 from bzrlib import branch, revision, errors |
19 from bzrlib import branch, revision, errors |
20 from bzrlib.revisionspec import RevisionSpec |
20 from bzrlib.revisionspec import RevisionSpec |
21 except ImportError: |
21 except ImportError: |
22 pass |
22 pass |
|
23 |
|
24 supportedkinds = ('file', 'symlink') |
23 |
25 |
24 class bzr_source(converter_source): |
26 class bzr_source(converter_source): |
25 """Reads Bazaar repositories by using the Bazaar Python libraries""" |
27 """Reads Bazaar repositories by using the Bazaar Python libraries""" |
26 |
28 |
27 def __init__(self, ui, path, rev=None): |
29 def __init__(self, ui, path, rev=None): |
69 return [info.rev_id] |
71 return [info.rev_id] |
70 |
72 |
71 def getfile(self, name, rev): |
73 def getfile(self, name, rev): |
72 revtree = self.sourcerepo.revision_tree(rev) |
74 revtree = self.sourcerepo.revision_tree(rev) |
73 fileid = revtree.path2id(name) |
75 fileid = revtree.path2id(name) |
74 if fileid is None: |
76 if fileid is None or revtree.kind(fileid) not in supportedkinds: |
75 # the file is not available anymore - was deleted |
77 # the file is not available anymore - was deleted |
76 raise IOError(_('%s is not available in %s anymore') % |
78 raise IOError(_('%s is not available in %s anymore') % |
77 (name, rev)) |
79 (name, rev)) |
78 sio = revtree.get_file(fileid) |
80 sio = revtree.get_file(fileid) |
79 return sio.read() |
81 return sio.read() |