VersionedFile.walk deprecated?

Aaron Bentley aaron.bentley at utoronto.ca
Mon Apr 17 14:17:31 BST 2006


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

Martin Pool wrote:
> On 12/04/2006, at 10:55 PM, Aaron Bentley wrote:
> 
>> Martin Pool wrote:
>>> We can make a plan_merge for knits which does something similar, but
>>> only deals with lines which can possibly be in the output.  It  
>>> requires
>>> annotated knits.  It should work like this:

Actually, I've been thinking about this, and I think it applies to
VersionedFiles generally, not just knits.  I.e., I don't think it
requires any operations not part of the VersionedFile API.

>>>   Do a two-way diff between the two versions to be merged.   Within  the
>>> difference regions, we need to determine whether each line is   unborn,
>>> live, or killed in the other side.  Taking the lines from the
>>> left-hand-side conflict region first, get the line origins.
>>
>>
>> Depending on the costs involved, it might be worthwile to diff the
>> annotated version, to reduce false matches.
> 
> 
> Doing that would give you a result that's more similar to that of  weave
> merge.  Whether those results are subjectively better or not  may vary
> from case to case.

I have started work on plan_merge as described here, but here's what I
think would be better:
1. knits maintain a concept of line identity.
2. We do sequence matching in two passes:
   i. sequence match on the entire files, matching exact line identity
   ii. in conflict regions, do a second sequence match, matching text

This approach should prefer match-on-identify, to avoid erroneous
matches, but also support convergence.  Note that step ii is essentially
the same thing as --reprocess, but done before the knit is merged,
rather than as post-processing.

Line identity in knits would probably be based on the combination of
revision-added and position-in-knit-patch.  This position would need to
appear in annotations, also.  So re-knitting would require revising
annotations.  But presumably, it should do that anyway, since
re-knitting could change the apparent-origin of a line.

Anyhow, I've started working on this.  I was surprised to see that
KnitVersionedFile.plan-merge is already implemented, then amused to see
*how* it was implemented.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEQ5Vr0F+nu1YWqI0RAu9tAJ0VMJmmS2aRtjehvkc5gduPS1x90QCbB5Ba
6gr3QoAcOVbA92b4T6jQjD0=
=8dOx
-----END PGP SIGNATURE-----




More information about the bazaar mailing list