| 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 copy | 5 import copy |
| 6 import errno | 6 import errno |
| 7 import logging | 7 import logging |
| 8 import operator | 8 import operator |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 def current(self): | 203 def current(self): |
| 204 return self.backend.commit_metadata(self.revision) | 204 return self.backend.commit_metadata(self.revision) |
| 205 | 205 |
| 206 def updates(self): | 206 def updates(self): |
| 207 """Returns a list of revisions on the branch between the pinned revision | 207 """Returns a list of revisions on the branch between the pinned revision |
| 208 and the tracked branch. | 208 and the tracked branch. |
| 209 | 209 |
| 210 Returns list(CommitMetadata) | 210 Returns list(CommitMetadata) |
| 211 """ | 211 """ |
| 212 spec = self.spec_pb() | 212 return self.backend.updates( |
| 213 | 213 self.revision, self.backend.resolve_refspec(self._branch_for_remote)) |
| 214 paths = [] | |
| 215 subdir = spec.recipes_path | |
| 216 if subdir: | |
| 217 # We add package_file to the list of paths to check because it might | |
| 218 # contain other upstream rolls, which we want. | |
| 219 paths.extend([subdir + os.path.sep, | |
| 220 InfraRepoConfig().relative_recipes_cfg]) | |
| 221 | |
| 222 other_revision = self.backend.resolve_refspec(self._branch_for_remote) | |
| 223 return self.backend.updates(self.revision, other_revision, paths) | |
| 224 | 214 |
| 225 def _components(self): | 215 def _components(self): |
| 226 return (self.project_id, self.repo, self.revision, self.path) | 216 return (self.project_id, self.repo, self.revision, self.path) |
| 227 | 217 |
| 228 def __eq__(self, other): | 218 def __eq__(self, other): |
| 229 if not isinstance(other, type(self)): | 219 if not isinstance(other, type(self)): |
| 230 return False | 220 return False |
| 231 return self._components() == other._components() | 221 return self._components() == other._components() |
| 232 | 222 |
| 233 | 223 |
| 234 class PathRepoSpec(RepoSpec): | 224 class PathRepoSpec(RepoSpec): |
| 235 """A RepoSpec implementation that uses a local filesystem path.""" | 225 """A RepoSpec implementation that uses a local filesystem path.""" |
| 236 | 226 |
| 237 def __init__(self, project_id, path): | 227 def __init__(self, project_id, path): |
| 238 self.project_id = project_id | 228 self.project_id = project_id |
| 239 self.path = path | 229 self.path = path |
| 240 | 230 |
| 241 def __str__(self): | 231 def __str__(self): |
| 242 return ( | 232 return ( |
| 243 'PathRepoSpec{project_id="%(project_id)s", path="%(path)s"}' | 233 'PathRepoSpec{project_id="%(project_id)s", path="%(path)s"}' |
| 244 % self.__dict__ | 234 % self.__dict__ |
| 245 ) | 235 ) |
| 246 | 236 |
| 247 def current(self): | 237 def current(self): |
| 248 return fetch.CommitMetadata( | 238 return fetch.CommitMetadata( |
| 249 '', | 239 '', |
| 250 '', | 240 '', |
| 251 0, | 241 0, |
| 252 (), | 242 (), |
| 253 self.spec_pb() | 243 self.spec_pb(), |
| 244 False |
| 254 ) | 245 ) |
| 255 | 246 |
| 256 def updates(self): | 247 def updates(self): |
| 257 return [] | 248 return [] |
| 258 | 249 |
| 259 def fetch(self): | 250 def fetch(self): |
| 260 pass | 251 pass |
| 261 | 252 |
| 262 def checkout(self, context): | 253 def checkout(self, context): |
| 263 pass | 254 pass |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 502 |
| 512 @property | 503 @property |
| 513 def packages(self): | 504 def packages(self): |
| 514 for p in self._packages.values(): | 505 for p in self._packages.values(): |
| 515 yield p | 506 yield p |
| 516 | 507 |
| 517 @property | 508 @property |
| 518 def engine_recipes_py(self): | 509 def engine_recipes_py(self): |
| 519 return os.path.join( | 510 return os.path.join( |
| 520 self._packages['recipe_engine'].repo_root, 'recipes.py') | 511 self._packages['recipe_engine'].repo_root, 'recipes.py') |
| OLD | NEW |