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

Eliminate (duplicate) git_ prefix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    )
35
35
from bzrlib.transport import get_transport
36
36
 
37
 
from bzrlib.plugins.git.foreign import (
 
37
from bzrlib.plugins.git import (
 
38
    ids,
38
39
    versionedfiles
39
40
    )
40
 
from bzrlib.plugins.git.mapping import default_mapping
41
41
 
42
42
 
43
43
class GitRepository(repository.Repository):
66
66
        while cms != []:
67
67
            cms = self._git.commits("--all", max_count=max_count, skip=skip)
68
68
            skip += max_count
69
 
            ret.update([default_mapping.revision_id_foreign_to_bzr(cm.id) for cm in cms])
 
69
            ret.update([ids.convert_revision_id_git_to_bzr(cm.id) for cm in cms])
70
70
        return ret
71
71
 
72
72
    def is_shared(self):
88
88
            max_count = 1000
89
89
            cms = None
90
90
            while cms != []:
91
 
                cms = self._git.commits(self.lookup_git_revid(revision_id, default_mapping), max_count=max_count, skip=skip)
 
91
                cms = self._git.commits(ids.convert_revision_id_bzr_to_git(revision_id), max_count=max_count, skip=skip)
92
92
                skip += max_count
93
 
                ret += [default_mapping.revision_id_foreign_to_bzr(cm.id) for cm in cms]
 
93
                ret += [ids.convert_revision_id_git_to_bzr(cm.id) for cm in cms]
94
94
        return [None] + ret
95
95
 
96
96
    def get_signature_text(self, revision_id):
105
105
            if revid == revision.NULL_REVISION:
106
106
                ret[revid] = ()
107
107
            else:
108
 
                commit = self._git.commit(self.lookup_git_revid(revid, default_mapping))
109
 
                ret[revid] = tuple([default_mapping.revision_id_foreign_to_bzr(p.id) for p in commit.parents])
 
108
                commit = self._git.commit(ids.convert_revision_id_bzr_to_git(revid))
 
109
                ret[revid] = tuple([ids.convert_revision_id_git_to_bzr(p.id) for p in commit.parents])
110
110
        return ret
111
111
 
112
 
    def lookup_git_revid(self, bzr_revid, mapping):
113
 
        try:
114
 
            return mapping.revision_id_bzr_to_foreign(bzr_revid)
115
 
        except errors.InvalidRevisionId:
116
 
            raise errors.NoSuchRevision(bzr_revid, self)
117
 
 
118
112
    def get_revision(self, revision_id):
119
 
        git_commit_id = self.lookup_git_revid(revision_id, default_mapping)
 
113
        git_commit_id = ids.convert_revision_id_bzr_to_git(revision_id)
120
114
        commit = self._git.commit(git_commit_id)
121
115
        # print "fetched revision:", git_commit_id
122
116
        revision = self._parse_rev(commit)
139
133
 
140
134
        :return: a `bzrlib.revision.Revision` object.
141
135
        """
142
 
        rev = revision.Revision(default_mapping.revision_id_foreign_to_bzr(commit.id))
143
 
        rev.parent_ids = tuple([default_mapping.revision_id_foreign_to_bzr(p.id) for p in commit.parents])
 
136
        rev = revision.Revision(ids.convert_revision_id_git_to_bzr(commit.id))
 
137
        rev.parent_ids = tuple([ids.convert_revision_id_git_to_bzr(p.id) for p in commit.parents])
144
138
        rev.inventory_sha1 = ""
145
139
        rev.message = commit.message.decode("utf-8", "replace")
146
140
        rev.committer = str(commit.committer)
167
161
        assert revision_id != None
168
162
        return self.revision_tree(revision_id).inventory
169
163
 
170
 
    def set_make_working_trees(self, trees):
171
 
        pass
172
 
 
173
164
 
174
165
def escape_file_id(file_id):
175
166
    return file_id.replace('_', '__').replace(' ', '_s')
184
175
    def __init__(self, repository, revision_id):
185
176
        self._repository = repository
186
177
        self.revision_id = revision_id
187
 
        git_id = repository.lookup_git_revid(revision_id, default_mapping)
 
178
        git_id = ids.convert_revision_id_bzr_to_git(revision_id)
188
179
        self.tree = repository._git.commit(git_id).tree
189
180
        self._inventory = inventory.Inventory(revision_id=revision_id)
190
181
        self._inventory.root.revision = revision_id