Skip to content

Hardcoding --ancestry-path prevents generic git rev-list behavior #318

@bakhtos

Description

@bakhtos

Is your feature request related to a problem? Please describe.
The current implementation of Conf.get_starting_commit() will always insert --ancestry-path to the git rev-list options if a from filter is given, which forces the returned commits to be direct descendants of the specified commit.

This makes it impossible to invoke generic git rev-list behavior such as git rev-list A..B or git rev-list A B ^C using PyDriller repository filters

Describe the solution you'd like
I propose to add filters descendants_of and ancestors_of which accept either a single commit or a list of commits, such that Repository(path, descendatns_of=['A', 'B'], ancestors_of['C', 'D']) results in the behavior git rev-list C D ^A ^B.

Additional context
I would say providing --ancestry-path as the only option is counterintuitive. E.g. I wanted to use pydriller to mine all commits that occurred between two releases R1 and R2 of a project and was puzzled as to why Repository(path, from="R1", to="R2") resulted in empty output, even though git rev-list R1..R2 provided commits. I wonder if some people used these filters without realising how they actually work in PyDriller.

Metadata

Metadata

Assignees

Labels

PR welcomeIssue is confirmed, but not fixed yetenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions