|
|
@ -32,23 +32,6 @@ class RevisionFallbackChain(RevisionResolver):
|
|
|
|
self._default)
|
|
|
|
self._default)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectRevisionResolver(RevisionResolver):
|
|
|
|
|
|
|
|
"""Revision resolver that takes into account the project."""
|
|
|
|
|
|
|
|
def __init__(self, project, parent_got_revision=None):
|
|
|
|
|
|
|
|
self.project = project
|
|
|
|
|
|
|
|
self.parent_got_revision = parent_got_revision or 'parent_got_revision'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO(phajdan.jr): Move to proper repo and add coverage.
|
|
|
|
|
|
|
|
def resolve(self, properties): # pragma: no cover
|
|
|
|
|
|
|
|
"""Resolve the revision if project matches, otherwise default to HEAD."""
|
|
|
|
|
|
|
|
if properties.get('project') == self.project:
|
|
|
|
|
|
|
|
return (properties.get(self.parent_got_revision) or
|
|
|
|
|
|
|
|
properties.get('revision') or
|
|
|
|
|
|
|
|
'HEAD')
|
|
|
|
|
|
|
|
return (properties.get(self.parent_got_revision) or
|
|
|
|
|
|
|
|
'HEAD')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def jsonish_to_python(spec, is_top=False):
|
|
|
|
def jsonish_to_python(spec, is_top=False):
|
|
|
|
"""Turn a json spec into a python parsable object.
|
|
|
|
"""Turn a json spec into a python parsable object.
|
|
|
|
|
|
|
|
|
|
|
|