/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

Cope with 'self.ref is None' in a couple more places.

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
    def __init__(self, bzrdir, repository, name, lockfiles, tagsdict=None):
265
265
        super(LocalGitBranch, self).__init__(bzrdir, repository, name, 
266
266
              lockfiles, tagsdict)
267
 
        if not name in repository._git.get_refs().keys():
 
267
        refs = repository._git.get_refs()
 
268
        if not (name in refs.keys() or "HEAD" in refs.keys()):
268
269
            raise errors.NotBranchError(self.base)
269
270
 
270
271
    def create_checkout(self, to_location, revision_id=None, lightweight=False,
311
312
 
312
313
    def _get_head(self):
313
314
        try:
314
 
            return self.repository._git.ref(self.ref)
 
315
            return self.repository._git.ref(self.ref or "HEAD")
315
316
        except KeyError:
316
317
            return None
317
318
 
324
325
 
325
326
    def _set_head(self, value):
326
327
        self._head = value
327
 
        self.repository._git.refs[self.ref] = self._head
 
328
        self.repository._git.refs[self.ref or "HEAD"] = self._head
328
329
        self._clear_cached_state()
329
330
 
330
331
    head = property(_get_head, _set_head)