def get_archive(hostname, project, treeish, dir_path=None, **fetch_kwargs): """Gets a directory as a tar.gz archive or None if not found.""" _validate_args(hostname, project, treeish, dir_path) dir_path = (dir_path or '').strip('/') if dir_path: dir_path = '/%s' % dir_path return gerrit.fetch( hostname, '%s/+archive/%s%s.tar.gz' % (project, treeish, dir_path), **fetch_kwargs)
def get_archive(hostname, project, treeish, dir_path=None): """Gets a directory as a tar.gz archive.""" assert project assert treeish dir_path = (dir_path or '').strip('/') if dir_path: dir_path = '/./%s' % dir_path res = gerrit.fetch( hostname, '%s/+archive/%s%s.tar.gz' % (project, treeish, dir_path)) return res.content if res else None
def get_file_content(hostname, project, treeish, path, **fetch_kwargs): """Gets file contents. Returns: Raw contents of the file or None if not found. """ _validate_args(hostname, project, treeish, path, path_required=True) data = gerrit.fetch(hostname, '%s/+/%s%s' % (project, treeish, path), headers={'Accept': 'text/plain'}, **fetch_kwargs) return base64.b64decode(data) if data is not None else None
def get_file_content(hostname, project, treeish, path, **fetch_kwargs): """Gets file contents. Returns: Raw contents of the file or None if not found. """ _validate_args(hostname, project, treeish, path, path_required=True) data = gerrit.fetch( hostname, '%s/+/%s%s' % (project, treeish, path), headers={'Accept': 'text/plain'}, **fetch_kwargs) return base64.b64decode(data) if data is not None else None
def get_file_content(hostname, project, treeish, path): """Gets file contents. Returns: Raw contents of the file. """ assert hostname assert project assert treeish assert path assert path.startswith('/') data = gerrit.fetch( hostname, '%s/+/%s/.%s' % (project, treeish, path), accept_header='text/plain').content if data is None: return None return base64.b64decode(data)