Skip to content

Make merge API consistent with new enums #1271

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

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

jorio
Copy link
Contributor

@jorio jorio commented Jan 17, 2024

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.

Merge functions use new enums MergeFavor, MergeFlag, MergeFileFlag.
Backward compatibility with the old string flags system was kept.
@jdavid jdavid merged commit c4840d2 into libgit2:master Jan 18, 2024
@jdavid
Copy link
Member

jdavid commented Jan 24, 2024

@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
Copy link
Contributor Author

jorio commented Jan 25, 2024

@jdavid My bad, you're right (it resolves to 0 either way so the tests didn't fail). PR #1272 fixes this.

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