@subcommand.usage('[new upstream branch]')
def CMDupstream(parser, args):
    'Prints or sets the name of the upstream branch, if any.'
    (_, args) = parser.parse_args(args)
    if (len(args) > 1):
        parser.error(('Unrecognized args: %s' % ' '.join(args)))
    cl = Changelist()
    if args:
        branch = cl.GetBranch()
        RunGit(['branch', '--set-upstream', branch, args[0]])
        cl = Changelist()
        print(('Upstream branch set to %s' % (cl.GetUpstreamBranch(),)))
        git_common.remove_merge_base(branch)
    else:
        print(cl.GetUpstreamBranch())
    return 0
Prints or sets the name of the upstream branch, if any.
@subcommand.usage('[new upstream branch]')
def CMDupstream(parser, args):
    
    (_, args) = parser.parse_args(args)
    if (len(args) > 1):
        parser.error(('Unrecognized args: %s' % ' '.join(args)))
    cl = Changelist()
    if args:
        branch = cl.GetBranch()
        RunGit(['branch', '--set-upstream', branch, args[0]])
        cl = Changelist()
        print(('Upstream branch set to %s' % (cl.GetUpstreamBranch(),)))
        git_common.remove_merge_base(branch)
    else:
        print(cl.GetUpstreamBranch())
    return 0