def __init__(self, path): log.info('Loading repository %s...' % path) self.verify(path) super(Repository, self).__init__(path) self.config = cfgparse.Config(os.path.join(self.path, self._config)) self.versions = version.Collection( os.path.join(self.path, self._versions)) log.info('Repository %s loaded successfully' % path) log.debug('Config: %r' % self.config.to_dict())
def has_revision(self, rev_id): collection = migrate_version.Collection(self.repository) try: collection.version(rev_id) return True except (KeyError, ValueError): # NOTE(breton): migrate raises KeyError if an int is passed but not # found in the list of revisions and ValueError if non-int is # passed. Both mean there is no requested revision. return False