| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -180,6 +180,10 @@ | |||
| 180 | 180 | contributors = project.repository_contributors() | |
| 181 | 181 | # end repository contributors | |
| 182 | 182 | ||
| 183 | + # housekeeping | ||
| 184 | + project.housekeeping() | ||
| 185 | + # end housekeeping | ||
| 186 | + | ||
| 183 | 187 | # files get | |
| 184 | 188 | f = project.files.get(file_path='README.rst', ref='master') | |
| 185 | 189 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,6 +114,12 @@ Archive/unarchive a project: | |||
| 114 | 114 | Previous versions used ``archive_`` and ``unarchive_`` due to a naming issue, | |
| 115 | 115 | they have been deprecated but not yet removed. | |
| 116 | 116 | ||
| 117 | + Start the housekeeping job: | ||
| 118 | + | ||
| 119 | + .. literalinclude:: projects.py | ||
| 120 | + :start-after: # housekeeping | ||
| 121 | + :end-before: # end housekeeping | ||
| 122 | + | ||
| 117 | 123 | List the repository tree: | |
| 118 | 124 | ||
| 119 | 125 | .. literalinclude:: projects.py | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -189,6 +189,10 @@ class GitlabCherryPickError(GitlabOperationError): | |||
| 189 | 189 | pass | |
| 190 | 190 | ||
| 191 | 191 | ||
| 192 | + class GitlabHousekeepingError(GitlabOperationError): | ||
| 193 | + pass | ||
| 194 | + | ||
| 195 | + | ||
| 192 | 196 | def raise_error_from_response(response, error, expected_code=200): | |
| 193 | 197 | """Tries to parse gitlab error message from response and raises error. | |
| 194 | 198 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2328,6 +2328,22 @@ def trigger_pipeline(self, ref, token, variables={}, **kwargs): | |||
| 2328 | 2328 | post_data = {'ref': ref, 'token': token, 'variables': variables} | |
| 2329 | 2329 | self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) | |
| 2330 | 2330 | ||
| 2331 | + @cli.register_custom_action('Project') | ||
| 2332 | + @exc.on_http_error(exc.GitlabHousekeepingError) | ||
| 2333 | + def housekeeping(self, **kwargs): | ||
| 2334 | + """Start the housekeeping task. | ||
| 2335 | + | ||
| 2336 | + Args: | ||
| 2337 | + **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 2338 | + | ||
| 2339 | + Raises: | ||
| 2340 | + GitlabAuthenticationError: If authentication is not correct | ||
| 2341 | + GitlabHousekeepingError: If the server failed to perform the | ||
| 2342 | + request | ||
| 2343 | + """ | ||
| 2344 | + path = '/projects/%s/housekeeping' % self.get_id() | ||
| 2345 | + self.manager.gitlab.http_post(path, **kwargs) | ||
| 2346 | + | ||
| 2331 | 2347 | # see #56 - add file attachment features | |
| 2332 | 2348 | @cli.register_custom_action('Project', ('filename', 'filepath')) | |
| 2333 | 2349 | @exc.on_http_error(exc.GitlabUploadError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -331,6 +331,9 @@ | |||
| 331 | 331 | commit.comments.create({'note': 'This is a commit comment'}) | |
| 332 | 332 | assert(len(commit.comments.list()) == 1) | |
| 333 | 333 | ||
| 334 | + # housekeeping | ||
| 335 | + admin_project.housekeeping() | ||
| 336 | + | ||
| 334 | 337 | # repository | |
| 335 | 338 | tree = admin_project.repository_tree() | |
| 336 | 339 | assert(len(tree) != 0) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments