| 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 collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 result, version = scm.GIT.AssertVersion('1.7') | 215 result, version = scm.GIT.AssertVersion('1.7') |
| 216 if not result: | 216 if not result: |
| 217 raise gclient_utils.Error('Git version is older than 1.7: %s' % version) | 217 raise gclient_utils.Error('Git version is older than 1.7: %s' % version) |
| 218 return result | 218 return result |
| 219 except OSError: | 219 except OSError: |
| 220 return False | 220 return False |
| 221 | 221 |
| 222 def GetCheckoutRoot(self): | 222 def GetCheckoutRoot(self): |
| 223 return scm.GIT.GetCheckoutRoot(self.checkout_path) | 223 return scm.GIT.GetCheckoutRoot(self.checkout_path) |
| 224 | 224 |
| 225 def GetRemoteURL(self, options, cwd=None): | |
| 226 try: | |
| 227 return self._Capture(['config', 'remote.%s.url' % self.remote], | |
| 228 cwd=cwd or self.checkout_path).rstrip() | |
| 229 except (OSError, subprocess2.CalledProcessError): | |
| 230 pass | |
| 231 try: | |
| 232 # This may occur if we have a git-svn checkout. | |
| 233 if scm.GIT.IsGitSvn(os.curdir): | |
| 234 return scm.GIT.Capture(['config', '--local', '--get', | |
| 235 'svn-remote.svn.url'], os.curdir).rstrip() | |
| 236 except (OSError, subprocess2.CalledProcessError): | |
| 237 pass | |
| 238 return None | |
| 239 | |
| 240 def GetRevisionDate(self, _revision): | 225 def GetRevisionDate(self, _revision): |
| 241 """Returns the given revision's date in ISO-8601 format (which contains the | 226 """Returns the given revision's date in ISO-8601 format (which contains the |
| 242 time zone).""" | 227 time zone).""" |
| 243 # TODO(floitsch): get the time-stamp of the given revision and not just the | 228 # TODO(floitsch): get the time-stamp of the given revision and not just the |
| 244 # time-stamp of the currently checked out revision. | 229 # time-stamp of the currently checked out revision. |
| 245 return self._Capture(['log', '-n', '1', '--format=%ai']) | 230 return self._Capture(['log', '-n', '1', '--format=%ai']) |
| 246 | 231 |
| 247 @staticmethod | 232 @staticmethod |
| 248 def cleanup(options, args, file_list): | 233 def cleanup(options, args, file_list): |
| 249 """'Cleanup' the repo. | 234 """'Cleanup' the repo. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 # Not a fatal error, or even very interesting in a non-git-submodule | 270 # Not a fatal error, or even very interesting in a non-git-submodule |
| 286 # world. So just keep it quiet. | 271 # world. So just keep it quiet. |
| 287 pass | 272 pass |
| 288 try: | 273 try: |
| 289 gclient_utils.CheckCallAndFilter(cmd3, **kwargs) | 274 gclient_utils.CheckCallAndFilter(cmd3, **kwargs) |
| 290 except subprocess2.CalledProcessError: | 275 except subprocess2.CalledProcessError: |
| 291 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs) | 276 gclient_utils.CheckCallAndFilter(cmd3 + ['always'], **kwargs) |
| 292 | 277 |
| 293 gclient_utils.CheckCallAndFilter(cmd4, **kwargs) | 278 gclient_utils.CheckCallAndFilter(cmd4, **kwargs) |
| 294 | 279 |
| 280 def _FetchAndReset(self, revision, file_list, options): |
| 281 """Equivalent to git fetch; git reset.""" |
| 282 quiet = [] |
| 283 if not options.verbose: |
| 284 quiet = ['--quiet'] |
| 285 self._UpdateBranchHeads(options, fetch=False) |
| 286 |
| 287 fetch_cmd = [ |
| 288 '-c', 'core.deltaBaseCacheLimit=2g', 'fetch', self.remote, '--prune'] |
| 289 self._Run(fetch_cmd + quiet, options, retry=True) |
| 290 self._Run(['reset', '--hard', revision] + quiet, options) |
| 291 self.UpdateSubmoduleConfig() |
| 292 if file_list is not None: |
| 293 files = self._Capture(['ls-files']).splitlines() |
| 294 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
| 295 |
| 295 def update(self, options, args, file_list): | 296 def update(self, options, args, file_list): |
| 296 """Runs git to update or transparently checkout the working copy. | 297 """Runs git to update or transparently checkout the working copy. |
| 297 | 298 |
| 298 All updated files will be appended to file_list. | 299 All updated files will be appended to file_list. |
| 299 | 300 |
| 300 Raises: | 301 Raises: |
| 301 Error: if can't get URL for relative path. | 302 Error: if can't get URL for relative path. |
| 302 """ | 303 """ |
| 303 if args: | 304 if args: |
| 304 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 305 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 372 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
| 372 | 373 |
| 373 if not os.path.exists(os.path.join(self.checkout_path, '.git')): | 374 if not os.path.exists(os.path.join(self.checkout_path, '.git')): |
| 374 raise gclient_utils.Error('\n____ %s%s\n' | 375 raise gclient_utils.Error('\n____ %s%s\n' |
| 375 '\tPath is not a git repo. No .git dir.\n' | 376 '\tPath is not a git repo. No .git dir.\n' |
| 376 '\tTo resolve:\n' | 377 '\tTo resolve:\n' |
| 377 '\t\trm -rf %s\n' | 378 '\t\trm -rf %s\n' |
| 378 '\tAnd run gclient sync again\n' | 379 '\tAnd run gclient sync again\n' |
| 379 % (self.relpath, rev_str, self.relpath)) | 380 % (self.relpath, rev_str, self.relpath)) |
| 380 | 381 |
| 382 # See if the url has changed (the unittests use git://foo for the url, let |
| 383 # that through). |
| 384 current_url = self._Capture(['config', 'remote.%s.url' % self.remote]) |
| 385 return_early = False |
| 386 # TODO(maruel): Delete url != 'git://foo' since it's just to make the |
| 387 # unit test pass. (and update the comment above) |
| 388 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. |
| 389 # This allows devs to use experimental repos which have a different url |
| 390 # but whose branch(s) are the same as official repos. |
| 391 if (current_url != url and |
| 392 url != 'git://foo' and |
| 393 subprocess2.capture( |
| 394 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], |
| 395 cwd=self.checkout_path).strip() != 'False'): |
| 396 print('_____ switching %s to a new upstream' % self.relpath) |
| 397 # Make sure it's clean |
| 398 self._CheckClean(rev_str) |
| 399 # Switch over to the new upstream |
| 400 self._Run(['remote', 'set-url', self.remote, url], options) |
| 401 self._FetchAndReset(revision, file_list, options) |
| 402 return_early = True |
| 403 |
| 381 # Need to do this in the normal path as well as in the post-remote-switch | 404 # Need to do this in the normal path as well as in the post-remote-switch |
| 382 # path. | 405 # path. |
| 383 self._PossiblySwitchCache(url, options) | 406 self._PossiblySwitchCache(url, options) |
| 384 | 407 |
| 408 if return_early: |
| 409 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
| 410 |
| 385 cur_branch = self._GetCurrentBranch() | 411 cur_branch = self._GetCurrentBranch() |
| 386 | 412 |
| 387 # Cases: | 413 # Cases: |
| 388 # 0) HEAD is detached. Probably from our initial clone. | 414 # 0) HEAD is detached. Probably from our initial clone. |
| 389 # - make sure HEAD is contained by a named ref, then update. | 415 # - make sure HEAD is contained by a named ref, then update. |
| 390 # Cases 1-4. HEAD is a branch. | 416 # Cases 1-4. HEAD is a branch. |
| 391 # 1) current branch is not tracking a remote branch (could be git-svn) | 417 # 1) current branch is not tracking a remote branch (could be git-svn) |
| 392 # - try to rebase onto the new hash or branch | 418 # - try to rebase onto the new hash or branch |
| 393 # 2) current branch is tracking a remote branch with local committed | 419 # 2) current branch is tracking a remote branch with local committed |
| 394 # changes, but the DEPS file switched to point to a hash | 420 # changes, but the DEPS file switched to point to a hash |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 if use_reference: | 806 if use_reference: |
| 781 cmd += ['--reference', os.path.abspath(self.checkout_path)] | 807 cmd += ['--reference', os.path.abspath(self.checkout_path)] |
| 782 | 808 |
| 783 self._Run(cmd + [url, folder], | 809 self._Run(cmd + [url, folder], |
| 784 options, filter_fn=filter_fn, cwd=self.cache_dir, retry=True) | 810 options, filter_fn=filter_fn, cwd=self.cache_dir, retry=True) |
| 785 else: | 811 else: |
| 786 # For now, assert that host/path/to/repo.git is identical. We may want | 812 # For now, assert that host/path/to/repo.git is identical. We may want |
| 787 # to relax this restriction in the future to allow for smarter cache | 813 # to relax this restriction in the future to allow for smarter cache |
| 788 # repo update schemes (such as pulling the same repo, but from a | 814 # repo update schemes (such as pulling the same repo, but from a |
| 789 # different host). | 815 # different host). |
| 790 existing_url = self.GetRemoteURL(options, cwd=folder) | 816 existing_url = self._Capture(['config', 'remote.%s.url' % self.remote], |
| 817 cwd=folder) |
| 791 assert self._NormalizeGitURL(existing_url) == self._NormalizeGitURL(url) | 818 assert self._NormalizeGitURL(existing_url) == self._NormalizeGitURL(url) |
| 792 | 819 |
| 793 if use_reference: | 820 if use_reference: |
| 794 with open(altfile, 'w') as f: | 821 with open(altfile, 'w') as f: |
| 795 f.write(os.path.abspath(checkout_objects)) | 822 f.write(os.path.abspath(checkout_objects)) |
| 796 | 823 |
| 797 # Would normally use `git remote update`, but it doesn't support | 824 # Would normally use `git remote update`, but it doesn't support |
| 798 # --progress, so use fetch instead. | 825 # --progress, so use fetch instead. |
| 799 self._Run(['fetch'] + v + ['--multiple', '--progress', '--all'], | 826 self._Run(['fetch'] + v + ['--multiple', '--progress', '--all'], |
| 800 options, filter_fn=filter_fn, cwd=folder, retry=True) | 827 options, filter_fn=filter_fn, cwd=folder, retry=True) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 result, version = scm.SVN.AssertVersion('1.4') | 1076 result, version = scm.SVN.AssertVersion('1.4') |
| 1050 if not result: | 1077 if not result: |
| 1051 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) | 1078 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) |
| 1052 return result | 1079 return result |
| 1053 except OSError: | 1080 except OSError: |
| 1054 return False | 1081 return False |
| 1055 | 1082 |
| 1056 def GetCheckoutRoot(self): | 1083 def GetCheckoutRoot(self): |
| 1057 return scm.SVN.GetCheckoutRoot(self.checkout_path) | 1084 return scm.SVN.GetCheckoutRoot(self.checkout_path) |
| 1058 | 1085 |
| 1059 def GetRemoteURL(self, options): | |
| 1060 try: | |
| 1061 return scm.SVN.CaptureLocalInfo([os.curdir], | |
| 1062 self.checkout_path).get('URL') | |
| 1063 except (OSError, subprocess2.CalledProcessError): | |
| 1064 pass | |
| 1065 try: | |
| 1066 # This may occur if we have a git-svn checkout. | |
| 1067 if scm.GIT.IsGitSvn(os.curdir): | |
| 1068 return scm.GIT.Capture(['config', '--local', '--get', | |
| 1069 'svn-remote.svn.url'], os.curdir).rstrip() | |
| 1070 except (OSError, subprocess2.CalledProcessError): | |
| 1071 pass | |
| 1072 return None | |
| 1073 | |
| 1074 | |
| 1075 def GetRevisionDate(self, revision): | 1086 def GetRevisionDate(self, revision): |
| 1076 """Returns the given revision's date in ISO-8601 format (which contains the | 1087 """Returns the given revision's date in ISO-8601 format (which contains the |
| 1077 time zone).""" | 1088 time zone).""" |
| 1078 date = scm.SVN.Capture( | 1089 date = scm.SVN.Capture( |
| 1079 ['propget', '--revprop', 'svn:date', '-r', revision], | 1090 ['propget', '--revprop', 'svn:date', '-r', revision], |
| 1080 os.path.join(self.checkout_path, '.')) | 1091 os.path.join(self.checkout_path, '.')) |
| 1081 return date.strip() | 1092 return date.strip() |
| 1082 | 1093 |
| 1083 def cleanup(self, options, args, _file_list): | 1094 def cleanup(self, options, args, _file_list): |
| 1084 """Cleanup working copy.""" | 1095 """Cleanup working copy.""" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1104 filter_fn=SvnDiffFilterer(self.relpath).Filter) | 1115 filter_fn=SvnDiffFilterer(self.relpath).Filter) |
| 1105 | 1116 |
| 1106 def update(self, options, args, file_list): | 1117 def update(self, options, args, file_list): |
| 1107 """Runs svn to update or transparently checkout the working copy. | 1118 """Runs svn to update or transparently checkout the working copy. |
| 1108 | 1119 |
| 1109 All updated files will be appended to file_list. | 1120 All updated files will be appended to file_list. |
| 1110 | 1121 |
| 1111 Raises: | 1122 Raises: |
| 1112 Error: if can't get URL for relative path. | 1123 Error: if can't get URL for relative path. |
| 1113 """ | 1124 """ |
| 1114 exists = os.path.exists(self.checkout_path) | 1125 # Only update if git or hg is not controlling the directory. |
| 1126 git_path = os.path.join(self.checkout_path, '.git') |
| 1127 if os.path.exists(git_path): |
| 1128 print('________ found .git directory; skipping %s' % self.relpath) |
| 1129 return |
| 1115 | 1130 |
| 1116 if exists and scm.GIT.IsGitSvn(self.checkout_path): | 1131 hg_path = os.path.join(self.checkout_path, '.hg') |
| 1117 print '________ %s looks like git-svn; skipping.' % self.relpath | 1132 if os.path.exists(hg_path): |
| 1133 print('________ found .hg directory; skipping %s' % self.relpath) |
| 1118 return | 1134 return |
| 1119 | 1135 |
| 1120 if args: | 1136 if args: |
| 1121 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 1137 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
| 1122 | 1138 |
| 1123 # revision is the revision to match. It is None if no revision is specified, | 1139 # revision is the revision to match. It is None if no revision is specified, |
| 1124 # i.e. the 'deps ain't pinned'. | 1140 # i.e. the 'deps ain't pinned'. |
| 1125 url, revision = gclient_utils.SplitUrlRevision(self.url) | 1141 url, revision = gclient_utils.SplitUrlRevision(self.url) |
| 1142 # Keep the original unpinned url for reference in case the repo is switched. |
| 1143 base_url = url |
| 1126 managed = True | 1144 managed = True |
| 1127 if options.revision: | 1145 if options.revision: |
| 1128 # Override the revision number. | 1146 # Override the revision number. |
| 1129 revision = str(options.revision) | 1147 revision = str(options.revision) |
| 1130 if revision: | 1148 if revision: |
| 1131 if revision != 'unmanaged': | 1149 if revision != 'unmanaged': |
| 1132 forced_revision = True | 1150 forced_revision = True |
| 1133 # Reconstruct the url. | 1151 # Reconstruct the url. |
| 1134 url = '%s@%s' % (url, revision) | 1152 url = '%s@%s' % (url, revision) |
| 1135 rev_str = ' at %s' % revision | 1153 rev_str = ' at %s' % revision |
| 1136 else: | 1154 else: |
| 1137 managed = False | 1155 managed = False |
| 1138 revision = None | 1156 revision = None |
| 1139 else: | 1157 else: |
| 1140 forced_revision = False | 1158 forced_revision = False |
| 1141 rev_str = '' | 1159 rev_str = '' |
| 1142 | 1160 |
| 1143 # Get the existing scm url and the revision number of the current checkout. | 1161 # Get the existing scm url and the revision number of the current checkout. |
| 1162 exists = os.path.exists(self.checkout_path) |
| 1144 if exists and managed: | 1163 if exists and managed: |
| 1145 try: | 1164 try: |
| 1146 from_info = scm.SVN.CaptureLocalInfo( | 1165 from_info = scm.SVN.CaptureLocalInfo( |
| 1147 [], os.path.join(self.checkout_path, '.')) | 1166 [], os.path.join(self.checkout_path, '.')) |
| 1148 except (gclient_utils.Error, subprocess2.CalledProcessError): | 1167 except (gclient_utils.Error, subprocess2.CalledProcessError): |
| 1149 if options.reset and options.delete_unversioned_trees: | 1168 if options.reset and options.delete_unversioned_trees: |
| 1150 print 'Removing troublesome path %s' % self.checkout_path | 1169 print 'Removing troublesome path %s' % self.checkout_path |
| 1151 gclient_utils.rmtree(self.checkout_path) | 1170 gclient_utils.rmtree(self.checkout_path) |
| 1152 exists = False | 1171 exists = False |
| 1153 else: | 1172 else: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 if d[0][0] == '!': | 1288 if d[0][0] == '!': |
| 1270 print 'You can pass --force to enable automatic removal.' | 1289 print 'You can pass --force to enable automatic removal.' |
| 1271 raise e | 1290 raise e |
| 1272 | 1291 |
| 1273 # Retrieve the current HEAD version because svn is slow at null updates. | 1292 # Retrieve the current HEAD version because svn is slow at null updates. |
| 1274 if options.manually_grab_svn_rev and not revision: | 1293 if options.manually_grab_svn_rev and not revision: |
| 1275 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) | 1294 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL']) |
| 1276 revision = str(from_info_live['Revision']) | 1295 revision = str(from_info_live['Revision']) |
| 1277 rev_str = ' at %s' % revision | 1296 rev_str = ' at %s' % revision |
| 1278 | 1297 |
| 1298 if from_info['URL'] != base_url: |
| 1299 # The repository url changed, need to switch. |
| 1300 try: |
| 1301 to_info = scm.SVN.CaptureRemoteInfo(url) |
| 1302 except (gclient_utils.Error, subprocess2.CalledProcessError): |
| 1303 # The url is invalid or the server is not accessible, it's safer to bail |
| 1304 # out right now. |
| 1305 raise gclient_utils.Error('This url is unreachable: %s' % url) |
| 1306 can_switch = ((from_info['Repository Root'] != to_info['Repository Root']) |
| 1307 and (from_info['UUID'] == to_info['UUID'])) |
| 1308 if can_switch: |
| 1309 print('\n_____ relocating %s to a new checkout' % self.relpath) |
| 1310 # We have different roots, so check if we can switch --relocate. |
| 1311 # Subversion only permits this if the repository UUIDs match. |
| 1312 # Perform the switch --relocate, then rewrite the from_url |
| 1313 # to reflect where we "are now." (This is the same way that |
| 1314 # Subversion itself handles the metadata when switch --relocate |
| 1315 # is used.) This makes the checks below for whether we |
| 1316 # can update to a revision or have to switch to a different |
| 1317 # branch work as expected. |
| 1318 # TODO(maruel): TEST ME ! |
| 1319 command = ['switch', '--relocate', |
| 1320 from_info['Repository Root'], |
| 1321 to_info['Repository Root'], |
| 1322 self.relpath] |
| 1323 self._Run(command, options, cwd=self._root_dir) |
| 1324 from_info['URL'] = from_info['URL'].replace( |
| 1325 from_info['Repository Root'], |
| 1326 to_info['Repository Root']) |
| 1327 else: |
| 1328 if not options.force and not options.reset: |
| 1329 # Look for local modifications but ignore unversioned files. |
| 1330 for status in scm.SVN.CaptureStatus(None, self.checkout_path): |
| 1331 if status[0][0] != '?': |
| 1332 raise gclient_utils.Error( |
| 1333 ('Can\'t switch the checkout to %s; UUID don\'t match and ' |
| 1334 'there is local changes in %s. Delete the directory and ' |
| 1335 'try again.') % (url, self.checkout_path)) |
| 1336 # Ok delete it. |
| 1337 print('\n_____ switching %s to a new checkout' % self.relpath) |
| 1338 gclient_utils.rmtree(self.checkout_path) |
| 1339 # We need to checkout. |
| 1340 command = ['checkout', url, self.checkout_path] |
| 1341 command = self._AddAdditionalUpdateFlags(command, options, revision) |
| 1342 self._RunAndGetFileList(command, options, file_list, self._root_dir) |
| 1343 return self.Svnversion() |
| 1344 |
| 1279 # If the provided url has a revision number that matches the revision | 1345 # If the provided url has a revision number that matches the revision |
| 1280 # number of the existing directory, then we don't need to bother updating. | 1346 # number of the existing directory, then we don't need to bother updating. |
| 1281 if not options.force and str(from_info['Revision']) == revision: | 1347 if not options.force and str(from_info['Revision']) == revision: |
| 1282 if options.verbose or not forced_revision: | 1348 if options.verbose or not forced_revision: |
| 1283 print('\n_____ %s%s' % (self.relpath, rev_str)) | 1349 print('\n_____ %s%s' % (self.relpath, rev_str)) |
| 1284 else: | 1350 else: |
| 1285 command = ['update', self.checkout_path] | 1351 command = ['update', self.checkout_path] |
| 1286 command = self._AddAdditionalUpdateFlags(command, options, revision) | 1352 command = self._AddAdditionalUpdateFlags(command, options, revision) |
| 1287 self._RunAndGetFileList(command, options, file_list, self._root_dir) | 1353 self._RunAndGetFileList(command, options, file_list, self._root_dir) |
| 1288 | 1354 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 if not os.path.isdir(self.checkout_path): | 1401 if not os.path.isdir(self.checkout_path): |
| 1336 if os.path.exists(self.checkout_path): | 1402 if os.path.exists(self.checkout_path): |
| 1337 gclient_utils.rmtree(self.checkout_path) | 1403 gclient_utils.rmtree(self.checkout_path) |
| 1338 # svn revert won't work if the directory doesn't exist. It needs to | 1404 # svn revert won't work if the directory doesn't exist. It needs to |
| 1339 # checkout instead. | 1405 # checkout instead. |
| 1340 print('\n_____ %s is missing, synching instead' % self.relpath) | 1406 print('\n_____ %s is missing, synching instead' % self.relpath) |
| 1341 # Don't reuse the args. | 1407 # Don't reuse the args. |
| 1342 return self.update(options, [], file_list) | 1408 return self.update(options, [], file_list) |
| 1343 | 1409 |
| 1344 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')): | 1410 if not os.path.isdir(os.path.join(self.checkout_path, '.svn')): |
| 1345 if scm.GIT.IsGitSvn(self.checkout_path): | 1411 if os.path.isdir(os.path.join(self.checkout_path, '.git')): |
| 1346 print '________ %s looks like git-svn; skipping.' % self.relpath | 1412 print('________ found .git directory; skipping %s' % self.relpath) |
| 1413 return |
| 1414 if os.path.isdir(os.path.join(self.checkout_path, '.hg')): |
| 1415 print('________ found .hg directory; skipping %s' % self.relpath) |
| 1347 return | 1416 return |
| 1348 if not options.force: | 1417 if not options.force: |
| 1349 raise gclient_utils.Error('Invalid checkout path, aborting') | 1418 raise gclient_utils.Error('Invalid checkout path, aborting') |
| 1350 print( | 1419 print( |
| 1351 '\n_____ %s is not a valid svn checkout, synching instead' % | 1420 '\n_____ %s is not a valid svn checkout, synching instead' % |
| 1352 self.relpath) | 1421 self.relpath) |
| 1353 gclient_utils.rmtree(self.checkout_path) | 1422 gclient_utils.rmtree(self.checkout_path) |
| 1354 # Don't reuse the args. | 1423 # Don't reuse the args. |
| 1355 return self.update(options, [], file_list) | 1424 return self.update(options, [], file_list) |
| 1356 | 1425 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 new_command.append('--force') | 1524 new_command.append('--force') |
| 1456 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1525 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1457 new_command.extend(('--accept', 'theirs-conflict')) | 1526 new_command.extend(('--accept', 'theirs-conflict')) |
| 1458 elif options.manually_grab_svn_rev: | 1527 elif options.manually_grab_svn_rev: |
| 1459 new_command.append('--force') | 1528 new_command.append('--force') |
| 1460 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1529 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1461 new_command.extend(('--accept', 'postpone')) | 1530 new_command.extend(('--accept', 'postpone')) |
| 1462 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1531 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1463 new_command.extend(('--accept', 'postpone')) | 1532 new_command.extend(('--accept', 'postpone')) |
| 1464 return new_command | 1533 return new_command |
| OLD | NEW |