OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Wrapper script around Rietveld's upload.py that groups files into | 6 """Wrapper script around Rietveld's upload.py that groups files into |
7 changelists.""" | 7 changelists.""" |
8 | 8 |
9 import getpass | 9 import getpass |
10 import os | 10 import os |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 """ | 570 """ |
571 modified_files = GetModifiedFiles() | 571 modified_files = GetModifiedFiles() |
572 if "" not in modified_files: | 572 if "" not in modified_files: |
573 return [] | 573 return [] |
574 return modified_files[""] | 574 return modified_files[""] |
575 | 575 |
576 | 576 |
577 def SendToRietveld(request_path, payload=None, | 577 def SendToRietveld(request_path, payload=None, |
578 content_type="application/octet-stream", timeout=None): | 578 content_type="application/octet-stream", timeout=None): |
579 """Send a POST/GET to Rietveld. Returns the response body.""" | 579 """Send a POST/GET to Rietveld. Returns the response body.""" |
| 580 server = GetCodeReviewSetting("CODE_REVIEW_SERVER") |
580 def GetUserCredentials(): | 581 def GetUserCredentials(): |
581 """Prompts the user for a username and password.""" | 582 """Prompts the user for a username and password.""" |
582 email = upload.GetEmail() | 583 email = upload.GetEmail("Email (login for uploading to %s)" % server) |
583 password = getpass.getpass("Password for %s: " % email) | 584 password = getpass.getpass("Password for %s: " % email) |
584 return email, password | 585 return email, password |
585 | |
586 server = GetCodeReviewSetting("CODE_REVIEW_SERVER") | |
587 rpc_server = upload.HttpRpcServer(server, | 586 rpc_server = upload.HttpRpcServer(server, |
588 GetUserCredentials, | 587 GetUserCredentials, |
589 host_override=server, | 588 host_override=server, |
590 save_cookies=True) | 589 save_cookies=True) |
591 try: | 590 try: |
592 return rpc_server.Send(request_path, payload, content_type, timeout) | 591 return rpc_server.Send(request_path, payload, content_type, timeout) |
593 except urllib2.URLError: | 592 except urllib2.URLError: |
594 if timeout is None: | 593 if timeout is None: |
595 ErrorExit("Error accessing url %s" % request_path) | 594 ErrorExit("Error accessing url %s" % request_path) |
596 else: | 595 else: |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 return 0 | 1283 return 0 |
1285 args =["svn", command] | 1284 args =["svn", command] |
1286 root = GetRepositoryRoot() | 1285 root = GetRepositoryRoot() |
1287 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) | 1286 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) |
1288 RunShell(args, True) | 1287 RunShell(args, True) |
1289 return 0 | 1288 return 0 |
1290 | 1289 |
1291 | 1290 |
1292 if __name__ == "__main__": | 1291 if __name__ == "__main__": |
1293 sys.exit(main()) | 1292 sys.exit(main()) |
OLD | NEW |