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