OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import os | 7 import os |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 realm = root.rsplit('/', 1)[0] | 434 realm = root.rsplit('/', 1)[0] |
435 if root.startswith('https') or not uuid: | 435 if root.startswith('https') or not uuid: |
436 regexp = re.compile(r'<%s:\d+>.*' % realm) | 436 regexp = re.compile(r'<%s:\d+>.*' % realm) |
437 else: | 437 else: |
438 regexp = re.compile(r'<%s:\d+> %s' % (realm, uuid)) | 438 regexp = re.compile(r'<%s:\d+> %s' % (realm, uuid)) |
439 if regexp is None: | 439 if regexp is None: |
440 return None | 440 return None |
441 if sys.platform.startswith('win'): | 441 if sys.platform.startswith('win'): |
442 if not 'APPDATA' in os.environ: | 442 if not 'APPDATA' in os.environ: |
443 return None | 443 return None |
444 auth_dir = os.path.join(os.environ['APPDATA'], 'auth', 'svn.simple') | 444 auth_dir = os.path.join(os.environ['APPDATA'], 'Subversion', 'auth', |
| 445 'svn.simple') |
445 else: | 446 else: |
446 if not 'HOME' in os.environ: | 447 if not 'HOME' in os.environ: |
447 return None | 448 return None |
448 auth_dir = os.path.join(os.environ['HOME'], '.subversion', 'auth', | 449 auth_dir = os.path.join(os.environ['HOME'], '.subversion', 'auth', |
449 'svn.simple') | 450 'svn.simple') |
450 for credfile in os.listdir(auth_dir): | 451 for credfile in os.listdir(auth_dir): |
451 cred_info = SVN.ReadSimpleAuth(os.path.join(auth_dir, credfile)) | 452 cred_info = SVN.ReadSimpleAuth(os.path.join(auth_dir, credfile)) |
452 if regexp.match(cred_info.get('svn:realmstring')): | 453 if regexp.match(cred_info.get('svn:realmstring')): |
453 return cred_info.get('username') | 454 return cred_info.get('username') |
454 | 455 |
(...skipping 12 matching lines...) Expand all Loading... |
467 | 468 |
468 while True: | 469 while True: |
469 key = ReadOneItem('K') | 470 key = ReadOneItem('K') |
470 if not key: | 471 if not key: |
471 break | 472 break |
472 value = ReadOneItem('V') | 473 value = ReadOneItem('V') |
473 if not value: | 474 if not value: |
474 break | 475 break |
475 values[key] = value | 476 values[key] = value |
476 return values | 477 return values |
OLD | NEW |