Beispiel #1
0
def update(ID, **updates):
    """Update a code review.

    You may update one or more of these properties:
      title, body, or state
    """
    # Filter out any None values.
    review_updates = {k:v for k,v in updates.items() if v}

    if len(review_updates) > 0:
        data = json_encode(review_updates)
        gh_request('POST', '/repos/:user/:repo/pulls/:id', uri_vars={'id': ID}, body=data)
        printers.print_review_updated()
Beispiel #2
0
def create(title, head, base='master', message=''):
    """Create a new code review.

    title: short title of the review
    head: reference to changes being merged in
    base: destination of where merge will be applied
    message: long description of review
    """
    review_info = {
        'title': title,
        'body': message,
        'head': head,
        'base': base,
    }

    data = json_encode(review_info)
    review = parse(gh_request('POST', '/repos/:user/:repo/pulls', body=data))
    printers.print_review_created(review)