| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 def CreateSCM(url, root_dir=None, relpath=None): | 79 def CreateSCM(url, root_dir=None, relpath=None): |
| 80 SCM_MAP = { | 80 SCM_MAP = { |
| 81 'svn' : SVNWrapper, | 81 'svn' : SVNWrapper, |
| 82 'git' : GitWrapper, | 82 'git' : GitWrapper, |
| 83 } | 83 } |
| 84 | 84 |
| 85 scm_name = GetScmName(url) | 85 scm_name = GetScmName(url) |
| 86 if not scm_name in SCM_MAP: | 86 if not scm_name in SCM_MAP: |
| 87 raise gclient_utils.Error('No SCM found for url %s' % url) | 87 raise gclient_utils.Error('No SCM found for url %s' % url) |
| 88 if not gclient_utils.FindCommandExecutable(scm_name): |
| 89 raise gclient_utils.Error('%s command not found' % scm_name) |
| 88 return SCM_MAP[scm_name](url, root_dir, relpath) | 90 return SCM_MAP[scm_name](url, root_dir, relpath) |
| 89 | 91 |
| 90 | 92 |
| 91 # SCMWrapper base class | 93 # SCMWrapper base class |
| 92 | 94 |
| 93 class SCMWrapper(object): | 95 class SCMWrapper(object): |
| 94 """Add necessary glue between all the supported SCM. | 96 """Add necessary glue between all the supported SCM. |
| 95 | 97 |
| 96 This is the abstraction layer to bind to different SCM. | 98 This is the abstraction layer to bind to different SCM. |
| 97 """ | 99 """ |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 new_command.append('--force') | 1131 new_command.append('--force') |
| 1130 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1132 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1131 new_command.extend(('--accept', 'theirs-conflict')) | 1133 new_command.extend(('--accept', 'theirs-conflict')) |
| 1132 elif options.manually_grab_svn_rev: | 1134 elif options.manually_grab_svn_rev: |
| 1133 new_command.append('--force') | 1135 new_command.append('--force') |
| 1134 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1136 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1135 new_command.extend(('--accept', 'postpone')) | 1137 new_command.extend(('--accept', 'postpone')) |
| 1136 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1138 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1137 new_command.extend(('--accept', 'postpone')) | 1139 new_command.extend(('--accept', 'postpone')) |
| 1138 return new_command | 1140 return new_command |
| OLD | NEW |