Skip to content

RFE: Archive a project #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
The-Loeki opened this issue May 10, 2016 · 5 comments
Closed

RFE: Archive a project #115

The-Loeki opened this issue May 10, 2016 · 5 comments

Comments

@The-Loeki
Copy link

In class Project(GitlabObject):

  • Rename the archive(sha=None, **kwargs) function to get_archive() or make it part of the repo.
  • Add archive() (Working POC on GL 8.7) function:
    def archive(self):
        """
            Archive a project
        """
        url = '/projects/%s/archive' % self.id
        r = self.gitlab._raw_post(url)
        raise_error_from_response(r, GitlabUpdateError, expected_code=201)
@gpocentek
Copy link
Contributor

The problem with this change is that it would change the method behavior and break compatibility. I'm not yet sure how this could be properly handled.

@The-Loeki
Copy link
Author

The-Loeki commented May 13, 2016

I know, it was just my suggestion; your API (for which I thank you btw, it's pretty awesome) is structured similar to GL's own, so logically speaking me personally expected the archive() function to be just that already.
We have one luck though; the function won't accidentally archive your project while args are passed to it, it'll bork with a TypeError.
OTOH you might do a archive('yes-i-really-really-mean-it') kind of construct.

The way I see it you could do:

  • don't change the function, make the new one i.e. project_archive() or something
  • if archive() was called without sha or kwargs it behaves like project_archive()
    (I think this one will trip over people, just throwing it out there as a possibility)
  • Write a note in the log that you're going to depreceate the 'old' archive(sha=None, **kwargs) in favour of repo.archive(sha=None, **kwargs) and after a while do the change

@gpocentek
Copy link
Contributor

I've implemented archive support in the archive_() and unarchive_() methods. This is not very nice but I wasn't yet ready to change the behavior of archive().

The method are explicitly listed in http://python-gitlab.readthedocs.io/en/latest/gl_objects/projects.html

I'll remove the archive() method at some point, then rename the new methods.

@gpocentek
Copy link
Contributor

Thanks for your suggestions BTW :)

@The-Loeki
Copy link
Author

Tnx 4 the feature :) sorry I didn't respond earlier there.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants