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