Skip to content

Commit

Permalink
Make should_backport work on other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jdfreder committed Jan 25, 2016
1 parent 6bc4bda commit d42ed57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/backport_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ def already_backported(branch, since_tag=None):
lines = check_output(cmd).decode('utf8')
return set(int(num) for num in backport_re.findall(lines))

def should_backport(labels=None, milestone=None):
def should_backport(labels=None, milestone=None, project='ipython/ipython'):
"""return set of PRs marked for backport"""
if labels is None and milestone is None:
raise ValueError("Specify one of labels or milestone.")
elif labels is not None and milestone is not None:
raise ValueError("Specify only one of labels or milestone.")
if labels is not None:
issues = get_issues_list("ipython/ipython",
issues = get_issues_list(project,
labels=labels,
state='closed',
auth=True,
)
else:
milestone_id = get_milestone_id("ipython/ipython", milestone,
milestone_id = get_milestone_id(project, milestone,
auth=True)
issues = get_issues_list("ipython/ipython",
issues = get_issues_list(project,
milestone=milestone_id,
state='closed',
auth=True,
Expand All @@ -142,7 +142,7 @@ def should_backport(labels=None, milestone=None):
for issue in issues:
if not is_pull_request(issue):
continue
pr = get_pull_request("ipython/ipython", issue['number'],
pr = get_pull_request(project, issue['number'],
auth=True)
if not pr['merged']:
print ("Marked PR closed without merge: %i" % pr['number'])
Expand Down

0 comments on commit d42ed57

Please sign in to comment.