/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to fetch.py

Fix formatting, remove catch-all for exceptions when opening local repositories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
        # path; this may involve adding them more than once.
131
131
        inv = Inventory()
132
132
        def lookup_object(sha):
133
 
            # TODO: need to lookup bzr objects as sha..
134
 
            return objects[sha]
 
133
            if sha in objects:
 
134
                return objects[sha]
 
135
            return reconstruct_git_object(repo, mapping, sha)
135
136
        import_git_tree(repo, mapping, "", tree, inv, lookup_object)
136
137
        repo.add_revision(rev.revision_id, rev, inv)
137
138
 
138
139
 
 
140
def reconstruct_git_commit(repo, rev):
 
141
    raise NotImplementedError(self.reconstruct_git_commit)
 
142
 
 
143
 
 
144
def reconstruct_git_object(repo, mapping, sha):
 
145
    # Commit
 
146
    revid = mapping.revision_id_foreign_to_bzr(sha)
 
147
    try:
 
148
        rev = repo.get_revision(revid)
 
149
    except NoSuchRevision:
 
150
        pass
 
151
    else:
 
152
        return reconstruct_git_commit(rev)
 
153
 
 
154
    # TODO: Tree
 
155
    # TODO: Blob
 
156
    raise KeyError("No such object %s" % sha)
 
157
 
 
158
 
139
159
class InterGitRepository(InterRepository):
140
160
 
141
161
    _matching_repo_format = GitFormat()