Some questions on internals

Frits Jalvingh jal at etc.to
Wed Feb 24 12:39:24 GMT 2010


Thanks John and Andrew for the detailed explanations. I think for now I
have enough to think about, mostly.

If I understand correctly 3-way merge works by matching context to
locate the merge target location. This is effective if the common base
is close to the tips of both branch versions.

Because this is just done every time there is no line history. The
description for annotate was useful too (never guessed it could be done
that way in a reasonable time ;-) - but I think the info I need can be
gotten way better from the later-version's branch merge's diff.

On Mon, 2010-02-22 at 12:07 -0600, John Arbash Meinel wrote:
> Guessing at where content moved is generally going to run into troubles
> when "minor changes are made or when chunks look alike". You are making
> an inference, rather than having someone tell you what happened. You can
> work towards a 'best guess' but always you'll get something wrong.
That I get, but I'm not really guessing most of it - I do not compare a
diff chunk to a complete file but only to another set of diff chunks.
Say I have done:

fix --> 3.1' (temp merge branch)
        |
        v
        3.2' (temp merge branch)

If I now diff 3.1 against 3.1' I have the original merge.
Diffing 3.2 against 3.2' will deliver the /results/ of merging that
original merge into 3.2 - but with possible changes in the chunks
because conflicts were resolved.

Since there is no line history the only way to relate the 3.1 diff with
the 3.2 merge diff is to match the diff chunks. Perhaps by calculating
levenshtein distances between old and new diffs for the context lines
and the diff context lines - which I think is mostly like what you said,
John.

> Basically, just use 'diff' on the unified diff text. Python's difflib,
> or bzrlib's patiencediff can be used here. Also, I believe both of
> them would let you do a per-character diff on a single line (worst
> case you just expand the line into a line per character, and run it
> there.)
Yes, I already used this (in my case a diff between words in a line) to
show actual changes in a line so that changes /within a diff chunk/ to
only whitespace are visible ;-)

Again, thanks to all of you for thinking with me.

Frits





More information about the bazaar mailing list