|
|
@ -621,13 +621,24 @@ solutions = [
|
|
|
|
def LoadCurrentConfig(options):
|
|
|
|
def LoadCurrentConfig(options):
|
|
|
|
"""Searches for and loads a .gclient file relative to the current working
|
|
|
|
"""Searches for and loads a .gclient file relative to the current working
|
|
|
|
dir. Returns a GClient object."""
|
|
|
|
dir. Returns a GClient object."""
|
|
|
|
path = gclient_utils.FindGclientRoot(os.getcwd(), options.config_filename)
|
|
|
|
cwd = os.getcwd()
|
|
|
|
|
|
|
|
path = gclient_utils.FindGclientRoot(cwd, options.config_filename)
|
|
|
|
if not path:
|
|
|
|
if not path:
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
client = GClient(path, options)
|
|
|
|
client = GClient(path, options)
|
|
|
|
client.SetConfig(gclient_utils.FileRead(
|
|
|
|
client.SetConfig(gclient_utils.FileRead(
|
|
|
|
os.path.join(path, options.config_filename)))
|
|
|
|
os.path.join(path, options.config_filename)))
|
|
|
|
return client
|
|
|
|
if path == cwd:
|
|
|
|
|
|
|
|
return client
|
|
|
|
|
|
|
|
# Validate the current directory we are in belongs to the .gclient file we
|
|
|
|
|
|
|
|
# found.
|
|
|
|
|
|
|
|
cwd = cwd[len(path)+1:]
|
|
|
|
|
|
|
|
all_solutions = [d.name for d in client.tree(False)]
|
|
|
|
|
|
|
|
while len(cwd):
|
|
|
|
|
|
|
|
if cwd in all_solutions:
|
|
|
|
|
|
|
|
return client
|
|
|
|
|
|
|
|
cwd = os.path.dirname(cwd)
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def SetDefaultConfig(self, solution_name, solution_url, safesync_url):
|
|
|
|
def SetDefaultConfig(self, solution_name, solution_url, safesync_url):
|
|
|
|
self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % {
|
|
|
|
self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % {
|
|
|
|