Repository.applies() checks if a patch can be applied to HEAD without writing it. Currently, it doesn't provide any info beyond a boolean return value.
This PR adds an optional argument raise_error to Repository.applies. If raise_error=True, an exception will be raised if the patch doesn't apply. This lets the user get more detailed info from libgit2 about the failure to apply the patch.
By default, raise_error is False, so any existing code that depends on Repository.applies will keep working without changes.
Repository.applies()
checks if a patch can be applied to HEAD without writing it. Currently, it doesn't provide any info beyond a boolean return value.This PR adds an optional argument
raise_error
to Repository.applies. Ifraise_error=True
, an exception will be raised if the patch doesn't apply. This lets the user get more detailed info from libgit2 about the failure to apply the patch.By default,
raise_error
is False, so any existing code that depends on Repository.applies will keep working without changes.