matiasb / python-unidiff

Unified diff python parsing/metadata extraction library
https://pypi.python.org/pypi/unidiff
MIT License
231 stars 69 forks source link

git merge diffs #18

Open JeremyMarshall opened 8 years ago

JeremyMarshall commented 8 years ago

Hi

I was looking to parse the results of this sort of thing

git merge --no-commit branch-which-will-conflict
git diff --diff-filter=U > report.txt

There is also a diff3 format git config merge.conflictstyle diff3 which will also show the common parent branch after a |||||| section

But sadly it doesn't cope, firstly for this type of line @@@ -1,171 -1,166 +1,340 @@@

What do you think? is it worth any time to provide this?

Thanks Jeremy

this is a nice example http://www.gitguys.com/topics/merging-with-a-conflict-conflicts-and-resolutions/

matiasb commented 8 years ago

Hi,

Right, this is not supported at the moment. I think this is not exactly (standard) unified diff format but some sort of extension on top of it when merging multiple sets of changes. It could be interesting though to take a look at how hard it would be to extend unidiff to make it work, will leave this open to consider it (or if you have an implementation idea, feel free to propose your changes :-)).

Thanks!

JeremyMarshall commented 8 years ago

I started trying to make it do both but I ran into some problems mainly when processing hunks and knowing which type it was creating. At the moment I have a changed version (conflictdiff) which is only doing git merge conflicts. I can't push to github at the moment (blocked from work) but I will do so. Mainly the changes are dealing with regexes and adding in an orig section for the three way diff

Thanks Jeremy

On Mon, Nov 9, 2015 at 8:21 AM, Matias Bordese notifications@github.com wrote:

Hi,

Right, this is not supported at the moment. I think this is not exactly (standard) unified diff format but some sort of extension on top of it when merging multiple sets of changes. It could be interesting though to take a look at how hard it would be to extend unidiff to make it work, will leave this open to consider it (or if you have an implementation idea, feel free to propose your changes :-)).

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/matiasb/python-unidiff/issues/18#issuecomment-154875170 .