/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 converter.py

require bzr 1.13.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                pb.update("updating git map", i, len(all_revids))
56
56
                self._update_sha_map_revision(revid)
57
57
        finally:
 
58
            self._idmap.commit()
58
59
            pb.finished()
59
60
 
60
61
    def _update_sha_map_revision(self, revid):
66
67
            ie = inv[inv.path2id(path)]
67
68
            if ie.kind in ("file", "symlink"):
68
69
                self._idmap.add_entry(sha, "blob", (ie.file_id, ie.revision))
 
70
            elif ie.kind == "directory":
 
71
                self._idmap.add_entry(sha, "tree", (path, ie.revision))
69
72
            else:
70
 
                self._idmap.add_entry(sha, "tree", (ie.file_id, ie.revision))
 
73
                raise AssertionError()
71
74
        rev = self.repository.get_revision(revid)
72
75
        commit_obj = revision_to_commit(rev, tree_sha, self._idmap._parent_lookup)
73
76
        self._idmap.add_entry(commit_obj.sha().hexdigest(), "commit", (revid, tree_sha))
74
77
 
75
78
    def _get_blob(self, fileid, revision):
 
79
        """Return a Git Blob object from a fileid and revision stored in bzr.
 
80
        
 
81
        :param fileid: File id of the text
 
82
        :param revision: Revision of the text
 
83
        """
76
84
        text = self.repository.texts.get_record_stream([(fileid, revision)], "unordered", True).next().get_bytes_as("fulltext")
77
85
        blob = Blob()
78
86
        blob._text = text
79
87
        return blob
80
88
 
81
 
    def _get_tree(self, fileid, revid):
 
89
    def _get_tree(self, path, revid):
82
90
        raise NotImplementedError(self._get_tree)
83
91
 
84
92
    def _get_commit(self, revid, tree_sha):