OLD | NEW |
1 # coding=utf-8 | 1 # coding=utf-8 |
2 # (The line above is necessary so that I can use 世界 in the | 2 # (The line above is necessary so that I can use 世界 in the |
3 # *comment* below without Python getting all bent out of shape.) | 3 # *comment* below without Python getting all bent out of shape.) |
4 | 4 |
5 # Copyright 2007-2009 Google Inc. | 5 # Copyright 2007-2009 Google Inc. |
6 # | 6 # |
7 # Licensed under the Apache License, Version 2.0 (the "License"); | 7 # Licensed under the Apache License, Version 2.0 (the "License"); |
8 # you may not use this file except in compliance with the License. | 8 # you may not use this file except in compliance with the License. |
9 # You may obtain a copy of the License at | 9 # You may obtain a copy of the License at |
10 # | 10 # |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 def reposetup(ui, repo): | 1326 def reposetup(ui, repo): |
1327 global original_match | 1327 global original_match |
1328 if original_match is None: | 1328 if original_match is None: |
1329 start_status_thread() | 1329 start_status_thread() |
1330 original_match = cmdutil.match | 1330 original_match = cmdutil.match |
1331 cmdutil.match = ReplacementForCmdutilMatch | 1331 cmdutil.match = ReplacementForCmdutilMatch |
1332 RietveldSetup(ui, repo) | 1332 RietveldSetup(ui, repo) |
1333 | 1333 |
1334 def CheckContributor(ui, repo, user=None): | 1334 def CheckContributor(ui, repo, user=None): |
1335 set_status("checking CONTRIBUTORS file") | 1335 set_status("checking CONTRIBUTORS file") |
1336 if not user: | |
1337 user = ui.config("ui", "username") | |
1338 if not user: | |
1339 raise util.Abort("[ui] username is not configured in .hg
rc") | |
1340 _, userline = FindContributor(ui, repo, user, warn=False) | 1336 _, userline = FindContributor(ui, repo, user, warn=False) |
1341 if not userline: | 1337 if not userline: |
1342 raise util.Abort("cannot find %s in CONTRIBUTORS" % (user,)) | 1338 raise util.Abort("cannot find %s in CONTRIBUTORS" % (user,)) |
1343 return userline | 1339 return userline |
1344 | 1340 |
1345 def FindContributor(ui, repo, user, warn=True): | 1341 def FindContributor(ui, repo, user=None, warn=True): |
| 1342 » if not user: |
| 1343 » » user = ui.config("ui", "username") |
| 1344 » » if not user: |
| 1345 » » » raise util.Abort("[ui] username is not configured in .hg
rc") |
1346 user = user.lower() | 1346 user = user.lower() |
1347 m = re.match(r".*<(.*)>", user) | 1347 m = re.match(r".*<(.*)>", user) |
1348 if m: | 1348 if m: |
1349 user = m.group(1) | 1349 user = m.group(1) |
1350 | 1350 |
1351 if user not in contributors: | 1351 if user not in contributors: |
1352 if warn: | 1352 if warn: |
1353 ui.warn("warning: cannot find %s in CONTRIBUTORS\n" % (u
ser,)) | 1353 ui.warn("warning: cannot find %s in CONTRIBUTORS\n" % (u
ser,)) |
1354 return None, None | 1354 return None, None |
1355 ········ | 1355 ········ |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2941 ctype, body = EncodeMultipartFormData(form_fields, files) | 2941 ctype, body = EncodeMultipartFormData(form_fields, files) |
2942 url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) | 2942 url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) |
2943 print "Uploading patch for " + patch[0] | 2943 print "Uploading patch for " + patch[0] |
2944 response_body = rpc_server.Send(url, body, content_type=ctype) | 2944 response_body = rpc_server.Send(url, body, content_type=ctype) |
2945 lines = response_body.splitlines() | 2945 lines = response_body.splitlines() |
2946 if not lines or lines[0] != "OK": | 2946 if not lines or lines[0] != "OK": |
2947 StatusUpdate(" --> %s" % response_body) | 2947 StatusUpdate(" --> %s" % response_body) |
2948 sys.exit(1) | 2948 sys.exit(1) |
2949 rv.append([lines[1], patch[0]]) | 2949 rv.append([lines[1], patch[0]]) |
2950 return rv | 2950 return rv |
OLD | NEW |