module Gitlab::Client::Repositories

def commit(project, sha)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • sha (String) -- The commit hash or name of a repository branch or tag
  • project (Integer) -- The ID of a project.
def commit(project, sha)
  get("/projects/#{project}/repository/commits/#{sha}")
end

def commit_comments(project, commit, options={})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.

Parameters:
  • sha (String) -- The commit hash or name of a repository branch or tag.
  • project (Integer) -- The ID of a project.
def commit_comments(project, commit, options={})
  get("/projects/#{project}/repository/commits/#{commit}/comments", :query => options)
end

def commit_diff(project, sha)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • sha (String) -- The name of a repository branch or tag or if not given the default branch.
  • project (Integer) -- The ID of a project.
def commit_diff(project, sha)
  get("/projects/#{project}/repository/commits/#{sha}/diff")
end

def commits(project, options={})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.
  • :ref_name (String) -- The branch or tag name of a project repository.

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

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/#{project}/repository/compare", :query => {:from => from, :to => to})
end

def create_commit_comment(project, commit, note, options={})

Returns:
  • (Gitlab::ObjectifiedHash) - Information about created comment.

Options Hash: (**options)
  • :line_type (String) -- The line type (new or old).
  • :line (Integer) -- The line number.
  • :path (String) -- The file path.

Parameters:
  • options (Hash) -- A customizable set of options.
  • note (String) -- The text of a comment.
  • sha (String) -- The commit hash or name of a repository branch or tag.
  • project (Integer) -- The ID of a project.
def create_commit_comment(project, commit, note, options={})
  post("/projects/#{project}/repository/commits/#{commit}/comments", :body => options.merge(:note => note))
end

def create_tag(project, tag_name, ref, message='')

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • message (String) -- Optional message for tag, creates annotated tag if specified.
  • ref (String) -- The ref (commit sha, branch name, or another tag) the tag will point to.
  • tag_name (String) -- The name of the new tag.
  • project (Integer) -- The ID of a project.
def create_tag(project, tag_name, ref, message='')
  post("/projects/#{project}/repository/tags", body: {tag_name: tag_name, ref: ref, message: message})
end

def file_contents(project, filepath, ref = 'master')

Returns:
  • (String) -

Parameters:
  • ref (String) -- The name of a repository branch or tag or if not given the default branch.
  • filepath (String) -- The relative path of the file in the repository
  • project (Integer) -- The ID of a project.
def file_contents(project, filepath, ref = 'master')
  get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}",
    format: nil,
    headers: { Accept: 'text/plain' },
    parser: ::Gitlab::Request::Parser
end

def tags(project, options={})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.

Parameters:
  • options (Hash) -- A customizable set of options.
  • project (Integer) -- The ID of a project.
def tags(project, options={})
  get("/projects/#{project}/repository/tags", :query => options)
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) -- The ID of a project.
def tree(project, options={})
  get("/projects/#{project}/repository/tree", query: options)
end