| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. | 
| 7 | 7 | 
| 8 Files | 8 Files | 
| 9   .gclient      : Current client configuration, written by 'config' command. | 9   .gclient      : Current client configuration, written by 'config' command. | 
| 10                   Format is a Python script defining 'solutions', a list whose | 10                   Format is a Python script defining 'solutions', a list whose | 
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 614 | 614 | 
| 615   def SaveConfig(self): | 615   def SaveConfig(self): | 
| 616     gclient_utils.FileWrite(os.path.join(self.root_dir(), | 616     gclient_utils.FileWrite(os.path.join(self.root_dir(), | 
| 617                                          self._options.config_filename), | 617                                          self._options.config_filename), | 
| 618                             self.config_content) | 618                             self.config_content) | 
| 619 | 619 | 
| 620   @staticmethod | 620   @staticmethod | 
| 621   def LoadCurrentConfig(options): | 621   def LoadCurrentConfig(options): | 
| 622     """Searches for and loads a .gclient file relative to the current working | 622     """Searches for and loads a .gclient file relative to the current working | 
| 623     dir. Returns a GClient object.""" | 623     dir. Returns a GClient object.""" | 
| 624     cwd = os.getcwd() | 624     path = gclient_utils.FindGclientRoot(os.getcwd(), options.config_filename) | 
| 625     path = gclient_utils.FindGclientRoot(cwd, options.config_filename) |  | 
| 626     if not path: | 625     if not path: | 
| 627       return None | 626       return None | 
| 628     client = GClient(path, options) | 627     client = GClient(path, options) | 
| 629     client.SetConfig(gclient_utils.FileRead( | 628     client.SetConfig(gclient_utils.FileRead( | 
| 630         os.path.join(path, options.config_filename))) | 629         os.path.join(path, options.config_filename))) | 
| 631     if path == cwd: | 630     return client | 
| 632       return client |  | 
| 633     # Validate the current directory we are in belongs to the .gclient file we |  | 
| 634     # found. |  | 
| 635     cwd = cwd[len(path)+1:] |  | 
| 636     all_solutions = client.tree(False) |  | 
| 637     while len(cwd): |  | 
| 638       if cwd in all_solutions: |  | 
| 639         return client |  | 
| 640       cwd = os.path.dirname(cwd) |  | 
| 641     return None |  | 
| 642 | 631 | 
| 643   def SetDefaultConfig(self, solution_name, solution_url, safesync_url): | 632   def SetDefaultConfig(self, solution_name, solution_url, safesync_url): | 
| 644     self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { | 633     self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { | 
| 645       'solution_name': solution_name, | 634       'solution_name': solution_name, | 
| 646       'solution_url': solution_url, | 635       'solution_url': solution_url, | 
| 647       'safesync_url' : safesync_url, | 636       'safesync_url' : safesync_url, | 
| 648     }) | 637     }) | 
| 649 | 638 | 
| 650   def _SaveEntries(self): | 639   def _SaveEntries(self): | 
| 651     """Creates a .gclient_entries file to record the list of unique checkouts. | 640     """Creates a .gclient_entries file to record the list of unique checkouts. | 
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1239     return CMDhelp(parser, argv) | 1228     return CMDhelp(parser, argv) | 
| 1240   except gclient_utils.Error, e: | 1229   except gclient_utils.Error, e: | 
| 1241     print >> sys.stderr, 'Error: %s' % str(e) | 1230     print >> sys.stderr, 'Error: %s' % str(e) | 
| 1242     return 1 | 1231     return 1 | 
| 1243 | 1232 | 
| 1244 | 1233 | 
| 1245 if '__main__' == __name__: | 1234 if '__main__' == __name__: | 
| 1246   sys.exit(Main(sys.argv[1:])) | 1235   sys.exit(Main(sys.argv[1:])) | 
| 1247 | 1236 | 
| 1248 # vim: ts=2:sw=2:tw=80:et: | 1237 # vim: ts=2:sw=2:tw=80:et: | 
| OLD | NEW | 
|---|