Skip to content

Commit 4d4c8ad

Browse files
author
Gauvain Pocentek
committed
Add a FAQ
1 parent a221d7b commit 4d4c8ad

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/faq.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
###
2+
FAQ
3+
###
4+
5+
I cannot edit the merge request / issue I've just retrieved
6+
It is likely that you used a ``MergeRequest``, ``GroupMergeRequest``,
7+
``Issue`` or ``GroupIssue`` object. These objects cannot be edited. But you
8+
can create a new ``ProjectMergeRequest`` or ``ProjectIssue`` object to
9+
apply changes. For example::
10+
11+
issue = gl.issues.list()[0]
12+
project = gl.projects.get(issue.project_id, lazy=True)
13+
editable_issue = project.issues.get(issue.iid, lazy=True)
14+
# you can now edit the object
15+
16+
See the :ref:`merge requests example <merge_requests_examples>` and the
17+
:ref:`issues examples <issues_examples>`.
18+
19+
How can I clone the repository of a project?
20+
python-gitlab doesn't provide an API to clone a project. You have to use a
21+
git library or call the ``git`` command.
22+
23+
The git URI is exposed in the ``ssh_url_to_repo`` attribute of ``Project``
24+
objects.
25+
26+
Example::
27+
28+
import subprocess
29+
30+
project = gl.projects.create(data) # or gl.projects.get(project_id)
31+
print(project.attributes) # displays all the attributes
32+
git_url = project.ssh_url_to_repo
33+
subprocess.call(['git', 'clone', git_url])

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Contents:
1414
install
1515
cli
1616
api-usage
17+
faq
1718
switching-to-v4
1819
api-objects
1920
api/gitlab

0 commit comments

Comments
 (0)