Skip to content
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

Offsetted (relatively to sources) patches apply to wrong lines #21

Open
KOLANICH opened this issue Nov 19, 2021 · 1 comment
Open

Offsetted (relatively to sources) patches apply to wrong lines #21

KOLANICH opened this issue Nov 19, 2021 · 1 comment
Labels
waiting for response Requires feedback from the user who created the issue

Comments

@KOLANICH
Copy link

patch -p 1 < patchFile.patch (GNU patch) works fine.

def applyPatch(fileText: str, patchFile: Path):
	with patchFile.open("rb") as psf:
		ps = patch.PatchSet(psf)
		ps.parse(psf)

	p = ps.items[0]


	with BytesIO(fileText.encode("utf-8")) as sF:
		return b"".join(ps.patch_stream(sF, p.hunks)).decode("utf-8")

produces the wrong results.

@uilianries
Copy link
Member

Hello @KOLANICH ! Sorry the big delay! Could you please elaborate a bit more your case? Is it possible to provide a reproducible example? Please, take a look in the issue #19 as reference, that's good way to reproduce the case. Regards.

@uilianries uilianries added the waiting for response Requires feedback from the user who created the issue label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for response Requires feedback from the user who created the issue
Projects
None yet
Development

No branches or pull requests

2 participants