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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if overriden_url != url: | 184 if overriden_url != url: |
185 self.parsed_url = overriden_url | 185 self.parsed_url = overriden_url |
186 logging.debug('%s, %s was overriden to %s' % (self.name, url, | 186 logging.debug('%s, %s was overriden to %s' % (self.name, url, |
187 self.parsed_url)) | 187 self.parsed_url)) |
188 elif isinstance(url, self.FromImpl): | 188 elif isinstance(url, self.FromImpl): |
189 ref = [dep for dep in self.tree(True) if url.module_name == dep.name] | 189 ref = [dep for dep in self.tree(True) if url.module_name == dep.name] |
190 if not len(ref) == 1: | 190 if not len(ref) == 1: |
191 raise Exception('Failed to find one reference to %s. %s' % ( | 191 raise Exception('Failed to find one reference to %s. %s' % ( |
192 url.module_name, ref)) | 192 url.module_name, ref)) |
193 ref = ref[0] | 193 ref = ref[0] |
194 sub_target = url.sub_target_name or url | 194 sub_target = url.sub_target_name or self.name |
195 # Make sure the referenced dependency DEPS file is loaded and file the | 195 # Make sure the referenced dependency DEPS file is loaded and file the |
196 # inner referenced dependency. | 196 # inner referenced dependency. |
197 ref.ParseDepsFile(False) | 197 ref.ParseDepsFile(False) |
198 found_dep = None | 198 found_dep = None |
199 for d in ref.dependencies: | 199 for d in ref.dependencies: |
200 if d.name == sub_target: | 200 if d.name == sub_target: |
201 found_dep = d | 201 found_dep = d |
202 break | 202 break |
203 if not found_dep: | 203 if not found_dep: |
204 raise Exception('Couldn\'t find %s in %s, referenced by %s' % ( | 204 raise Exception('Couldn\'t find %s in %s, referenced by %s' % ( |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 entries = sorted(self.tree(False), key=lambda i: i.name) | 745 entries = sorted(self.tree(False), key=lambda i: i.name) |
746 for entry in entries: | 746 for entry in entries: |
747 entry_url = GetURLAndRev(entry.name, entry.parsed_url) | 747 entry_url = GetURLAndRev(entry.name, entry.parsed_url) |
748 line = '%s: %s' % (entry.name, entry_url) | 748 line = '%s: %s' % (entry.name, entry_url) |
749 if not entry is entries[-1]: | 749 if not entry is entries[-1]: |
750 line += ';' | 750 line += ';' |
751 print line | 751 print line |
752 | 752 |
753 def ParseDepsFile(self, direct_reference): | 753 def ParseDepsFile(self, direct_reference): |
754 """No DEPS to parse for a .gclient file.""" | 754 """No DEPS to parse for a .gclient file.""" |
755 self.direct_reference = direct_reference | 755 self.direct_reference = True |
756 self.deps_parsed = True | 756 self.deps_parsed = True |
757 | 757 |
758 def root_dir(self): | 758 def root_dir(self): |
759 """Root directory of gclient checkout.""" | 759 """Root directory of gclient checkout.""" |
760 return self._root_dir | 760 return self._root_dir |
761 | 761 |
762 def enforced_os(self): | 762 def enforced_os(self): |
763 """What deps_os entries that are to be parsed.""" | 763 """What deps_os entries that are to be parsed.""" |
764 return self._enforced_os | 764 return self._enforced_os |
765 | 765 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 return CMDhelp(parser, argv) | 1151 return CMDhelp(parser, argv) |
1152 except gclient_utils.Error, e: | 1152 except gclient_utils.Error, e: |
1153 print >> sys.stderr, 'Error: %s' % str(e) | 1153 print >> sys.stderr, 'Error: %s' % str(e) |
1154 return 1 | 1154 return 1 |
1155 | 1155 |
1156 | 1156 |
1157 if '__main__' == __name__: | 1157 if '__main__' == __name__: |
1158 sys.exit(Main(sys.argv[1:])) | 1158 sys.exit(Main(sys.argv[1:])) |
1159 | 1159 |
1160 # vim: ts=2:sw=2:tw=80:et: | 1160 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |