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

Fix RevisionTree.get_file_text().

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    branch,
21
21
    config,
22
22
    revision,
 
23
    tag,
23
24
    )
24
25
from bzrlib.decorators import needs_read_lock
25
26
 
26
27
from bzrlib.plugins.git import ids
27
28
 
 
29
class GitTagDict(tag.BasicTags):
 
30
 
 
31
    def __init__(self, repository):
 
32
        self.repository = repository
 
33
 
 
34
    def get_tag_dict(self):
 
35
        ret = {}
 
36
        for tag in self.repository._git.tags:
 
37
            ret[tag.name] = ids.convert_revision_id_git_to_bzr(tag.commit.id)
 
38
        return ret
 
39
 
 
40
    def set_tag(self, name, revid):
 
41
        raise NotImplementedError(self.set_tag)
 
42
 
28
43
 
29
44
class GitBranchConfig(config.BranchConfig):
30
45
    """BranchConfig that uses locations.conf in place of branch.conf"""
44
59
    def get_format_description(self):
45
60
        return 'Git Branch'
46
61
 
 
62
    def supports_tags(self):
 
63
        return True
 
64
 
47
65
 
48
66
class GitBranch(branch.Branch):
49
67
    """An adapter to git repositories for bzr Branch objects."""
50
68
 
51
69
    def __init__(self, bzrdir, repository, head, base, lockfiles):
 
70
        self.repository = repository
52
71
        super(GitBranch, self).__init__()
53
72
        self.control_files = lockfiles
54
73
        self.bzrdir = bzrdir
55
 
        self.repository = repository
56
74
        self.head = head
57
75
        self.base = base
58
76
        self._format = GitBranchFormat()
67
85
            return revision.NULL_REVISION
68
86
        return ids.convert_revision_id_git_to_bzr(self.head)
69
87
 
 
88
    def _make_tags(self):
 
89
        return GitTagDict(self.repository)
 
90
 
70
91
    def get_parent(self):
71
92
        """See Branch.get_parent()."""
72
93
        return None
118
139
                                          local=True)
119
140
 
120
141
    def supports_tags(self):
121
 
        return False
 
142
        return True