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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 # [0-9]{1,6} for now to avoid making a network request. | 493 # [0-9]{1,6} for now to avoid making a network request. |
494 if rev.isdigit() and len(rev) < 7: | 494 if rev.isdigit() and len(rev) < 7: |
495 # If the content of the safesync_url appears to be an SVN rev and the | 495 # If the content of the safesync_url appears to be an SVN rev and the |
496 # URL of the source appears to be git, we can only attempt to find out | 496 # URL of the source appears to be git, we can only attempt to find out |
497 # if a revision is useful after we've cloned the original URL, so just | 497 # if a revision is useful after we've cloned the original URL, so just |
498 # ignore for now. | 498 # ignore for now. |
499 if (os.path.isdir(self.checkout_path) and | 499 if (os.path.isdir(self.checkout_path) and |
500 scm.GIT.IsGitSvn(cwd=self.checkout_path)): | 500 scm.GIT.IsGitSvn(cwd=self.checkout_path)): |
501 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path) | 501 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path) |
502 if not local_head or local_head < int(rev): | 502 if not local_head or local_head < int(rev): |
503 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'], | |
Dan Beam
2012/02/11 03:28:10
actually, should I be wrapping this in a try: exce
M-A Ruel
2012/02/14 22:06:20
Yes
| |
504 cwd=self.checkout_path): | |
505 scm.GIT.Capture(['fetch'], cwd=self.checkout_path) | |
503 if options.verbose: | 506 if options.verbose: |
504 print('Running git svn fetch. This might take a while.\n') | 507 print('Running git svn fetch. This might take a while.\n') |
505 scm.GIT.Capture(['svn', 'fetch'], cwd=self.checkout_path) | 508 scm.GIT.Capture(['svn', 'fetch'], cwd=self.checkout_path) |
506 sha1 = scm.GIT.GetSha1ForSvnRev(cwd=self.checkout_path, rev=rev) | 509 sha1 = scm.GIT.GetSha1ForSvnRev(cwd=self.checkout_path, rev=rev) |
507 if not sha1: | 510 if not sha1: |
508 raise gclient_utils.Error( | 511 raise gclient_utils.Error( |
509 ( 'It appears that either your git-svn remote is incorrectly\n' | 512 ( 'It appears that either your git-svn remote is incorrectly\n' |
510 'configured or the revision in your safesync_url is\n' | 513 'configured or the revision in your safesync_url is\n' |
511 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n' | 514 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n' |
512 'corresponding git hash for SVN rev %s.' ) % rev) | 515 'corresponding git hash for SVN rev %s.' ) % rev) |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1093 new_command.append('--force') | 1096 new_command.append('--force') |
1094 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1097 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1095 new_command.extend(('--accept', 'theirs-conflict')) | 1098 new_command.extend(('--accept', 'theirs-conflict')) |
1096 elif options.manually_grab_svn_rev: | 1099 elif options.manually_grab_svn_rev: |
1097 new_command.append('--force') | 1100 new_command.append('--force') |
1098 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1101 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1099 new_command.extend(('--accept', 'postpone')) | 1102 new_command.extend(('--accept', 'postpone')) |
1100 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1103 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1101 new_command.extend(('--accept', 'postpone')) | 1104 new_command.extend(('--accept', 'postpone')) |
1102 return new_command | 1105 return new_command |
OLD | NEW |