OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 cStringIO | 7 import cStringIO |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 def CaptureInfo(cwd): | 511 def CaptureInfo(cwd): |
512 """Returns a dictionary from the svn info output for the given file. | 512 """Returns a dictionary from the svn info output for the given file. |
513 | 513 |
514 Throws an exception if svn info fails.""" | 514 Throws an exception if svn info fails.""" |
515 result = {} | 515 result = {} |
516 output = SVN.Capture(['info', '--xml', cwd]) | 516 output = SVN.Capture(['info', '--xml', cwd]) |
517 info = ElementTree.XML(output) | 517 info = ElementTree.XML(output) |
518 if info is None: | 518 if info is None: |
519 return result | 519 return result |
520 entry = info.find('entry') | 520 entry = info.find('entry') |
| 521 if entry is None: |
| 522 return result |
521 | 523 |
522 # Use .text when the item is not optional. | 524 # Use .text when the item is not optional. |
523 result['Path'] = entry.attrib['path'] | 525 result['Path'] = entry.attrib['path'] |
524 result['Revision'] = int(entry.attrib['revision']) | 526 result['Revision'] = int(entry.attrib['revision']) |
525 result['Node Kind'] = entry.attrib['kind'] | 527 result['Node Kind'] = entry.attrib['kind'] |
526 # Differs across versions. | 528 # Differs across versions. |
527 if result['Node Kind'] == 'dir': | 529 if result['Node Kind'] == 'dir': |
528 result['Node Kind'] = 'directory' | 530 result['Node Kind'] = 'directory' |
529 result['URL'] = entry.find('url').text | 531 result['URL'] = entry.find('url').text |
530 repository = entry.find('repository') | 532 repository = entry.find('repository') |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 if (file_status[0][0] in ('D', 'A', '!') or | 983 if (file_status[0][0] in ('D', 'A', '!') or |
982 not file_status[0][1:].isspace()): | 984 not file_status[0][1:].isspace()): |
983 # Added, deleted file requires manual intervention and require calling | 985 # Added, deleted file requires manual intervention and require calling |
984 # revert, like for properties. | 986 # revert, like for properties. |
985 try: | 987 try: |
986 SVN.Capture(['revert', file_status[1]], cwd=repo_root) | 988 SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
987 except gclient_utils.CheckCallError: | 989 except gclient_utils.CheckCallError: |
988 if not os.path.exists(file_path): | 990 if not os.path.exists(file_path): |
989 continue | 991 continue |
990 raise | 992 raise |
OLD | NEW |