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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 # sub deps base URL. | 108 # sub deps base URL. |
109 if not isinstance(sub_deps_base_url, basestring): | 109 if not isinstance(sub_deps_base_url, basestring): |
110 sub_deps_base_url = sub_deps_base_url.GetPath() | 110 sub_deps_base_url = sub_deps_base_url.GetPath() |
111 scm = gclient_scm.CreateSCM(sub_deps_base_url, root_dir, | 111 scm = gclient_scm.CreateSCM(sub_deps_base_url, root_dir, |
112 None) | 112 None) |
113 url = scm.FullUrlForRelativeUrl(url) | 113 url = scm.FullUrlForRelativeUrl(url) |
114 return url | 114 return url |
115 | 115 |
116 class FileImpl(object): | 116 class FileImpl(object): |
117 """Used to implement the File('') syntax which lets you sync a single file | 117 """Used to implement the File('') syntax which lets you sync a single file |
118 from an SVN repo.""" | 118 from a SVN repo.""" |
119 | 119 |
120 def __init__(self, file_location): | 120 def __init__(self, file_location): |
121 self.file_location = file_location | 121 self.file_location = file_location |
122 | 122 |
123 def __str__(self): | 123 def __str__(self): |
124 return 'File("%s")' % self.file_location | 124 return 'File("%s")' % self.file_location |
125 | 125 |
126 def GetPath(self): | 126 def GetPath(self): |
127 return os.path.split(self.file_location)[0] | 127 return os.path.split(self.file_location)[0] |
128 | 128 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 pm.update() | 614 pm.update() |
615 if type(deps[d]) == str: | 615 if type(deps[d]) == str: |
616 url = deps[d] | 616 url = deps[d] |
617 entries[d] = url | 617 entries[d] = url |
618 if run_scm: | 618 if run_scm: |
619 self._options.revision = revision_overrides.get(d) | 619 self._options.revision = revision_overrides.get(d) |
620 scm = gclient_scm.CreateSCM(url, self.root_dir(), d) | 620 scm = gclient_scm.CreateSCM(url, self.root_dir(), d) |
621 scm.RunCommand(command, self._options, args, file_list) | 621 scm.RunCommand(command, self._options, args, file_list) |
622 self._options.revision = None | 622 self._options.revision = None |
623 elif isinstance(deps[d], self.FileImpl): | 623 elif isinstance(deps[d], self.FileImpl): |
| 624 if command in (None, 'cleanup', 'diff', 'pack', 'status'): |
| 625 continue |
624 file_dep = deps[d] | 626 file_dep = deps[d] |
625 self._options.revision = file_dep.GetRevision() | 627 self._options.revision = file_dep.GetRevision() |
626 if run_scm: | 628 if run_scm: |
627 scm = gclient_scm.CreateSCM(file_dep.GetPath(), self.root_dir(), d) | 629 scm = gclient_scm.SVNWrapper(file_dep.GetPath(), self.root_dir(), d) |
628 scm.RunCommand("updatesingle", self._options, | 630 scm.RunCommand('updatesingle', self._options, |
629 args + [file_dep.GetFilename()], file_list) | 631 args + [file_dep.GetFilename()], file_list) |
630 | 632 |
631 if command == 'update' and not self._options.verbose: | 633 if command == 'update' and not self._options.verbose: |
632 pm.end() | 634 pm.end() |
633 | 635 |
634 # Second pass for inherited deps (via the From keyword) | 636 # Second pass for inherited deps (via the From keyword) |
635 for d in deps_to_process: | 637 for d in deps_to_process: |
636 if isinstance(deps[d], self.FromImpl): | 638 if isinstance(deps[d], self.FromImpl): |
637 # Getting the URL from the sub_deps file can involve having to resolve | 639 # Getting the URL from the sub_deps file can involve having to resolve |
638 # a File() or having to resolve a relative URL. To resolve relative | 640 # a File() or having to resolve a relative URL. To resolve relative |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 def Parse(args): | 1162 def Parse(args): |
1161 (options, args) = old_parser(args) | 1163 (options, args) = old_parser(args) |
1162 level = None | 1164 level = None |
1163 if options.verbose == 2: | 1165 if options.verbose == 2: |
1164 level = logging.INFO | 1166 level = logging.INFO |
1165 elif options.verbose > 2: | 1167 elif options.verbose > 2: |
1166 level = logging.DEBUG | 1168 level = logging.DEBUG |
1167 logging.basicConfig(level=level, | 1169 logging.basicConfig(level=level, |
1168 format='%(module)s(%(lineno)d) %(funcName)s:%(message)s') | 1170 format='%(module)s(%(lineno)d) %(funcName)s:%(message)s') |
1169 options.entries_filename = options.config_filename + '_entries' | 1171 options.entries_filename = options.config_filename + '_entries' |
| 1172 |
| 1173 # These hacks need to die. |
1170 if not hasattr(options, 'revisions'): | 1174 if not hasattr(options, 'revisions'): |
1171 # GClient.RunOnDeps expects it even if not applicable. | 1175 # GClient.RunOnDeps expects it even if not applicable. |
1172 options.revisions = [] | 1176 options.revisions = [] |
1173 if not hasattr(options, 'head'): | 1177 if not hasattr(options, 'head'): |
1174 options.head = None | 1178 options.head = None |
1175 if not hasattr(options, 'nohooks'): | 1179 if not hasattr(options, 'nohooks'): |
1176 options.nohooks = True | 1180 options.nohooks = True |
1177 if not hasattr(options, 'deps_os'): | 1181 if not hasattr(options, 'deps_os'): |
1178 options.deps_os = None | 1182 options.deps_os = None |
| 1183 if not hasattr(options, 'manually_grab_svn_rev'): |
| 1184 options.manually_grab_svn_rev = None |
| 1185 if not hasattr(options, 'force'): |
| 1186 options.force = None |
1179 return (options, args) | 1187 return (options, args) |
1180 parser.parse_args = Parse | 1188 parser.parse_args = Parse |
1181 # We don't want wordwrapping in epilog (usually examples) | 1189 # We don't want wordwrapping in epilog (usually examples) |
1182 parser.format_epilog = lambda _: parser.epilog or '' | 1190 parser.format_epilog = lambda _: parser.epilog or '' |
1183 if argv: | 1191 if argv: |
1184 command = Command(argv[0]) | 1192 command = Command(argv[0]) |
1185 if command: | 1193 if command: |
1186 # 'fix' the usage and the description now that we know the subcommand. | 1194 # 'fix' the usage and the description now that we know the subcommand. |
1187 GenUsage(parser, argv[0]) | 1195 GenUsage(parser, argv[0]) |
1188 return command(parser, argv[1:]) | 1196 return command(parser, argv[1:]) |
1189 # Not a known command. Default to help. | 1197 # Not a known command. Default to help. |
1190 GenUsage(parser, 'help') | 1198 GenUsage(parser, 'help') |
1191 return CMDhelp(parser, argv) | 1199 return CMDhelp(parser, argv) |
1192 except gclient_utils.Error, e: | 1200 except gclient_utils.Error, e: |
1193 print >> sys.stderr, 'Error: %s' % str(e) | 1201 print >> sys.stderr, 'Error: %s' % str(e) |
1194 return 1 | 1202 return 1 |
1195 | 1203 |
1196 | 1204 |
1197 if '__main__' == __name__: | 1205 if '__main__' == __name__: |
1198 sys.exit(Main(sys.argv[1:])) | 1206 sys.exit(Main(sys.argv[1:])) |
1199 | 1207 |
1200 # vim: ts=2:sw=2:tw=80:et: | 1208 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |