Left: | ||
Right: |
OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding: utf-8 | 2 # coding: utf-8 |
3 | 3 |
4 # This Source Code Form is subject to the terms of the Mozilla Public | 4 # This Source Code Form is subject to the terms of the Mozilla Public |
5 # License, v. 2.0. If a copy of the MPL was not distributed with this | 5 # License, v. 2.0. If a copy of the MPL was not distributed with this |
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
7 | 7 |
8 import sys | 8 import sys |
9 import os | 9 import os |
10 import posixpath | 10 import posixpath |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 | 233 |
234 if type in revisions: | 234 if type in revisions: |
235 revision = revisions[type] | 235 revision = revisions[type] |
236 elif "*" in revisions: | 236 elif "*" in revisions: |
237 revision = revisions["*"] | 237 revision = revisions["*"] |
238 else: | 238 else: |
239 logging.warning("No revision specified for repository %s (type %s), skipping update" % (target, type)) | 239 logging.warning("No revision specified for repository %s (type %s), skipping update" % (target, type)) |
240 return | 240 return |
241 | 241 |
242 resolved_revision = repo_types[type].get_revision_id(target, revision) | 242 resolved_revision = repo_types[type].get_revision_id(target, revision) |
243 current_revision = repo_types[type].get_revision_id(target) | |
244 | |
245 if (resolved_revision != current_revision and | |
Sebastian Noack
2015/05/07 13:17:19
I think the code structure below below can be simp
kzar
2015/05/07 13:44:29
Done.
| |
246 os.environ.get("SKIP_ENSURE_DEPENDENCIES", "").lower() not in ("", "0", "f alse")): | |
Sebastian Noack
2015/05/07 13:17:19
We agreed on SKIP_DEPENDENCY_UPDATES rather than S
kzar
2015/05/07 13:44:29
Done.
| |
247 logging.warning("SKIP_ENSURE_DEPENDENCIES environment variable set, " | |
248 "%s not checked out to %s" % (target, revision)) | |
249 return | |
250 | |
243 if not resolved_revision: | 251 if not resolved_revision: |
244 logging.info("Revision %s is unknown, downloading remote changes" % revision ) | 252 logging.info("Revision %s is unknown, downloading remote changes" % revision ) |
245 repo_types[type].pull(target) | 253 repo_types[type].pull(target) |
246 resolved_revision = repo_types[type].get_revision_id(target, revision) | 254 resolved_revision = repo_types[type].get_revision_id(target, revision) |
247 if not resolved_revision: | 255 if not resolved_revision: |
248 raise Exception("Failed to resolve revision %s" % revision) | 256 raise Exception("Failed to resolve revision %s" % revision) |
249 | 257 |
250 current_revision = repo_types[type].get_revision_id(target) | |
251 if resolved_revision != current_revision: | 258 if resolved_revision != current_revision: |
252 logging.info("Updating repository %s to revision %s" % (target, resolved_rev ision)) | 259 logging.info("Updating repository %s to revision %s" % (target, resolved_rev ision)) |
253 repo_types[type].update(target, resolved_revision) | 260 repo_types[type].update(target, resolved_revision) |
254 | 261 |
255 def resolve_deps(repodir, level=0, self_update=True, overrideroots=None, skipdep endencies=set()): | 262 def resolve_deps(repodir, level=0, self_update=True, overrideroots=None, skipdep endencies=set()): |
256 config = read_deps(repodir) | 263 config = read_deps(repodir) |
257 if config is None: | 264 if config is None: |
258 if level == 0: | 265 if level == 0: |
259 logging.warning("No dependencies file in directory %s, nothing to do...\n% s" % (repodir, USAGE)) | 266 logging.warning("No dependencies file in directory %s, nothing to do...\n% s" % (repodir, USAGE)) |
260 return | 267 return |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 args = parser.parse_args() | 324 args = parser.parse_args() |
318 | 325 |
319 if args.quiet: | 326 if args.quiet: |
320 logging.disable(logging.INFO) | 327 logging.disable(logging.INFO) |
321 | 328 |
322 repos = args.repos | 329 repos = args.repos |
323 if not len(repos): | 330 if not len(repos): |
324 repos = [os.path.dirname(__file__)] | 331 repos = [os.path.dirname(__file__)] |
325 for repo in repos: | 332 for repo in repos: |
326 resolve_deps(repo) | 333 resolve_deps(repo) |
OLD | NEW |