def Push(self, branch_base, branch=None,
                      dest_branch=None):
    """Pushs the named branch.
    """
    project = branch_base.project
    if branch is None:
      branch = project.CurrentBranch
    if branch is None:
      raise GitError('not currently on a branch')

    branch = project.GetBranch(branch)
    if not branch.LocalMerge:
      raise GitError(branch.name % 'branch %s does not track a remote')

    if dest_branch is None:
      dest_branch = project.dest_branch
    if dest_branch is None:
      dest_branch = branch.merge
    if not dest_branch.startswith(R_HEADS):
      dest_branch = R_HEADS + dest_branch

    if not branch.remote.projectname:
      branch.remote.projectname = project.name
      branch.remote.Save()

    remote = branch.remote.name
    cmd = ['push']
    cmd.append(remote)

    if dest_branch.startswith(R_HEADS):
      dest_branch = dest_branch[len(R_HEADS):]

    push_type = 'heads'
    ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, push_type,
                                  dest_branch)
    cmd.append(ref_spec)

    if GitCommand(project, cmd, bare=True).Wait() != 0:
      raise UploadError('Push failed')
dataset/ETHPy150Open esrlabs/git-repo/subcmds/push.py/Push.Push/swapped operands of `%`