@subcommand.usage('[issue_number]')
def CMDissue(parser, args):
    'Sets or displays the current code review issue number.\n\n  Pass issue number 0 to clear the current issue.\n  '
    parser.add_option('-r', '--reverse', action='store_true', help='Lookup the branch(es) for the specified issues. If no issues are specified, all branches with mapped issues will be listed.')
    _add_codereview_select_options(parser)
    (options, args) = parser.parse_args(args)
    _process_codereview_select_options(parser, options)
    if options.reverse:
        branches = RunGit(['for-each-ref', 'refs/heads', '--format=%(refname:short)']).splitlines()
        issue_branch_map = {}
        for branch in branches:
            cl = Changelist(branchref=branch)
            issue_branch_map.setdefault(cl.GetIssue(), []).append(branch)
        if (not args):
            args = sorted(issue_branch_map.iterkeys())
        for issue in args:
            if (not issue):
                continue
            print(('Branch for issue number %s: %s' % (issue, ', '.join((issue_branch_map.get(int(issue)) or ('None',))))))
    else:
        cl = Changelist(codereview=options.forced_codereview)
        if (len(args) > 0):
            try:
                issue = int(args[0])
            except ValueError:
                DieWithError('Pass a number to set the issue or none to list it.\nMaybe you want to run git cl status?')
            cl.SetIssue(issue)
        print(('Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL())))
    return 0
Sets or displays the current code review issue number.

Pass issue number 0 to clear the current issue.
@subcommand.usage('[issue_number]')
def CMDissue(parser, args):
    'Sets or displays the current code review issue number.\n\n  Pass issue number 0 to clear the current issue.\n  '
    parser.add_option('-r', '--reverse', action='store_true', help='Lookup the branch(es) for the specified issues. If no issues are specified, all branches with mapped issues will be listed.')
    _add_codereview_select_options(parser)
    (options, args) = parser.parse_args(args)
    _process_codereview_select_options(parser, options)
    if options.reverse:
        branches = RunGit(['for-each-ref', 'refs/heads', '--format=%(refname:short)']).splitlines()
        issue_branch_map = {}
        for branch in branches:
            cl = Changelist(branchref=branch)
            issue_branch_map.setdefault(cl.GetIssue(), []).append(branch)
        if (not args):
            args = sorted(issue_branch_map.iterkeys())
        for issue in args:
            if (not issue):
                continue
            print(('Branch for issue number %s: %s' % (issue, ', '.join((issue_branch_map.get(int(issue)) or ('None',))))))
    else:
        cl = Changelist(codereview=options.forced_codereview)
        if (len(args) > 0):
            try:
                issue = int(args[0])
            except ValueError:
                DieWithError('Pass a number to set the issue or none to list it.\nMaybe you want to run git cl status?')
            cl.SetIssue(issue)
        print(('Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL())))
    return 0