Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into pull-request-12
Browse files Browse the repository at this point in the history
  • Loading branch information
natecavanaugh committed Sep 4, 2015
2 parents fb3326b + d0b8ea6 commit c26bd23
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions git-pull-request/git-pull-request.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,16 @@ def command_alias(alias, githubname, filename):

github_users_file.close()

def command_comment(repo_name, comment = None, pull_request_ID = None):
if pull_request_ID is None:
branch_name = get_current_branch_name()
pull_request_ID = get_pull_request_ID(branch_name)

if comment is not None and comment != '':
post_comment(repo_name, pull_request_ID, comment)
else:
raise UserWarning('Please include a comment')

def command_fetch(repo_name, pull_request_ID, auto_update = False):
"""Fetches a pull request into a local branch"""

Expand Down Expand Up @@ -522,7 +532,7 @@ def command_info(username, detailed = False):

url = get_api_url(url)

url += '?per_page=100'
url += '?per_page=100&type=owner'

repos = github_json_request(url)

Expand Down Expand Up @@ -1314,6 +1324,8 @@ def github_request(url, params = None, authenticate = True):
if DEBUG:
print url

req.add_header('Accept', 'application/vnd.github.v3+json')

try:
response = urllib2.urlopen(req)
except urllib2.URLError, msg:
Expand Down Expand Up @@ -1457,6 +1469,11 @@ def update_meta():
return branch_treeish

def main():
global DEBUG
global FORCE_COLOR

FORCE_COLOR = False

# parse command line options
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hqar:u:l:b:', ['help', 'quiet', 'all', 'repo=', 'reviewer=', 'update', 'no-update', 'user=', 'update-branch=', 'authenticate', 'debug', 'force-color'])
Expand All @@ -1478,11 +1495,9 @@ def main():

global users, DEFAULT_USERNAME
global _work_dir
global DEBUG, FORCE_COLOR
global auth_username, auth_token

DEBUG = options['debug-mode']
FORCE_COLOR = False

_work_dir = None

Expand Down Expand Up @@ -1655,6 +1670,8 @@ def main():
elif command == 'show-alias':
if arg_length >= 2:
command_show_alias(args[1])
elif command == 'comment':
command_comment(repo_name, *args[1:])
elif command == 'stats' or args[0] == 'stat':
pull_request_ID = None

Expand Down

0 comments on commit c26bd23

Please sign in to comment.