module Gitlab::Client::Repositories

def compare(project, from, to)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • to (String) -- The commit SHA or branch name of to branch.
  • from (String) -- The commit SHA or branch name of from branch.
  • project (Integer) -- The ID of a project.
def compare(project, from, to)
  get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
end

def merge_base(project, refs)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • refs (Array) -- Array containing 2 commit SHAs, branch names, or tags.
  • project (Integer, String) -- The ID or URL-encoded path of the project.
def merge_base(project, refs)
  get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs })
end

def repo_archive(project, ref = 'master')

Returns:
  • (Gitlab::FileResponse) -

Parameters:
  • ref (String) -- The commit sha, branch, or tag to download.
  • project (Integer, String) -- The ID or name of a project.
def repo_archive(project, ref = 'master')
  get("/projects/#{url_encode project}/repository/archive",
      format: nil,
      headers: { Accept: 'application/octet-stream' },
      query: { sha: ref },
      parser: proc { |body, _|
        if body.encoding == Encoding::ASCII_8BIT # binary response
          ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
        else # error with json response
          ::Gitlab::Request.parse(body)
        end
      })
end

def tree(project, options = {})

Returns:
  • (Gitlab::ObjectifiedHash) -

Options Hash: (**options)
  • :ref_name (String) -- The name of a repository branch or tag.
  • :path (String) -- The path inside repository.

Parameters:
  • options (Hash) -- A customizable set of options.
  • project (Integer, String) -- The ID or name of a project.
def tree(project, options = {})
  get("/projects/#{url_encode project}/repository/tree", query: options)
end