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

Update to newer version of Dulwich, saner branch names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        return get_rich_root_format(stacked)
80
80
 
81
81
    def _branch_name_to_ref(self, name):
82
 
        from bzrlib.plugins.git.branch import branch_name_to_ref
83
 
        return branch_name_to_ref(name)
 
82
        raise NotImplementedError(self._branch_name_to_ref)
84
83
 
85
84
    if bzrlib_version >= (2, 2):
86
85
        def open_branch(self, name=None, ignore_fallbacks=None,
113
112
        self._lockfiles = lockfiles
114
113
        self._mode_check_done = None
115
114
 
 
115
    def _branch_name_to_ref(self, name):
 
116
        from bzrlib.plugins.git.branch import branch_name_to_ref
 
117
        if name in (None, "HEAD"):
 
118
            from dulwich.repo import SYMREF
 
119
            refcontents = self._git.refs.read_ref("HEAD")
 
120
            if refcontents.startswith(SYMREF):
 
121
                name = refcontents[len(SYMREF):]
 
122
            else:
 
123
                name = "HEAD"
 
124
        return branch_name_to_ref(name, "HEAD")
 
125
 
116
126
    def is_control_filename(self, filename):
117
127
        return filename == '.git' or filename.startswith('.git/')
118
128
 
139
149
    def list_branches(self):
140
150
        ret = []
141
151
        for name in self._git.get_refs():
142
 
            if name.startswith("refs/heads/") or name == "HEAD":
 
152
            if name.startswith("refs/heads/"):
143
153
                ret.append(self.open_branch(name=name))
144
154
        return ret
145
155