Patience Diff, a brief summary

Feb 20, 2008 00:25


Last night I went to a coding party at a friend's house. I was on my laptop, and so didn't have any of my regular projects with me, so instead I spent some time figuring out some code for another person at the party.

The code in question was the implementation of Patience Diff, a diffing algorithm written by Bram Cohen of Bittorrent fame, and used ( Read more... )

computers

Leave a comment

Comments 7

sbranzei February 20 2008, 22:02:41 UTC
This is awesome :)
You should write more often :-)

Reply


bramcohen February 25 2008, 18:38:20 UTC
That's a good summary, although you skipped the final step, where it matches lines at the beginning and end, which is meant to match, for example, the first five lines of a diff between five blank lines and six blank lines.

Reply


anonymous February 10 2009, 08:55:49 UTC
this really helps with resolving conflicts!

i can imagine what the effect is, but perhaps a nice standard-diff vs patience-diff at the end of this article would have been cool!

i really hated the standard diff when i had to resolve multiple function renaming and moved conflicts of similiar functions!
i wish i had that patience-diff back then ... (this unique-common-line thing is really a great idea!)

Reply

roryokane March 11 2015, 06:11:22 UTC
I generated a standard diff and the patience diff for the example in this article. LiveJournal totally messed up the formatting, so it’s in the GitHub Gist with ID 6f9061d3a60c1ba41237 (gist dot github dot com slash 6f9061d3a60c1ba41237).

Reply


what if matching the following? anonymous August 24 2010, 16:11:09 UTC
file a

aaaaaa
aaaaaa
bbbbbb
bbbbbb
cccccc
cccccc
abc

file b

abc
aaaaaa
aaaaaa
bbbbbb
bbbbbb
cccccc
cccccc

would the matching result be

-aaaaaa
-aaaaaa
-bbbbbb
-bbbbbb
-cccccc
-cccccc
abc
+aaaaaa
+aaaaaa
+bbbbbb
+bbbbbb
+cccccc
+cccccc

Reply

Re: what if matching the following? ext_677431 June 22 2011, 09:02:20 UTC
Yes it is.

git diff --patience HEAD HEAD^
diff --git a/a.txt b/a.txt
index accc3bd..3299d68 100644
--- a/a.txt
+++ b/a.txt
@@ -1,7 +1,7 @@
+aaaaaa
+aaaaaa
+bbbbbb
+bbbbbb
+cccccc
+cccccc
abc
-aaaaaa
-aaaaaa
-bbbbbb
-bbbbbb
-cccccc
-cccccc

Reply


ironcream August 16 2011, 17:38:39 UTC
Thanks for the explanation!

Reply


Leave a comment

Up