Module: Gitlab::Client::Repositories

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/repositories.rb

Overview

Defines methods related to repositories.

Instance Method Summary collapse

Instance Method Details

#commit(project, sha) ⇒ Gitlab::ObjectifiedHash Also known as: repo_commit

Gets a specific commit identified by the commit hash or name of a branch or tag.

Examples:

Gitlab.commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
Gitlab.repo_commit(3, 'ed899a2f4b50b4370feeea94676502b42383c746')

Parameters:

  • project (Integer)

    The ID of a project.

  • sha (String)

    The commit hash or name of a repository branch or tag

Returns:



45
46
47
# File 'lib/gitlab/client/repositories.rb', line 45

def commit(project, sha)
  get("/projects/#{project}/repository/commits/#{sha}")
end

#commit_diff(project, sha) ⇒ Gitlab::ObjectifiedHash Also known as: repo_commit_diff

Get the diff of a commit in a project.

Examples:

Gitlab.commit_diff(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
Gitlab.repo_commit_diff(3, 'ed899a2f4b50b4370feeea94676502b42383c746')

Parameters:

  • project (Integer)

    The ID of a project.

  • sha (String)

    The name of a repository branch or tag or if not given the default branch.

Returns:



59
60
61
# File 'lib/gitlab/client/repositories.rb', line 59

def commit_diff(project, sha)
  get("/projects/#{project}/repository/commits/#{sha}/diff") 
end

#commits(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_commits

Gets a list of project commits.

Examples:

Gitlab.commits('viking')
Gitlab.repo_commits('gitlab', :ref_name => 'api')

Parameters:

  • project (Integer)

    The ID of a project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :ref_name (String)

    The branch or tag name of a project repository.

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



31
32
33
# File 'lib/gitlab/client/repositories.rb', line 31

def commits(project, options={})
  get("/projects/#{project}/repository/commits", :query => options)
end

#tags(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_tags

Gets a list of project repository tags.

Examples:

Gitlab.tags(42)

Parameters:

  • project (Integer)

    The ID of a project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



14
15
16
# File 'lib/gitlab/client/repositories.rb', line 14

def tags(project, options={})
  get("/projects/#{project}/repository/tags", :query => options)
end