/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

Try to import nothing other than __init__ when not opening git repositories.

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
26
27
 
27
28
from bzrlib.plugins.git.foreign import ForeignBranch
28
29
 
 
30
from dulwich.objects import (
 
31
        Commit,
 
32
        Tag,
 
33
        )
 
34
 
29
35
class GitTagDict(tag.BasicTags):
30
36
 
31
37
    def __init__(self, branch):
35
41
    def get_tag_dict(self):
36
42
        ret = {}
37
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
38
51
            ret[k] = self.branch.mapping.revision_id_foreign_to_bzr(v)
39
52
        return ret
40
53
 
50
63
        # do not provide a BranchDataConfig
51
64
        self.option_sources = self.option_sources[0], self.option_sources[2]
52
65
 
53
 
    def set_user_option(self, name, value, local=False):
 
66
    def set_user_option(self, name, value, store=config.STORE_BRANCH, warn_masked=False):
54
67
        """Force local to True"""
55
 
        config.BranchConfig.set_user_option(self, name, value, local=True)
 
68
        config.BranchConfig.set_user_option(self, name, value, store=config.STORE_LOCATION, warn_masked=warn_masked)
56
69
 
57
70
 
58
71
class GitBranchFormat(branch.BranchFormat):
131
144
    def set_push_location(self, location):
132
145
        """See Branch.set_push_location."""
133
146
        self.get_config().set_user_option('push_location', location,
134
 
                                          local=True)
 
147
                                          store=config.STORE_LOCATION)
135
148
 
136
149
    def supports_tags(self):
137
150
        return True