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

Merge changes, open index.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    tag,
24
24
    )
25
25
from bzrlib.decorators import needs_read_lock
26
 
from bzrlib.trace import mutter
27
26
 
28
27
from bzrlib.plugins.git.foreign import ForeignBranch
29
 
 
30
 
from dulwich.objects import (
31
 
        Commit,
32
 
        Tag,
33
 
        )
 
28
from bzrlib.plugins.git.mapping import default_mapping
34
29
 
35
30
class GitTagDict(tag.BasicTags):
36
31
 
40
35
 
41
36
    def get_tag_dict(self):
42
37
        ret = {}
43
 
        for k,v in self.repository._git.tags.iteritems():
44
 
            obj = self.repository._git.get_object(v)
45
 
            while isinstance(obj, Tag):
46
 
                v = obj.object[1]
47
 
                obj = self.repository._git.get_object(v)
48
 
            if not isinstance(obj, Commit):
49
 
                mutter("Tag %s points at object %r that is not a commit, ignoring", k, obj)
50
 
                continue
51
 
            ret[k] = self.branch.mapping.revision_id_foreign_to_bzr(v)
 
38
        for tag in self.repository._git.tags:
 
39
            ret[tag.name] = self.branch.mapping.revision_id_foreign_to_bzr(tag.ref)
52
40
        return ret
53
41
 
54
42
    def set_tag(self, name, revid):
55
 
        self.repository._git.tags[name] = revid
 
43
        raise NotImplementedError(self.set_tag)
56
44
 
57
45
 
58
46
class GitBranchConfig(config.BranchConfig):
63
51
        # do not provide a BranchDataConfig
64
52
        self.option_sources = self.option_sources[0], self.option_sources[2]
65
53
 
66
 
    def set_user_option(self, name, value, store=config.STORE_BRANCH, warn_masked=False):
 
54
    def set_user_option(self, name, value, local=False):
67
55
        """Force local to True"""
68
 
        config.BranchConfig.set_user_option(self, name, value, store=config.STORE_LOCATION, warn_masked=warn_masked)
 
56
        config.BranchConfig.set_user_option(self, name, value, local=True)
69
57
 
70
58
 
71
59
class GitBranchFormat(branch.BranchFormat):
82
70
 
83
71
    def __init__(self, bzrdir, repository, name, head, lockfiles):
84
72
        self.repository = repository
85
 
        super(GitBranch, self).__init__(repository.get_mapping())
 
73
        super(GitBranch, self).__init__(default_mapping)
86
74
        self.control_files = lockfiles
87
75
        self.bzrdir = bzrdir
88
76
        self.name = name
101
89
        """See Branch.get_parent()."""
102
90
        return None
103
91
 
104
 
    def set_parent(self, url):
105
 
        pass
106
 
 
107
92
    def lock_read(self):
108
93
        self.control_files.lock_read()
109
94
 
144
129
    def set_push_location(self, location):
145
130
        """See Branch.set_push_location."""
146
131
        self.get_config().set_user_option('push_location', location,
147
 
                                          store=config.STORE_LOCATION)
 
132
                                          local=True)
148
133
 
149
134
    def supports_tags(self):
150
135
        return True