Module Expr Str ImportFrom alias Import alias Import alias Import alias ImportFrom alias alias alias alias ImportFrom alias ImportFrom alias alias alias alias alias ImportFrom alias FunctionDef arguments args NameParam defaults Str body For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body For NameStore NameLoad body If Call AttributeLoad NameLoad attr Str body Expr Yield Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad ListLoad Str Str For NameStore Call AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr Str body Return Call AttributeLoad SubscriptLoad NameLoad Slice Num attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign NameStore Call NameLoad If CompareNotEq NameLoad NameLoad body Expr Call NameLoad ListLoad Str Str NameLoad Expr Call NameLoad ListLoad Str Str Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore BinOpMod Str NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call NameLoad Call AttributeLoad Str attr Call NameLoad With Call NameLoad NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr orelse Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore BinOpAdd BinOpAdd BinOpMod Str TupleLoad NameLoad NameLoad Str NameLoad Assign NameStore Call NameLoad ListLoad Str Str Str Str keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call NameLoad Call AttributeLoad Str attr Call NameLoad Expr Call NameLoad Call AttributeLoad Str attr Call NameLoad Expr Call NameLoad Call AttributeLoad Str attr Call NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad Return Num Assign NameStore Call NameLoad ListLoad Str Str keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index Str comprehension NameStore NameLoad Expr Call NameLoad BinOpAdd ListLoad Str Str NameLoad Expr Call NameLoad ListLoad Str Str Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad If CompareNotEq NameLoad NameLoad body Expr Call NameLoad ListLoad Str Str NameLoad Return Num decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad Call NameLoad ListLoad Str Str NameLoad Str attr Str attr Assign NameStore ListLoad Str Str BinOpMod Str TupleLoad NameLoad NameLoad Str Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Str Return Call NameLoad GeneratorExp Call NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad NameLoad body Expr Str If BoolOpAnd CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad body Raise Call NameLoad Str orelse If BoolOpAnd CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad body Raise Call NameLoad Str If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad Str keyword NameLoad keyword Str keyword NameLoad orelse Assign NameStore Call NameLoad Str NameLoad keyword NameLoad Assign NameStore Call NameLoad Str keyword NameLoad keyword Str keyword NameLoad Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body If UnaryOpNot Call NameLoad NameLoad body Continue Assign NameStore Call NameLoad Str SubscriptLoad NameLoad Index Str keyword NameLoad If UnaryOpNot SubscriptLoad NameLoad Index Str body Expr Call NameLoad BinOpMod Str SubscriptLoad NameLoad Index Str Continue If CompareNotIn SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Return Call NameLoad NameLoad keyword NameLoad decorator_list If CompareEq NameLoad Str body If CompareLt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num If CompareLt Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad keyword Str Expr Call NameLoad Str Assign NameStore ListLoad If NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Call AttributeLoad Call NameLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num
N/A N/A 
Backport pull requests to a particular branch.

Usage: backport_pr.py branch [PR]

e.g.:

    python tools/backport_pr.py 0.13.1 123

to backport PR #123 onto branch 0.13.1

or

    python tools/backport_pr.py 1.x

to see what PRs are marked for backport that have yet to be applied.

Copied from IPython 9e82bc5
https://github.com/ipython/ipython/blob/master/tools/backport_pr.py
 __future__ print_function N/A os N/A re N/A sys subprocess Popen PIPE check_call check_output urllib urlopen gh_api get_issues_list get_pull_request get_pull_request_files is_pull_request get_milestone_id pandas Series find_rejects N/A N/A root N/A . N/A N/A N/A dirname dirs files N/A N/A os walk root N/A N/A fname files N/A N/A N/A N/A fname endswith .rej N/A N/A N/A N/A N/A N/A os path join dirname fname N/A get_current_branch N/A N/A N/A N/A N/A branches N/A check_output N/A git branch N/A branch N/A N/A branches splitlines N/A N/A N/A N/A branch startswith * N/A N/A N/A N/A N/A branch N/A 1 strip N/A backport_pr N/A N/A branch num project N/A statsmodels/statsmodels N/A N/A current_branch N/A get_current_branch N/A N/A branch current_branch N/A N/A N/A check_call N/A git checkout branch N/A N/A check_call N/A git pull N/A pr N/A get_pull_request project num auth True N/A files N/A get_pull_request_files project num auth True N/A patch_url N/A pr N/A patch_url N/A title N/A pr N/A title N/A description N/A pr N/A body N/A fname N/A PR%i.patch num N/A N/A N/A N/A os path exists fname N/A N/A N/A print N/A N/A using patch from {fname} format N/A locals N/A N/A open fname f N/A N/A patch N/A N/A f read N/A N/A req N/A urlopen patch_url N/A patch N/A N/A req read N/A msg N/A N/A N/A Backport PR #%i: %s N/A num title description N/A check N/A Popen N/A git apply --check --verbose stdin PIPE N/A N/A a b N/A N/A check communicate patch N/A N/A check returncode N/A N/A N/A print N/A N/A patch did not apply, saving to {fname} format N/A locals N/A N/A print N/A N/A edit {fname} until `cat {fname} | git apply --check` succeeds format N/A locals N/A N/A print N/A N/A then run tools/backport_pr.py {num} again format N/A locals N/A N/A N/A N/A N/A os path exists fname N/A N/A N/A open fname wb f N/A N/A N/A N/A f write patch N/A 1 N/A p N/A Popen N/A git apply stdin PIPE N/A N/A a b N/A N/A p communicate patch N/A filenames N/A N/A f N/A filename N/A f files N/A N/A check_call N/A N/A git add filenames N/A N/A check_call N/A git commit -m msg N/A N/A print N/A PR #%i applied, with msg: num N/A N/A print N/A N/A print msg N/A N/A print N/A N/A branch current_branch N/A N/A N/A check_call N/A git checkout current_branch N/A 0 N/A N/A backport_re N/A N/A re compile [Bb]ackport.*?(\d+) already_backported N/A N/A branch since_tag N/A None N/A N/A return set of PRs that have been backported already N/A N/A since_tag None N/A N/A since_tag N/A N/A N/A N/A N/A check_output N/A git describe branch --abbrev=0 decode utf8 strip N/A cmd N/A git log N/A %s..%s N/A since_tag branch --oneline N/A lines N/A N/A N/A check_output cmd decode utf8 N/A N/A set N/A N/A int num N/A num N/A N/A backport_re findall lines N/A should_backport N/A N/A labels milestone N/A None None N/A N/A return set of PRs marked for backport N/A N/A N/A labels None N/A milestone None N/A N/A N/A ValueError Specify one of labels or milestone. N/A N/A N/A N/A labels None N/A milestone None N/A N/A N/A ValueError Specify only one of labels or milestone. N/A N/A labels None N/A N/A issues N/A get_issues_list statsmodels/statsmodels labels labels state closed auth True N/A N/A milestone_id N/A get_milestone_id statsmodels/statsmodels milestone auth True N/A issues N/A get_issues_list statsmodels/statsmodels milestone milestone_id state closed auth True N/A should_backport N/A N/A merged_dates N/A N/A issue issues N/A N/A N/A N/A is_pull_request issue N/A N/A N/A pr N/A get_pull_request statsmodels/statsmodels N/A issue N/A number auth True N/A N/A N/A pr N/A merged N/A N/A N/A print N/A Marked PR closed without merge: %i N/A pr N/A number N/A N/A N/A N/A pr N/A number should_backport N/A N/A N/A N/A merged_dates append N/A pr N/A merged_at N/A N/A N/A should_backport append N/A pr N/A number N/A N/A Series merged_dates index should_backport N/A N/A N/A __name__ __main__ N/A N/A N/A N/A len N/A sys argv 2 N/A N/A N/A print __doc__ N/A N/A N/A sys exit 1 N/A N/A N/A len N/A sys argv 3 N/A N/A branch N/A N/A sys argv N/A 1 N/A already N/A already_backported branch N/A should N/A should_backport milestone 0.5.1 N/A N/A print The following PRs should be backported: N/A to_backport N/A N/A already N/A N/A should N/A N/A should ix N/A N/A N/A N/A set N/A should index difference already N/A N/A N/A should sort N/A N/A pr date N/A N/A should iteritems N/A N/A N/A print pr N/A N/A N/A sys exit 0 N/A N/A N/A sys exit N/A backport_pr N/A N/A sys argv N/A 1 N/A int N/A N/A sys argv N/A 2