Skip to content

Unable to apply patch using contextual information when line numbers don't match #47

@JonathanHolvey

Description

@JonathanHolvey

I have a unified patch file which can be successfully applied using the GNU utility Patch. The line numbers of the source files do not match the patch, however there is enough context available around each hunk (three lines, as default) for the process to complete anyway.

When I try using the same patch file with python-patch, the apply() method fails with the debug log

INFO  hunk no.1 doesn't match source file at line 275

When looking through the source for apply(), I can't see any attempt to make corrections for non-matching line numbers.

Is this useful feature of the unified diff format beyond the scope of the project, something that hasn't been implemented yet, or am I just using it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions