| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 """Returns true if the command exists.""" | 166 """Returns true if the command exists.""" |
| 167 try: | 167 try: |
| 168 # We assume git is newer than 1.7. See: crbug.com/114483 | 168 # We assume git is newer than 1.7. See: crbug.com/114483 |
| 169 result, version = scm.GIT.AssertVersion('1.7') | 169 result, version = scm.GIT.AssertVersion('1.7') |
| 170 if not result: | 170 if not result: |
| 171 raise gclient_utils.Error('Git version is older than 1.7: %s' % version) | 171 raise gclient_utils.Error('Git version is older than 1.7: %s' % version) |
| 172 return result | 172 return result |
| 173 except OSError: | 173 except OSError: |
| 174 return False | 174 return False |
| 175 | 175 |
| 176 def GetCheckoutRoot(self): |
| 177 return scm.GIT.GetCheckoutRoot(self.checkout_path) |
| 178 |
| 176 def GetRevisionDate(self, revision): | 179 def GetRevisionDate(self, revision): |
| 177 """Returns the given revision's date in ISO-8601 format (which contains the | 180 """Returns the given revision's date in ISO-8601 format (which contains the |
| 178 time zone).""" | 181 time zone).""" |
| 179 # TODO(floitsch): get the time-stamp of the given revision and not just the | 182 # TODO(floitsch): get the time-stamp of the given revision and not just the |
| 180 # time-stamp of the currently checked out revision. | 183 # time-stamp of the currently checked out revision. |
| 181 return self._Capture(['log', '-n', '1', '--format=%ai']) | 184 return self._Capture(['log', '-n', '1', '--format=%ai']) |
| 182 | 185 |
| 183 @staticmethod | 186 @staticmethod |
| 184 def cleanup(options, args, file_list): | 187 def cleanup(options, args, file_list): |
| 185 """'Cleanup' the repo. | 188 """'Cleanup' the repo. |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 def BinaryExists(): | 916 def BinaryExists(): |
| 914 """Returns true if the command exists.""" | 917 """Returns true if the command exists.""" |
| 915 try: | 918 try: |
| 916 result, version = scm.SVN.AssertVersion('1.4') | 919 result, version = scm.SVN.AssertVersion('1.4') |
| 917 if not result: | 920 if not result: |
| 918 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) | 921 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) |
| 919 return result | 922 return result |
| 920 except OSError: | 923 except OSError: |
| 921 return False | 924 return False |
| 922 | 925 |
| 926 def GetCheckoutRoot(self): |
| 927 return scm.SVN.GetCheckoutRoot(self.checkout_path) |
| 928 |
| 923 def GetRevisionDate(self, revision): | 929 def GetRevisionDate(self, revision): |
| 924 """Returns the given revision's date in ISO-8601 format (which contains the | 930 """Returns the given revision's date in ISO-8601 format (which contains the |
| 925 time zone).""" | 931 time zone).""" |
| 926 date = scm.SVN.Capture( | 932 date = scm.SVN.Capture( |
| 927 ['propget', '--revprop', 'svn:date', '-r', revision], | 933 ['propget', '--revprop', 'svn:date', '-r', revision], |
| 928 os.path.join(self.checkout_path, '.')) | 934 os.path.join(self.checkout_path, '.')) |
| 929 return date.strip() | 935 return date.strip() |
| 930 | 936 |
| 931 def cleanup(self, options, args, file_list): | 937 def cleanup(self, options, args, file_list): |
| 932 """Cleanup working copy.""" | 938 """Cleanup working copy.""" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 new_command.append('--force') | 1291 new_command.append('--force') |
| 1286 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1292 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1287 new_command.extend(('--accept', 'theirs-conflict')) | 1293 new_command.extend(('--accept', 'theirs-conflict')) |
| 1288 elif options.manually_grab_svn_rev: | 1294 elif options.manually_grab_svn_rev: |
| 1289 new_command.append('--force') | 1295 new_command.append('--force') |
| 1290 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1296 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1291 new_command.extend(('--accept', 'postpone')) | 1297 new_command.extend(('--accept', 'postpone')) |
| 1292 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1298 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1293 new_command.extend(('--accept', 'postpone')) | 1299 new_command.extend(('--accept', 'postpone')) |
| 1294 return new_command | 1300 return new_command |
| OLD | NEW |