Esempio n. 1
0
def get_archive_async(
    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_async(
      hostname,
      '%s/+archive/%s%s.tar.gz' % _quote_all(project, treeish, dir_path),
      **fetch_kwargs)
Esempio n. 2
0
def get_archive_async(
    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_async(
      hostname,
      '%s/+archive/%s%s.tar.gz' % _quote_all(project, treeish, dir_path),
      **fetch_kwargs)
Esempio n. 3
0
def get_file_content_async(
    hostname, project, treeish, path, cmd='', **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 = yield gerrit.fetch_async(
      hostname,
      '%s/+%s/%s%s' % _quote_all(project, cmd, treeish, path),
      headers={'Accept': 'text/plain'},
      **fetch_kwargs)
  raise ndb.Return(base64.b64decode(data) if data is not None else None)
Esempio n. 4
0
def get_file_content_async(
    hostname, project, treeish, path, cmd='', **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 = yield gerrit.fetch_async(
      hostname,
      '%s/+%s/%s%s' % _quote_all(project, cmd, treeish, path),
      headers={'Accept': 'text/plain'},
      **fetch_kwargs)
  raise ndb.Return(base64.b64decode(data) if data is not None else None)
Esempio n. 5
0
def get_diff_async(hostname, project, from_commit, to_commit, path,
                   **fetch_kwargs):
    """Loads diff between two treeishes.

  Returns:
    A patch.
  """
    _validate_args(hostname, project, from_commit, path)
    _validate_treeish(to_commit)
    path = (path or '').strip('/')
    data = yield gerrit.fetch_async(
        hostname,
        '%s/+/%s..%s/%s' % _quote_all(project, from_commit, to_commit, path),
        headers={'Accept': 'text/plain'},
        **fetch_kwargs)
    raise ndb.Return(base64.b64decode(data) if data is not None else None)
Esempio n. 6
0
def get_diff_async(
    hostname, project, from_commit, to_commit, path, **fetch_kwargs):
  """Loads diff between two treeishes.

  Returns:
    A patch.
  """
  _validate_args(hostname, project, from_commit, path)
  _validate_treeish(to_commit)
  path = (path or '').strip('/')
  data = yield gerrit.fetch_async(
      hostname,
      '%s/+/%s..%s/%s' % _quote_all(project, from_commit, to_commit, path),
      headers={'Accept': 'text/plain'},
      **fetch_kwargs)
  raise ndb.Return(base64.b64decode(data) if data is not None else None)