Skip to content

Conversation

jpiron
Copy link

@jpiron jpiron commented Feb 18, 2019

To ease lists and sets manipulations.

@max-wittig
Copy link
Member

Thanks for your contribution. What use-case do you have for this? How can I test it?

@jpiron
Copy link
Author

jpiron commented Feb 20, 2019

My use case is to compute statistics. One of them being the number of commits not part of a merge request.
So for a project, I retrieve all of its commits and then all the commits linked to an MR and do something like :

merge_requets_commits = XXX
commits_not_linked_to_mr = [commit for commit in project.commits.list(all=True, ref_name='master') if commit not in merge_requets_commits]

The not in part requires __eq__ to be defined on RESTObject.

For the __hash__, I often transform commits lists into sets to ensure uniqueness.

Sorry I forgot about the tests, I'll add some of them to test the changes.

To ease lists and sets manipulations.
@max-wittig max-wittig merged commit a4ea0fe into python-gitlab:master Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants