##// END OF EJS Templates
Add repo support
Jonathan Frederic -
Show More
@@ -2,20 +2,27 b''
2 2 """
3 3 Backport pull requests to a particular branch.
4 4
5 Usage: backport_pr.py branch [PR] [PR2]
5 Usage: backport_pr.py [org/repository] branch [PR] [PR2]
6 6
7 7 e.g.:
8 8
9 9 python tools/backport_pr.py 0.13.1 123 155
10 10
11 to backport PR #123 onto branch 0.13.1
11 to backport PRs #123 and #155 onto branch 0.13.1
12 12
13 13 or
14 14
15 15 python tools/backport_pr.py 2.1
16 16
17 17 to see what PRs are marked for backport with milestone=2.1 that have yet to be applied
18 to branch 2.x.
18 to branch 2.x
19
20 or
21
22 python tools/backport_pr.py jupyter/notebook 0.13.1 123 155
23
24 to backport PRs #123 and #155 of the `jupyter/notebook` repo onto branch 0.13.1
25 of that repo.
19 26
20 27 """
21 28
@@ -153,24 +160,30 b" def should_backport(labels=None, milestone=None, project='ipython/ipython'):"
153 160 return should_backport
154 161
155 162 if __name__ == '__main__':
156
157 if len(sys.argv) < 2:
163 project = 'ipython/ipython'
164 args = list(sys.argv)
165 if len(args) >= 2:
166 if '/' in args[1]:
167 project = args[1]
168 del args[1]
169
170 if len(args) < 2:
158 171 print(__doc__)
159 172 sys.exit(1)
160 173
161 if len(sys.argv) < 3:
162 milestone = sys.argv[1]
174 if len(args) < 3:
175 milestone = args[1]
163 176 branch = milestone.split('.')[0] + '.x'
164 177 already = already_backported(branch)
165 should = should_backport(milestone=milestone)
178 should = should_backport(milestone=milestone, project=project)
166 179 print ("The following PRs should be backported:")
167 180 for pr in sorted(should.difference(already)):
168 181 print (pr)
169 182 sys.exit(0)
170
171 for prno in map(int, sys.argv[2:]):
183
184 for prno in map(int, args[2:]):
172 185 print("Backporting PR #%i" % prno)
173 rc = backport_pr(sys.argv[1], prno)
186 rc = backport_pr(args[1], prno, project=project)
174 187 if rc:
175 188 print("Backporting PR #%i failed" % prno)
176 189 sys.exit(rc)
General Comments 0
You need to be logged in to leave comments. Login now