feat: add sync method to force remote mirror updates · python-gitlab/python-gitlab@f3c6678

Original file line numberDiff line numberDiff line change

@@ -1233,7 +1233,20 @@ def create(self, data: dict[str, Any] | None = None, **kwargs: Any) -> ProjectFo

12331233
12341234
12351235

class ProjectRemoteMirror(ObjectDeleteMixin, SaveMixin, RESTObject):

1236-

pass

1236+

@cli.register_custom_action(cls_names="ProjectRemoteMirror")

1237+

@exc.on_http_error(exc.GitlabCreateError)

1238+

def sync(self, **kwargs: Any) -> dict[str, Any] | requests.Response:

1239+

"""Force push mirror update.

1240+
1241+

Args:

1242+

**kwargs: Extra options to send to the server (e.g. sudo)

1243+
1244+

Raises:

1245+

GitlabAuthenticationError: If authentication is not correct

1246+

GitlabCreateError: If the server cannot perform the request

1247+

"""

1248+

path = f"{self.manager.path}/{self.encoded_id}/sync"

1249+

return self.manager.gitlab.http_post(path, **kwargs)

12371250
12381251
12391252

class ProjectRemoteMirrorManager(