| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 result = {} | 571 result = {} |
| 572 info = ElementTree.XML(SVN.Capture(['info', '--xml'] + files, cwd)) | 572 info = ElementTree.XML(SVN.Capture(['info', '--xml'] + files, cwd)) |
| 573 if info is None: | 573 if info is None: |
| 574 return result | 574 return result |
| 575 entry = info.find('entry') | 575 entry = info.find('entry') |
| 576 if entry is None: | 576 if entry is None: |
| 577 return result | 577 return result |
| 578 | 578 |
| 579 # Use .text when the item is not optional. | 579 # Use .text when the item is not optional. |
| 580 result['Path'] = entry.attrib['path'] | 580 result['Path'] = entry.attrib['path'] |
| 581 result['Revision'] = int(entry.attrib['revision']) | 581 rev = entry.attrib['revision'] |
| 582 try: |
| 583 result['Revision'] = int(rev) |
| 584 except ValueError: |
| 585 result['Revision'] = None |
| 582 result['Node Kind'] = entry.attrib['kind'] | 586 result['Node Kind'] = entry.attrib['kind'] |
| 583 # Differs across versions. | 587 # Differs across versions. |
| 584 if result['Node Kind'] == 'dir': | 588 if result['Node Kind'] == 'dir': |
| 585 result['Node Kind'] = 'directory' | 589 result['Node Kind'] = 'directory' |
| 586 result['URL'] = entry.find('url').text | 590 result['URL'] = entry.find('url').text |
| 587 repository = entry.find('repository') | 591 repository = entry.find('repository') |
| 588 result['Repository Root'] = repository.find('root').text | 592 result['Repository Root'] = repository.find('root').text |
| 589 result['UUID'] = repository.find('uuid') | 593 result['UUID'] = repository.find('uuid') |
| 590 wc_info = entry.find('wc-info') | 594 wc_info = entry.find('wc-info') |
| 591 if wc_info is not None: | 595 if wc_info is not None: |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 # revert, like for properties. | 1048 # revert, like for properties. |
| 1045 if not os.path.isdir(cwd): | 1049 if not os.path.isdir(cwd): |
| 1046 # '.' was deleted. It's not worth continuing. | 1050 # '.' was deleted. It's not worth continuing. |
| 1047 return | 1051 return |
| 1048 try: | 1052 try: |
| 1049 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1053 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
| 1050 except subprocess2.CalledProcessError: | 1054 except subprocess2.CalledProcessError: |
| 1051 if not os.path.exists(file_path): | 1055 if not os.path.exists(file_path): |
| 1052 continue | 1056 continue |
| 1053 raise | 1057 raise |
| OLD | NEW |