libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

Make merge API consistent with new enums #1271

Closed jorio closed 5 months ago

jorio commented 5 months ago

Merge functions now use new enums: MergeFavor, MergeFlag, MergeFileFlag.

These functions used to take a dict of strings to boolean flags (e.g. flags={'no_recursive': True}). Backward compatibility with this system was kept, and there are unit tests for that too.

As far as I'm aware, this system was only used in the merge functions and not anywhere else in pygit2. So, this PR aims to make these functions more consistent with the rest of the library, now that we use enums elsewhere.

jdavid commented 5 months ago

@jorio Shouldn't this:

def merge_commits(
        [...]
        file_flags = MergeFavor.NORMAL,

https://github.com/libgit2/pygit2/blob/master/pygit2/repository.py#L700

be MergeFileFlag.DEFAULT ?

jorio commented 5 months ago

@jdavid My bad, you're right (it resolves to 0 either way so the tests didn't fail). PR https://github.com/libgit2/pygit2/pull/1272 fixes this.