diff --git a/gclient.py b/gclient.py index c1d23b4f8..8ee5bf125 100755 --- a/gclient.py +++ b/gclient.py @@ -1574,6 +1574,17 @@ def _detect_host_os(): class GitDependency(Dependency): """A Dependency object that represents a single git checkout.""" + _is_env_cog = None + + @staticmethod + def _IsCog(): + """Returns true if the env is cog""" + if GitDependency._is_env_cog is None: + GitDependency._is_env_cog = os.getcwd().startswith( + '/google/cog/cloud') + + return GitDependency._is_env_cog + @staticmethod def updateProtocol(url, protocol): """Updates given URL's protocol""" @@ -1592,6 +1603,9 @@ class GitDependency(Dependency): #override def CreateSCM(self, out_cb=None): """Create a Wrapper instance suitable for handling this git dependency.""" + if self._IsCog(): + return gclient_scm.CogWrapper() + return gclient_scm.GitWrapper(self.url, self.root.root_dir, self.name, diff --git a/gclient_scm.py b/gclient_scm.py index ceb58dc9e..e0b7b259d 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1932,3 +1932,42 @@ class CipdWrapper(SCMWrapper): CIPD packages should be updated at the root by running `CipdRoot.run('update')`. """ + + +class CogWrapper(SCMWrapper): + """Wrapper for Cog, all no-op.""" + name = 'cog' + + def __init__(self): + super(CogWrapper, self).__init__() + + #override + def GetCacheMirror(self): + return None + + #override + def GetActualRemoteURL(self, options): + return None + + #override + def DoesRemoteURLMatch(self, options): + del options + return True + + def revert(self, options, args, file_list): + pass + + def diff(self, options, args, file_list): + pass + + def pack(self, options, args, file_list): + pass + + def revinfo(self, options, args, file_list): + pass + + def status(self, options, args, file_list): + pass + + def update(self, options, args, file_list): + pass