/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

Add basic tests for GitRevisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
from dulwich.objects import (
49
49
    Commit,
 
50
    Tag,
50
51
    )
51
52
 
52
53
 
56
57
    _serializer = None
57
58
    _commit_builder_class = GitCommitBuilder
58
59
    vcs = foreign_git
 
60
    chk_bytes = None
59
61
 
60
62
    def __init__(self, gitdir, lockfiles):
61
63
        ForeignRepository.__init__(self, GitRepositoryFormat(), gitdir,
171
173
        if foreign_revid == ZERO_SHA:
172
174
            return revision.NULL_REVISION
173
175
        commit = self._git[foreign_revid]
 
176
        while isinstance(commit, Tag):
 
177
            commit = self._git[commit.object[1]]
174
178
        rev, roundtrip_revid, verifiers = mapping.import_commit(commit,
175
179
            lambda x: None)
176
180
        # FIXME: check testament before doing this?
273
277
    supports_tree_reference = False
274
278
    rich_root_data = True
275
279
 
 
280
    @property
 
281
    def _matchingbzrdir(self):
 
282
        from bzrlib.plugins.git.dir import LocalGitControlDirFormat
 
283
        return LocalGitControlDirFormat()
 
284
 
276
285
    def get_format_description(self):
277
286
        return "Git Repository"
278
287
 
279
 
    def initialize(self, url, shared=False, _internal=False):
280
 
        raise errors.UninitializableFormat(self)
 
288
    def initialize(self, controldir, shared=False, _internal=False):
 
289
        from bzrlib.plugins.git.dir import GitDir
 
290
        if not isinstance(controldir, GitDir):
 
291
            raise errors.UninitializableFormat(self)
 
292
        return controldir.open_repository()
281
293
 
282
294
    def check_conversion_target(self, target_repo_format):
283
295
        return target_repo_format.rich_root_data