| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import datetime | 6 import datetime |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| 11 import urlparse | 11 import urlparse |
| 12 | 12 |
| 13 import breakpad # pylint: disable=W0611 | |
| 14 | 13 |
| 15 import gclient_utils | 14 import gclient_utils |
| 16 import subprocess2 | 15 import subprocess2 |
| 17 | 16 |
| 18 USAGE = """ | 17 USAGE = """ |
| 19 WARNING: Please use this tool in an empty directory | 18 WARNING: Please use this tool in an empty directory |
| 20 (or at least one that you don't mind clobbering.) | 19 (or at least one that you don't mind clobbering.) |
| 21 | 20 |
| 22 REQUIRES: SVN 1.5+ | 21 REQUIRES: SVN 1.5+ |
| 23 NOTE: NO NEED TO CHECKOUT ANYTHING IN ADVANCE OF USING THIS TOOL. | 22 NOTE: NO NEED TO CHECKOUT ANYTHING IN ADVANCE OF USING THIS TOOL. |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 if sys.platform == 'win32': | 369 if sys.platform == 'win32': |
| 371 folder = '%%APPDATA%\\Subversion\\auth' | 370 folder = '%%APPDATA%\\Subversion\\auth' |
| 372 else: | 371 else: |
| 373 folder = '~/.subversion/auth' | 372 folder = '~/.subversion/auth' |
| 374 folder = os.path.expandvars(os.path.expanduser(folder)) | 373 folder = os.path.expandvars(os.path.expanduser(folder)) |
| 375 svn_simple_folder = os.path.join(folder, 'svn.simple') | 374 svn_simple_folder = os.path.join(folder, 'svn.simple') |
| 376 results = {} | 375 results = {} |
| 377 try: | 376 try: |
| 378 for auth_file in os.listdir(svn_simple_folder): | 377 for auth_file in os.listdir(svn_simple_folder): |
| 379 # Read the SVN auth file, convert it into a dictionary, and store it. | 378 # Read the SVN auth file, convert it into a dictionary, and store it. |
| 380 results[auth_file] = dict(re.findall(r'K [0-9]+\n(.*)\nV [0-9]+\n(.*)\n', | 379 results[auth_file] = dict(re.findall(r'K [0-9]+\n(.*)\nV [0-9]+\n(.*)\n', |
| 381 open(os.path.join(svn_simple_folder, auth_file)).read())) | 380 open(os.path.join(svn_simple_folder, auth_file)).read())) |
| 382 except Exception as _: | 381 except Exception as _: |
| 383 pass | 382 pass |
| 384 return results | 383 return results |
| 385 | 384 |
| 386 | 385 |
| 387 def getCurrentSVNUsers(url): | 386 def getCurrentSVNUsers(url): |
| 388 """Tries to fetch the current SVN in the current checkout by scanning the | 387 """Tries to fetch the current SVN in the current checkout by scanning the |
| 389 SVN authorization folder for a match with the current SVN URL.""" | 388 SVN authorization folder for a match with the current SVN URL.""" |
| 390 netloc = urlparse.urlparse(url)[1] | 389 netloc = urlparse.urlparse(url)[1] |
| 391 auth_infos = getSVNAuthInfo() | 390 auth_infos = getSVNAuthInfo() |
| 392 results = [] | 391 results = [] |
| 393 for _, auth_info in auth_infos.iteritems(): | 392 for _, auth_info in auth_infos.iteritems(): |
| 394 if ('svn:realmstring' in auth_info | 393 if ('svn:realmstring' in auth_info |
| 395 and netloc in auth_info['svn:realmstring']): | 394 and netloc in auth_info['svn:realmstring']): |
| 396 username = auth_info['username'] | 395 username = auth_info['username'] |
| 397 results.append(username) | 396 results.append(username) |
| 398 if 'google.com' in username: | 397 if 'google.com' in username: |
| 399 results.append(username.replace('google.com', 'chromium.org')) | 398 results.append(username.replace('google.com', 'chromium.org')) |
| 400 return results | 399 return results |
| 401 | 400 |
| 402 | 401 |
| 403 def prompt(question): | 402 def prompt(question): |
| 404 while True: | 403 while True: |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 639 |
| 641 return drover(options, args) | 640 return drover(options, args) |
| 642 | 641 |
| 643 | 642 |
| 644 if __name__ == "__main__": | 643 if __name__ == "__main__": |
| 645 try: | 644 try: |
| 646 sys.exit(main()) | 645 sys.exit(main()) |
| 647 except KeyboardInterrupt: | 646 except KeyboardInterrupt: |
| 648 sys.stderr.write('interrupted\n') | 647 sys.stderr.write('interrupted\n') |
| 649 sys.exit(1) | 648 sys.exit(1) |
| OLD | NEW |