diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-01-21 16:54:16 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-01-21 17:04:00 +0100 |
commit | ee666fd57e5cb100b6e195bb74228ac242d8932a (patch) | |
tree | 58ad29ae3a7f0c113a76f2b04e0767445f3e83d5 /docs/gl_objects | |
parent | 04435e1b13166fb45216c494f3af4d9bdb76bcaf (diff) | |
download | gitlab-ee666fd57e5cb100b6e195bb74228ac242d8932a.tar.gz |
Add support for commit creation
Fixes #206
Diffstat (limited to 'docs/gl_objects')
-rw-r--r-- | docs/gl_objects/commits.py | 20 | ||||
-rw-r--r-- | docs/gl_objects/commits.rst | 31 |
2 files changed, 37 insertions, 14 deletions
diff --git a/docs/gl_objects/commits.py b/docs/gl_objects/commits.py index 3046513..2ed66f5 100644 --- a/docs/gl_objects/commits.py +++ b/docs/gl_objects/commits.py @@ -9,6 +9,26 @@ commits = project.commits.list(ref_name='my_branch') commits = project.commits.list(since='2016-01-01T00:00:00Z') # end filter list +# create +# See https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions +# for actions detail +data = { + 'branch_name': 'master', + 'commit_message': 'blah blah blah', + 'actions': [ + { + 'action': 'create', + 'file_path': 'blah', + 'content': 'blah' + } + ] +} + +commit = gl.project_commits.create(data, project_id=1) +# or +commit = project.commits.create(data) +# end commit + # get commit = gl.project_commits.get('e3d5a71b', project_id=1) # or diff --git a/docs/gl_objects/commits.rst b/docs/gl_objects/commits.rst index 5a43597..8be1b86 100644 --- a/docs/gl_objects/commits.rst +++ b/docs/gl_objects/commits.rst @@ -5,10 +5,9 @@ Commits Commits ======= -Use :class:`~gitlab.objects.ProjectCommit` objects to manipulate commits. The -:attr:`gitlab.Gitlab.project_commits` and -:attr:`gitlab.objects.Project.commits` manager objects provide helper -functions. +* Object class: :class:`~gitlab.objects.ProjectCommit` +* Manager objects: :attr:`gitlab.Gitlab.project_commits`, + :attr:`gitlab.objects.Project.commits` Examples -------- @@ -26,6 +25,12 @@ results: :start-after: # filter list :end-before: # end filter list +Create a commit: + +.. literalinclude:: commits.py + :start-after: # create + :end-before: # end create + Get a commit detail: .. literalinclude:: commits.py @@ -41,11 +46,10 @@ Get the diff for a commit: Commit comments =============== -Use :class:`~gitlab.objects.ProjectCommitStatus` objects to manipulate commits. The -:attr:`gitlab.Gitlab.project_commit_comments` and -:attr:`gitlab.objects.Project.commit_comments` and -:attr:`gitlab.objects.ProjectCommit.comments` manager objects provide helper -functions. +* Object class: :class:`~gitlab.objects.ProjectCommiComment` +* Manager objects: :attr:`gitlab.Gitlab.project_commit_comments`, + :attr:`gitlab.objects.Project.commit_comments`, + :attr:`gitlab.objects.ProjectCommit.comments` Examples -------- @@ -65,11 +69,10 @@ Add a comment on a commit: Commit status ============= -Use :class:`~gitlab.objects.ProjectCommitStatus` objects to manipulate commits. -The :attr:`gitlab.Gitlab.project_commit_statuses`, -:attr:`gitlab.objects.Project.commit_statuses` and -:attr:`gitlab.objects.ProjectCommit.statuses` manager objects provide helper -functions. +* Object class: :class:`~gitlab.objects.ProjectCommitStatus` +* Manager objects: :attr:`gitlab.Gitlab.project_commit_statuses`, + :attr:`gitlab.objects.Project.commit_statuses`, + :attr:`gitlab.objects.ProjectCommit.statuses` Examples -------- |