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 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 return self.update(options, [], file_list) | 947 return self.update(options, [], file_list) |
948 | 948 |
949 def printcb(file_status): | 949 def printcb(file_status): |
950 file_list.append(file_status[1]) | 950 file_list.append(file_status[1]) |
951 if logging.getLogger().isEnabledFor(logging.INFO): | 951 if logging.getLogger().isEnabledFor(logging.INFO): |
952 logging.info('%s%s' % (file_status[0], file_status[1])) | 952 logging.info('%s%s' % (file_status[0], file_status[1])) |
953 else: | 953 else: |
954 print(os.path.join(self.checkout_path, file_status[1])) | 954 print(os.path.join(self.checkout_path, file_status[1])) |
955 scm.SVN.Revert(self.checkout_path, callback=printcb) | 955 scm.SVN.Revert(self.checkout_path, callback=printcb) |
956 | 956 |
| 957 # Revert() may delete the directory altogether. |
| 958 if not os.path.isdir(self.checkout_path): |
| 959 # Don't reuse the args. |
| 960 return self.update(options, [], file_list) |
| 961 |
957 try: | 962 try: |
958 # svn revert is so broken we don't even use it. Using | 963 # svn revert is so broken we don't even use it. Using |
959 # "svn up --revision BASE" achieve the same effect. | 964 # "svn up --revision BASE" achieve the same effect. |
960 # file_list will contain duplicates. | 965 # file_list will contain duplicates. |
961 self._RunAndGetFileList(['update', '--revision', 'BASE'], options, | 966 self._RunAndGetFileList(['update', '--revision', 'BASE'], options, |
962 file_list) | 967 file_list) |
963 except OSError, e: | 968 except OSError, e: |
964 # Maybe the directory disapeared meanwhile. Do not throw an exception. | 969 # Maybe the directory disapeared meanwhile. Do not throw an exception. |
965 logging.error('Failed to update:\n%s' % str(e)) | 970 logging.error('Failed to update:\n%s' % str(e)) |
966 | 971 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 new_command.append('--force') | 1033 new_command.append('--force') |
1029 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1034 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1030 new_command.extend(('--accept', 'theirs-conflict')) | 1035 new_command.extend(('--accept', 'theirs-conflict')) |
1031 elif options.manually_grab_svn_rev: | 1036 elif options.manually_grab_svn_rev: |
1032 new_command.append('--force') | 1037 new_command.append('--force') |
1033 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1038 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1034 new_command.extend(('--accept', 'postpone')) | 1039 new_command.extend(('--accept', 'postpone')) |
1035 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1040 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1036 new_command.extend(('--accept', 'postpone')) | 1041 new_command.extend(('--accept', 'postpone')) |
1037 return new_command | 1042 return new_command |
OLD | NEW |