| 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 return self.backend.updates( | 212 spec = self.spec_pb() |
| 213 self.revision, self.backend.resolve_refspec(self._branch_for_remote)) | 213 |
| 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) |
| 214 | 224 |
| 215 def _components(self): | 225 def _components(self): |
| 216 return (self.project_id, self.repo, self.revision, self.path) | 226 return (self.project_id, self.repo, self.revision, self.path) |
| 217 | 227 |
| 218 def __eq__(self, other): | 228 def __eq__(self, other): |
| 219 if not isinstance(other, type(self)): | 229 if not isinstance(other, type(self)): |
| 220 return False | 230 return False |
| 221 return self._components() == other._components() | 231 return self._components() == other._components() |
| 222 | 232 |
| 223 | 233 |
| 224 class PathRepoSpec(RepoSpec): | 234 class PathRepoSpec(RepoSpec): |
| 225 """A RepoSpec implementation that uses a local filesystem path.""" | 235 """A RepoSpec implementation that uses a local filesystem path.""" |
| 226 | 236 |
| 227 def __init__(self, project_id, path): | 237 def __init__(self, project_id, path): |
| 228 self.project_id = project_id | 238 self.project_id = project_id |
| 229 self.path = path | 239 self.path = path |
| 230 | 240 |
| 231 def __str__(self): | 241 def __str__(self): |
| 232 return ( | 242 return ( |
| 233 'PathRepoSpec{project_id="%(project_id)s", path="%(path)s"}' | 243 'PathRepoSpec{project_id="%(project_id)s", path="%(path)s"}' |
| 234 % self.__dict__ | 244 % self.__dict__ |
| 235 ) | 245 ) |
| 236 | 246 |
| 237 def current(self): | 247 def current(self): |
| 238 return fetch.CommitMetadata( | 248 return fetch.CommitMetadata( |
| 239 '', | 249 '', |
| 240 '', | 250 '', |
| 241 0, | 251 0, |
| 242 (), | 252 (), |
| 243 self.spec_pb(), | 253 self.spec_pb() |
| 244 False | |
| 245 ) | 254 ) |
| 246 | 255 |
| 247 def updates(self): | 256 def updates(self): |
| 248 return [] | 257 return [] |
| 249 | 258 |
| 250 def fetch(self): | 259 def fetch(self): |
| 251 pass | 260 pass |
| 252 | 261 |
| 253 def checkout(self, context): | 262 def checkout(self, context): |
| 254 pass | 263 pass |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 511 |
| 503 @property | 512 @property |
| 504 def packages(self): | 513 def packages(self): |
| 505 for p in self._packages.values(): | 514 for p in self._packages.values(): |
| 506 yield p | 515 yield p |
| 507 | 516 |
| 508 @property | 517 @property |
| 509 def engine_recipes_py(self): | 518 def engine_recipes_py(self): |
| 510 return os.path.join( | 519 return os.path.join( |
| 511 self._packages['recipe_engine'].repo_root, 'recipes.py') | 520 self._packages['recipe_engine'].repo_root, 'recipes.py') |
| OLD | NEW |