Commit 2a0108eb authored by maruel@chromium.org's avatar maruel@chromium.org

Revert r132446 "Check the existence and executability of scm commands"

This completely broke syncing on Windows.

TBR=mukai@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9956149

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@132451 0039d316-1c4b-4281-b951-d872f2087c98
parent d15a8fa1
......@@ -85,8 +85,6 @@ def CreateSCM(url, root_dir=None, relpath=None):
scm_name = GetScmName(url)
if not scm_name in SCM_MAP:
raise gclient_utils.Error('No SCM found for url %s' % url)
if not gclient_utils.FindCommandExecutable(scm_name):
raise gclient_utils.Error('%s command not found' % scm_name)
return SCM_MAP[scm_name](url, root_dir, relpath)
......
......@@ -193,16 +193,6 @@ def safe_makedirs(tree):
raise
def FindCommandExecutable(cmd):
"""Finds the specified |cmd| in $PATH and returns its path. Returns None
if it's not found."""
for path in os.environ['PATH'].split(os.pathsep):
full_path = os.path.join(path, cmd)
if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
return full_path
return None
def CheckCallAndFilterAndHeader(args, always=False, **kwargs):
"""Adds 'header' support to CheckCallAndFilter.
......
......@@ -55,7 +55,6 @@ class BaseTestCase(GCBaseTestCase, SuperMoxTestBase):
'CheckCallAndFilterAndHeader')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileRead')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FindCommandExecutable')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'RemoveDirectory')
self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Capture')
self.mox.StubOutWithMock(gclient_scm.scm.SVN, '_CaptureInfo')
......@@ -112,9 +111,6 @@ class SVNWrapperTestCase(BaseTestCase):
'url',
]
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
self.mox.ReplayAll()
# If you add a member, be sure to add the relevant test!
self.compareMembers(self._scm_wrapper('svn://a'), members)
......@@ -126,7 +122,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testSVNFullUrlForRelativeUrl(self):
self.url = 'svn://a/b/c/d'
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
......@@ -135,7 +130,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testGITFullUrlForRelativeUrl(self):
self.url = 'git://a/b/c/d'
gclient_scm.gclient_utils.FindCommandExecutable('git').AndReturn("./git")
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
......@@ -144,7 +138,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testGITFakeHttpUrl(self):
self.url = 'git+http://foo'
gclient_scm.gclient_utils.FindCommandExecutable('git').AndReturn("./git")
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
......@@ -153,7 +146,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testGITFakeHttpsUrl(self):
self.url = 'git+https://foo'
gclient_scm.gclient_utils.FindCommandExecutable('git').AndReturn("./git")
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
......@@ -163,7 +155,6 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=False)
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -178,7 +169,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testRevertMissing(self):
options = self.Options(verbose=True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(False)
gclient_scm.scm.SVN.Capture(['--version'], None
......@@ -221,7 +211,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.path.exists(parent).AndReturn(False)
gclient_scm.os.makedirs(parent)
gclient_scm.os.path.exists(parent).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
files_list = self.mox.CreateMockAnything()
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.6')
......@@ -241,7 +230,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testRevertNone(self):
options = self.Options(verbose=True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn([])
......@@ -262,7 +250,6 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
items = [
('~ ', 'a'),
]
......@@ -292,7 +279,6 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
items = [
('~ ', '.'),
]
......@@ -316,7 +302,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testStatus(self):
options = self.Options(verbose=True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
......@@ -339,7 +324,6 @@ class SVNWrapperTestCase(BaseTestCase):
file_info.url = self.url
file_info.uuid = 'ABC'
file_info.revision = 42
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
# Checkout.
......@@ -374,7 +358,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
# Checkout or update.
dotted_path = join(self.base_path, '.')
......@@ -415,7 +398,6 @@ class SVNWrapperTestCase(BaseTestCase):
'UUID': 'ABC',
'Revision': 42,
}
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
......@@ -449,7 +431,6 @@ class SVNWrapperTestCase(BaseTestCase):
'UUID': 'ABC',
'Revision': 42,
}
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
......@@ -495,7 +476,6 @@ class SVNWrapperTestCase(BaseTestCase):
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(False)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
# Verify no locked files.
dotted_path = join(self.base_path, '.')
......@@ -535,7 +515,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.4.4 (r25188)')
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
# When checking out a single file with svn 1.4, we use svn export
files_list = self.mox.CreateMockAnything()
......@@ -564,7 +543,6 @@ class SVNWrapperTestCase(BaseTestCase):
# the old DEPS file.
gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(True)
gclient_scm.os.remove(join(self.base_path, 'DEPS'))
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
# Verify no locked files.
gclient_scm.scm.SVN.CaptureStatus(
......@@ -609,7 +587,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
# Verify no locked files.
gclient_scm.scm.SVN.CaptureStatus(None, join(self.base_path, '.')
......@@ -633,7 +610,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testUpdateGit(self):
options = self.Options(verbose=True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
file_path = gclient_scm.os.path.join(self.root_dir, self.relpath, '.git')
gclient_scm.os.path.exists(file_path).AndReturn(True)
......@@ -647,7 +623,6 @@ class SVNWrapperTestCase(BaseTestCase):
def testUpdateHg(self):
options = self.Options(verbose=True)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(True)
......@@ -670,7 +645,6 @@ class SVNWrapperTestCase(BaseTestCase):
).AndReturn(True)
gclient_scm.scm.SVN.IsValidRevision(url='%s@%s' % (self.url, 'fake')
).AndReturn(False)
gclient_scm.gclient_utils.FindCommandExecutable('svn').AndReturn("./svn")
self.mox.ReplayAll()
......@@ -1130,7 +1104,6 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
).AndReturn(False)
gclient_scm.scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('git').AndReturn("./git")
self.mox.ReplayAll()
......@@ -1184,7 +1157,6 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
gclient_scm.os.path.isdir(self.base_path).MultipleTimes().AndReturn(True)
gclient_scm.gclient_utils.FindCommandExecutable('git').AndReturn("./git")
self.mox.ReplayAll()
......
......@@ -30,10 +30,10 @@ class GclientUtilsUnittest(GclientUtilBase):
members = [
'Annotated', 'AutoFlush', 'CheckCallAndFilter',
'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead',
'FileWrite', 'FindCommandExecutable', 'FindFileUpwards',
'FindGclientRoot', 'GetGClientRootAndEntries', 'GetEditor',
'IsDateRevision', 'MakeDateRevision', 'MakeFileAutoFlush',
'MakeFileAnnotated', 'PathDifference', 'ParseCodereviewSettingsContent',
'FileWrite', 'FindFileUpwards', 'FindGclientRoot',
'GetGClientRootAndEntries', 'GetEditor', 'IsDateRevision',
'MakeDateRevision', 'MakeFileAutoFlush', 'MakeFileAnnotated',
'PathDifference', 'ParseCodereviewSettingsContent',
'PrintableObject', 'RemoveDirectory', 'RunEditor',
'SplitUrlRevision', 'SyntaxErrorToError',
'UpgradeToHttps', 'Wrapper', 'WorkItem',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment