[RFC][merge] Patience Sorting Diffs
John Arbash Meinel
john at arbash-meinel.com
Wed Dec 14 14:30:20 GMT 2005
Aaron Bentley wrote:
> John Arbash Meinel wrote:
> | Any chance you can come up with a test case. I'll try to visually
> | inspect how a negative range could exist, but being able to trace
> | something around would be nice.
Well, I found the cause, but I'm not sure how to fix it.
Attached is 3 diffs. 1 for cdv, 1 for difflib, and one for cdv without
difflib interpolation (cdv2).
If you look at line 42, you will see that both diffs include:
- else:
- reporter = add_reporter_print
- smart_add(file_list, not no_recurse,
reporter)
However, if you look at cdv, you will see that later it also has:
else:
- reporter = add_reporter_print
- smart_add(file_list, not no_recurse, reporter)
So I think what is happening is that cdv is saying that the 'else'
wasn't really deleted. And what is happening is that when I run difflib
to fill in the gaps created by cdv, it is reporting the lines as being
deleted 2 times.
It seems that how I am implementing the difflib interpolation is messing
up the diff. My combined version also has problems with blank lines not
being marked as added or deleted.
Time to look closer and see where I'm getting it wrong.
John
=:->
>
> Here's a non-minimal test case. You can run merge3 directly on it by
> changing the imports in merge3 to relative imports, then doing
>
> python merge3.py builtins.py.THIS builtins.py.BASE builtins.py.OTHER
>
> The problem appears to be that the merge regions are not all in the same
> order for every file. I am not certain whether the Python
> SequenceMatcher can produce this kind of output. If it can, the bug's
> in Merge3.
>
> I dumped the merge regions, and lookee here:
>
> (223, 224, 223, 224, 237, 238)
> (226, 227, 226, 227, 225, 226)
>
> Depending on how you sort, either THIS or OTHER is out-of-order.
>
> Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051214/06841db6/attachment.pgp
More information about the bazaar
mailing list