OLD | NEW |
---|---|
1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 import ast | |
6 import collections | |
7 import contextlib | |
8 import copy | 5 import copy |
9 import difflib | 6 import difflib |
10 import functools | |
11 import itertools | |
12 import logging | 7 import logging |
13 import operator | 8 import operator |
14 import os | 9 import os |
15 import subprocess | 10 import subprocess |
16 import sys | 11 import sys |
17 import tempfile | |
18 | 12 |
19 from . import env | 13 from . import env |
20 | 14 |
21 from google.protobuf import text_format | 15 from google.protobuf import text_format |
22 from . import package_pb2 | 16 from . import package_pb2 |
23 from . import fetch | 17 from . import fetch |
24 | 18 |
25 | 19 |
26 class InconsistentDependencyGraphError(Exception): | 20 class InconsistentDependencyGraphError(Exception): |
27 def __init__(self, project_id, specs): | 21 def __init__(self, project_id, specs): |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 return buf | 216 return buf |
223 | 217 |
224 def updates(self, context, other_revision=None): | 218 def updates(self, context, other_revision=None): |
225 """Returns a list of all updates to the branch since the revision this | 219 """Returns a list of all updates to the branch since the revision this |
226 repo spec refers to. | 220 repo spec refers to. |
227 """ | 221 """ |
228 raw_updates = self.raw_updates( | 222 raw_updates = self.raw_updates( |
229 context, (other_revision or self.backend.branch_spec(self.branch))) | 223 context, (other_revision or self.backend.branch_spec(self.branch))) |
230 updates = [] | 224 updates = [] |
231 for rev in raw_updates: | 225 for rev in raw_updates: |
226 # TODO(somebody): 'info' is not used. | |
232 info = self._get_commit_info(rev, context) | 227 info = self._get_commit_info(rev, context) |
Vadim Sh.
2017/02/21 05:46:26
Looks like unnecessary call, unless self.backend a
| |
233 updates.append(GitRepoSpec( | 228 updates.append(GitRepoSpec( |
234 self.project_id, | 229 self.project_id, |
235 self.repo, | 230 self.repo, |
236 self.branch, | 231 self.branch, |
237 rev, | 232 rev, |
238 self.path, | 233 self.path, |
239 self.backend)) | 234 self.backend)) |
240 return updates | 235 return updates |
241 | 236 |
242 def commit_infos(self, context, other_revision): | 237 def commit_infos(self, context, other_revision): |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 361 |
367 This is accessed by loader.py through RecipeDeps.get_package. | 362 This is accessed by loader.py through RecipeDeps.get_package. |
368 """ | 363 """ |
369 def __init__(self, name, repo_spec, deps, repo_root, relative_recipes_dir): | 364 def __init__(self, name, repo_spec, deps, repo_root, relative_recipes_dir): |
370 self.name = name | 365 self.name = name |
371 self.repo_spec = repo_spec | 366 self.repo_spec = repo_spec |
372 self.deps = deps | 367 self.deps = deps |
373 self.repo_root = repo_root | 368 self.repo_root = repo_root |
374 self.relative_recipes_dir = relative_recipes_dir | 369 self.relative_recipes_dir = relative_recipes_dir |
375 | 370 |
376 def __repr__(self): | |
Vadim Sh.
2017/02/21 05:46:26
was defined twice (second definition on line 404,
| |
377 return '<Package(name=%r,repo_spec=%r,deps=%r,recipes_dir=%r)>' % ( | |
378 self.name, self.repo_spec, self.deps, self.recipes_dir) | |
379 | |
380 @property | 371 @property |
381 def recipes_dir(self): | 372 def recipes_dir(self): |
382 return os.path.join(self.repo_root, self.relative_recipes_dir) | 373 return os.path.join(self.repo_root, self.relative_recipes_dir) |
383 | 374 |
384 @property | 375 @property |
385 def recipe_dir(self): | 376 def recipe_dir(self): |
386 return os.path.join(self.recipes_dir, 'recipes') | 377 return os.path.join(self.recipes_dir, 'recipes') |
387 | 378 |
388 @property | 379 @property |
389 def module_dir(self): | 380 def module_dir(self): |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 >>> d = { 'x': 1, 'y': 2 } | 683 >>> d = { 'x': 1, 'y': 2 } |
693 >>> sorted(_updated(d, { 'y': 3, 'z': 4 }).items()) | 684 >>> sorted(_updated(d, { 'y': 3, 'z': 4 }).items()) |
694 [('x', 1), ('y', 3), ('z', 4)] | 685 [('x', 1), ('y', 3), ('z', 4)] |
695 >>> sorted(d.items()) | 686 >>> sorted(d.items()) |
696 [('x', 1), ('y', 2)] | 687 [('x', 1), ('y', 2)] |
697 """ | 688 """ |
698 | 689 |
699 d = copy.copy(d) | 690 d = copy.copy(d) |
700 d.update(updates) | 691 d.update(updates) |
701 return d | 692 return d |
OLD | NEW |