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

Simplify ref handling in remote.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
333
333
class RemoteGitBranch(GitBranch):
334
334
 
335
335
    def __init__(self, bzrdir, repository, name, lockfiles):
336
 
        self._ref = None
 
336
        self._sha = None
337
337
        super(RemoteGitBranch, self).__init__(bzrdir, repository, name,
338
338
                lockfiles)
339
339
 
353
353
 
354
354
    @property
355
355
    def head(self):
356
 
        if self._ref is not None:
357
 
            return self._ref
 
356
        if self._sha is not None:
 
357
            return self._sha
358
358
        heads = self.repository.get_refs()
359
 
        if self.name in heads:
360
 
            self._ref = heads[self.name]
361
 
        elif ("refs/heads/" + self.name) in heads:
362
 
            self._ref = heads["refs/heads/" + self.name]
 
359
        name = self.bzrdir._branch_name_to_ref(self.name, "HEAD")
 
360
        if name in heads:
 
361
            self._sha = heads[name]
363
362
        else:
364
363
            raise NoSuchRef(self.name)
365
 
        return self._ref
 
364
        return self._sha
366
365
 
367
366
    def _synchronize_history(self, destination, revision_id):
368
367
        """See Branch._synchronize_history()."""