Remove old Cog detection

This is no longer needed.

R=aravindvasudev@google.com

Change-Id: Ic1b2bbf0f00ca9d288c21fa1623c4ada80d59644
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5014581
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
changes/81/5014581/2
Josip Sokcevic 1 year ago committed by LUCI CQ
parent 5828285134
commit 88cc0b8ca8

@ -274,12 +274,6 @@ def run(options, spec, root):
checkout_type = spec['type']
checkout_spec = spec['%s_spec' % checkout_type]
# Use sso:// by default if the env is cog
if not options.protocol_override and \
(any(os.getcwd().startswith(x) for x in [
'/google/src/cloud', '/google/cog/cloud'])):
options.protocol_override = 'sso'
# Update solutions with protocol_override field
if options.protocol_override is not None:
for solution in checkout_spec['solutions']:

@ -213,18 +213,6 @@ class GitWrapper(SCMWrapper):
name = 'git'
remote = 'origin'
_is_env_cog = None
@staticmethod
def _IsCog():
"""Returns true if the env is cog"""
if not GitWrapper._is_env_cog:
GitWrapper._is_env_cog = any(
os.getcwd().startswith(x)
for x in ['/google/cog/cloud', '/google/src/cloud'])
return GitWrapper._is_env_cog
@property
def cache_dir(self):
try:
@ -1220,12 +1208,11 @@ class GitWrapper(SCMWrapper):
def _Clone(self, revision, url, options):
"""Clone a git repository from the given URL.
Once we've cloned the repo, we checkout a working branch if the specified
revision is a branch head. If it is a tag or a specific commit, then we
leave HEAD detached as it makes future updates simpler -- in this case the
user should first create a new branch or switch to an existing branch before
making changes in the repo."""
in_cog_workspace = self._IsCog()
Once we've cloned the repo, we checkout a working branch if the
specified revision is a branch head. If it is a tag or a specific
commit, then we leave HEAD detached as it makes future updates simpler
-- in this case the user should first create a new branch or switch to
an existing branch before making changes in the repo."""
if self.print_outbuf:
print_stdout = True
@ -1244,22 +1231,7 @@ class GitWrapper(SCMWrapper):
parent_dir = os.path.dirname(self.checkout_path)
gclient_utils.safe_makedirs(parent_dir)
if in_cog_workspace:
clone_cmd = ['citc', 'clone-repo', url, self.checkout_path]
clone_cmd.append(
gclient_utils.ExtractRefName(self.remote, revision) or revision)
try:
self._Run(clone_cmd,
options,
cwd=self._root_dir,
retry=True,
print_stdout=print_stdout,
filter_fn=filter_fn)
except:
traceback.print_exc(file=self.out_fh)
raise
self._SetFetchConfig(options)
elif hasattr(options, 'no_history') and options.no_history:
if hasattr(options, 'no_history') and options.no_history:
self._Run(['init', self.checkout_path], options, cwd=self._root_dir)
self._Run(['remote', 'add', 'origin', url], options)
revision = self._AutoFetchRef(options, revision, depth=1)

@ -237,28 +237,6 @@ from :3
class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
@mock.patch('gclient_scm.GitWrapper._IsCog')
@mock.patch('gclient_scm.GitWrapper._Run', return_value=True)
@mock.patch('gclient_scm.GitWrapper._SetFetchConfig')
@mock.patch('gclient_scm.GitWrapper._GetCurrentBranch')
def testCloneInCog(self, mockGetCurrentBranch, mockSetFetchConfig, mockRun,
_mockIsCog):
"""Test that we call the correct commands when in a cog workspace."""
if not self.enabled:
return
options = self.Options()
scm = gclient_scm.GitWrapper(self.url, self.root_dir, self.relpath)
scm._Clone('123123ab', self.url, options)
mockRun.assert_called_once_with(
['citc', 'clone-repo', self.url, scm.checkout_path, '123123ab'],
options,
cwd=scm._root_dir,
retry=True,
print_stdout=False,
filter_fn=scm.filter)
mockSetFetchConfig.assert_called_once()
mockGetCurrentBranch.assert_called_once()
def testRevertMissing(self):
if not self.enabled:
return

Loading…
Cancel
Save