def checkout(self, ref, ref_is_sha, pull_after_update, stdout=sys.stdout, stderr=sys.stderr): if not os.path.exists(self.root_path): common.check_execute(['mkdir', '-p', self.root_path], stdout=stdout, stderr=stderr) path = os.path.join(self.root_path, self.project['path']) if self.project['repository'] == 'Git': if os.path.exists(path): if ref_is_sha: common.git_update(self.project['url'], ref, path, incremental=self.skip_clean, stdout=stdout, stderr=stderr) else: if not self.skip_clean: common.git_clean(path, stdout=stdout, stderr=stderr) common.git_checkout(ref, path, force=True, stdout=stdout, stderr=stderr) if pull_after_update: common.git_pull(path, stdout=stdout, stderr=stderr) else: common.git_clone(self.project['url'], path, ref, stdout=stdout, stderr=stderr) else: raise common.Unreachable('Unsupported repository: %s' % self.project['repository'])
def checkout(root_path, repo, commit): """Checkout an indexed repository.""" path = os.path.join(root_path, repo['path']) if repo['repository'] == 'Git': if os.path.exists(path): return common.git_update(repo['url'], commit, path) else: return common.git_clone(repo['url'], path, tree=commit) raise common.Unreachable('Unsupported repository: %s' % repo['repository'])
def matches(spec): issue = spec['issue'].split()[0] current = { 'compatibility': compatible_version, 'branch': swift_branch, 'platform': platform } if 'configuration' in spec: if build_config is None: raise common.Unreachable("'xfail' entry contains 'configuration' " "but none supplied via '--build-config' or the containing " "action's 'configuration' field.") current['configuration'] = build_config.lower() for key, value in current.iteritems(): if key in spec and not is_or_contains(spec[key], value): return None return issue