def GetRemoteBranch(self):
    if (not self._remote):
        (remote, branch) = (None, self.GetBranch())
        seen_branches = set()
        while (branch not in seen_branches):
            seen_branches.add(branch)
            (remote, branch) = self.FetchUpstreamTuple(branch)
            branch = ShortBranchName(branch)
            if ((remote != '.') or branch.startswith('refs/remotes')):
                break
        else:
            remotes = RunGit(['remote'], error_ok=True).split()
            if (len(remotes) == 1):
                (remote,) = remotes
            elif ('origin' in remotes):
                remote = 'origin'
                logging.warning('Could not determine which remote this change is associated with, so defaulting to "%s".  This may not be what you want.  You may prevent this message by running "git svn info" as documented here:  %s', self._remote, GIT_INSTRUCTIONS_URL)
            else:
                logging.warn('Could not determine which remote this change is associated with.  You may prevent this message by running "git svn info" as documented here:  %s', GIT_INSTRUCTIONS_URL)
            branch = 'HEAD'
        if branch.startswith('refs/remotes'):
            self._remote = (remote, branch)
        elif branch.startswith('refs/branch-heads/'):
            self._remote = (remote, branch.replace('refs/', 'refs/remotes/'))
        else:
            self._remote = (remote, ('refs/remotes/%s/%s' % (remote, branch)))
    return self._remote
def GetRemoteBranch(self):
    if (not self._remote):
        (remote, branch) = (None, self.GetBranch())
        seen_branches = set()
        while (branch not in seen_branches):
            seen_branches.add(branch)
            (remote, branch) = self.FetchUpstreamTuple(branch)
            branch = ShortBranchName(branch)
            if ((remote != '.') or branch.startswith('refs/remotes')):
                break
        else:
            remotes = RunGit(['remote'], error_ok=True).split()
            if (len(remotes) == 1):
                (remote,) = remotes
            elif ('origin' in remotes):
                remote = 'origin'
                logging.warning('Could not determine which remote this change is associated with, so defaulting to "%s".  This may not be what you want.  You may prevent this message by running "git svn info" as documented here:  %s', self._remote, GIT_INSTRUCTIONS_URL)
            else:
                logging.warn('Could not determine which remote this change is associated with.  You may prevent this message by running "git svn info" as documented here:  %s', GIT_INSTRUCTIONS_URL)
            branch = 'HEAD'
        if branch.startswith('refs/remotes'):
            self._remote = (remote, branch)
        elif branch.startswith('refs/branch-heads/'):
            self._remote = (remote, branch.replace('refs/', 'refs/remotes/'))
        else:
            self._remote = (remote, ('refs/remotes/%s/%s' % (remote, branch)))
    return self._remote