[Python] how can I apply hunks to blobs?

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    If you have 2 blobs, you can use Blob.diff() to create a patch with hunks that explain the differences between the 2 blobs. I wonder what would be the right way to do the opposite operation: You have a Blob and a number of hunks to be applied on it... and that would produce a new Blob. I would expect to see something like Blob.apply() to achieve this in pygit2 but I think this is not available. Even Tree.apply() would be also good (I would not mind creating a tree just to be able to apply the hunks with some modifications so that they match the Tree) but I don't think that's available either.

    What would be the right to do this in pygit2, then?

    Continue reading...

Compartilhe esta Página