Skip to content

Patch context is applied as well #55

Open
@SeverinLeonhardt

Description

@SeverinLeonhardt

Given file.txt:

a
b
c

And this patch (my.diff):

--- file.txt
+++ file.txt
@@ -1,3 +1,4 @@
 a
 b
+b1
 d

Which is applied using:

import patch
p = patch.fromfile("my.diff")
p.apply(".")

file.txt now looks like this:

a
b
b1
d

The patch only adds b1 but the following context was also put into the file. After applying the patch file.txt should not contain d but end with c.

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