| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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]) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,7 @@ Contents: | |||
| 14 | 14 | install | |
| 15 | 15 | cli | |
| 16 | 16 | api-usage | |
| 17 | + faq | ||
| 17 | 18 | switching-to-v4 | |
| 18 | 19 | api-objects | |
| 19 | 20 | api/gitlab | |
| Back | FazBrowse Home | New Git URL |
0 commit comments