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 contributors(project, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :sort (String) -- Sort order asc or desc (default = asc).
  • :order_by (String) -- Order by name, email or commits (default = commits).

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

def generate_changelog(project, version, options = {})

Returns:
  • (bool) -

Options Hash: (**options)
  • :message (String) -- The commit message to produce when committing the changes
  • :file (String) -- The file to commit the changes to
  • :trailer (String) -- The Git trailer to use for including commits
  • :branch (String) -- The branch to commit the changelog changes to
  • :date (String) -- The date and time of the release, defaults to the current time
  • :to (String) -- The end of the range of commits (as a SHA) to use for the changelog
  • :from (String) -- The start of the range of commits (SHA)

Parameters:
  • options (Hash) -- A customizable set of options
  • version (String) -- The version to generate the changelog for
  • project (Integer, String) -- The ID or name of a project
def generate_changelog(project, version, options = {})
  post("/projects/#{url_encode project}/repository/changelog", body: options.merge(version: version))
end

def get_changelog(project, version, options = {})

Returns:
  • (Gitlab::ObjectifiedHash) -

Options Hash: (**options)
  • :trailer (String) -- The Git trailer to use for including commits
  • :date (String) -- The date and time of the release, defaults to the current time
  • :to (String) -- The end of the range of commits (as a SHA) to use for the changelog
  • :from (String) -- The start of the range of commits (SHA)

Parameters:
  • options (Hash) -- A customizable set of options
  • version (String) -- The version to generate the changelog for
  • project (Integer, String) -- The ID or name of a project
def get_changelog(project, version, options = {})
  get("/projects/#{url_encode project}/repository/changelog", body: options.merge(version: version))
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', format = 'tar.gz')

Returns:
  • (Gitlab::FileResponse) -

Parameters:
  • format (String) -- The archive format. Options are: tar.gz (default), tar.bz2, tbz, tbz2, tb2, bz2, tar, and zip
  • 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', format = 'tar.gz')
  get("/projects/#{url_encode project}/repository/archive.#{format}",
      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)
  • :per_page (Integer) -- Number of results to show per page (default = 20)
  • :ref (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