def GetUpstreamBranch(self):
    if (self.upstream_branch is None):
        (remote, upstream_branch) = self.FetchUpstreamTuple(self.GetBranch())
        if (remote is not '.'):
            upstream_branch = upstream_branch.replace('refs/heads/', ('refs/remotes/%s/' % remote))
            upstream_branch = upstream_branch.replace('refs/branch-heads/', 'refs/remotes/branch-heads/')
        self.upstream_branch = upstream_branch
    return self.upstream_branch
def GetUpstreamBranch(self):
    if (self.upstream_branch is None):
        (remote, upstream_branch) = self.FetchUpstreamTuple(self.GetBranch())
        if (remote is not '.'):
            upstream_branch = upstream_branch.replace('refs/heads/', ('refs/remotes/%s/' % remote))
            upstream_branch = upstream_branch.replace('refs/branch-heads/', 'refs/remotes/branch-heads/')
        self.upstream_branch = upstream_branch
    return self.upstream_branch