Example #1
0
File: repos.py Project: CMB/cligh
def remlabel(client, args):
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
        label.delete()
    except GithubException as e:
        die('''Unable to delete label %s from this repository.
Error message: %s
''' % (args.label, e.data['message']))
    print('Label removed.')
Example #2
0
def remlabel(client, args):
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
        label.delete()
    except GithubException as e:
        die('''Unable to delete label %s from this repository.
Error message: %s
''' % (args.label, e.data['message']))
    print('Label removed.')
Example #3
0
File: issues.py Project: CMB/cligh
def remlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        die('''Unable to find the label %s in this repository.
            It cannot be removed from the issue at this time.
            Error message: %s
            ''' % (args.label, e.data['message']))
    issue.remove_from_labels(label)
Example #4
0
def remlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        die('''Unable to find the label %s in this repository.
            It cannot be removed from the issue at this time.
            Error message: %s
            ''' % (args.label, e.data['message']))
    issue.remove_from_labels(label)
Example #5
0
File: repos.py Project: CMB/cligh
def addlabel(client, args):
    # xxx Make this configurable by the user.  White is a sane
    # default, for now.
    color = 'ffffff'
    repository = get_working_repo(client, args.repository)
    try:
        repository.create_label(args.label, color)
    except GithubException as e:
        die('''Unable to create label %s.
The complete error response was:
%s
''' % (args.label, e.data))
    print('Label added.')
Example #6
0
def addlabel(client, args):
    # xxx Make this configurable by the user.  White is a sane
    # default, for now.
    color = 'ffffff'
    repository = get_working_repo(client, args.repository)
    try:
        repository.create_label(args.label, color)
    except GithubException as e:
        die('''Unable to create label %s.
The complete error response was:
%s
''' % (args.label, e.data))
    print('Label added.')
Example #7
0
File: issues.py Project: CMB/cligh
def get_working_issue(client, args):
    """Get an object corresponding to the issue
    that the user wishes to manipulate.  Issues are identified by
    a repository name and issue number."""
    issue = None
    repository = get_working_repo(client, args.repository)
    try:
        issue_number = int(args.number)
    except ValueError:
        die("""%s is not a valid issue number.""" % args.number)
    try:
        issue = repository.get_issue(issue_number)
    except GithubException as e:
        die('Unable to fetch issue number %d for this repository: %s' % (issue_number, e.data['message']))
    return issue
Example #8
0
def get_working_issue(client, args):
    """Get an object corresponding to the issue
    that the user wishes to manipulate.  Issues are identified by
    a repository name and issue number."""
    issue = None
    repository = get_working_repo(client, args.repository)
    try:
        issue_number = int(args.number)
    except ValueError:
        die("""%s is not a valid issue number.""" % args.number)
    try:
        issue = repository.get_issue(issue_number)
    except GithubException as e:
        die('Unable to fetch issue number %d for this repository: %s' %
            (issue_number, e.data['message']))
    return issue
Example #9
0
File: issues.py Project: CMB/cligh
def addlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        if e.status == 404:
            die('''The label %s has not yet been added to this repository.
First, add it using:
cligh repo addlabel %s
''' % (args.label, args.label))
        else:
            die('''Unable to find the label %s in this repository.
Error message: %s
''' % (args.label, e.data['message']))

    issue.add_to_labels(label)
Example #10
0
def addlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        if e.status == 404:
            die('''The label %s has not yet been added to this repository.
First, add it using:
cligh repo addlabel %s
''' % (args.label, args.label))
        else:
            die('''Unable to find the label %s in this repository.
Error message: %s
''' % (args.label, e.data['message']))

    issue.add_to_labels(label)