[MERGE][1.0] update C PatienceDiff to allow for non-strings

John Arbash Meinel john at arbash-meinel.com
Tue Dec 4 16:48:53 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>> Aaron pinged me on IRC to see if that was strictly required. I think he wanted
>> to use patience diff for comparing annotated texts. And being able to use
>> tuples there would be convenient.
> 
> Actually, it was for merge plans, but they have a similar structure:
> 
> [
>  ('unchanged', 'foo'),
>  ('killed-a', 'bar'),
>  ('new-b', 'baz'),
> ]
> 
>> So this patch allows for arbitrary Python Objects. As long as they support
>> PyObject_Hash (though I probably need to check the return value a bit better),
>> PyObject_Length, and PyObject_Compare.
> 
> Nice.

I did end up checking the return values for these functions, and added a test
that it properly raises an error.

It just raises the original TypeError exception, but I felt that was ok. Since
it says stuff like "list objects are unhashable" and "len() of unsized object".

> 
>> Anyway, I think this is worthy to merge into 1.0, it is a simple and
>> straightforward improvement to the diff algorithm.
> 
> The work I was doing was to enable annotate merge to do cherrypicking.
> That isn't targeted for 1.0, so I don't strictly need it for 1.0.
> 
> Aaron

Sure, I mostly want it in because it is faster. 2.85s versus 3.87s is a pretty
good improvement (better than 3:4).

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHVYT0JdeBCYSNAAMRAv4qAKCBHQ2R0C6+Ak3yYfS/I0jULtzD5gCffXc4
86S8uMbJXWm3po7yPiNhcDE=
=bVxv
-----END PGP SIGNATURE-----



More information about the bazaar mailing list