Discussion about merging
Aaron Bentley
aaron.bentley at utoronto.ca
Sat Jun 4 00:18:00 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John A Meinel wrote:
> Aaron Bentley wrote:
>
> ...
>
>> Finding the common base should be a symmetrical operation. It shouldn't
>> matter whether you're merging A into B or B into A.
>>
>> So I think this can work:
>> 1. get an iterator of revisions in A
>> 2. get an iterator of revisions in B
>> 3. get the next A revision
>
>
> When you say "next" here, I assume you mean previous. (ie start at
> revision 600, 'next' = 599).
Yes. I always expect to start with the current, and work backwards.
>> 4. see if it merged any revisions in B-ANCESTORS. If so, set it as
>> A-BASE and stop iteration through B
>
>
> Isn't this step 'for merged in cur_A.merges: for ancestor of
> curB.ancestors: is merged == ancestor'?
> You can make it a little faster by keeping a hash/dict of curB.ancestors.
It's
for merged in cur_A.new_merges:
if merged in ancestors_B:
candidate_A = cur_A
iterate_B = False
And actually, I think a set is the appropriate datatype for ancestors_B
The point of this is: since we're iterating towards the initial import,
once we've found a merge of B in A, we know that we won't find any more
potential merges by iterating through B, because it will all be older
than candidate_A.
>> 5. see if it is listed in B-MERGES. If so, set the revision that merged
>> it as A-BASE and stop iteration through A
>
>
>> 6. add it to A-ANCESTORS
>
>
> Isn't this saying start at 1 and go to 600? Which means you have to go
> through all of the ancestry? (Because you want the newest merge point,
> not the oldest).
No, this is assuming you start at A and B and work backwards 'till you
find a merge point.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCoOUn0F+nu1YWqI0RAj5YAJkBbgPoF+sL/SYmTlL+gMr1XV+w7ACfUD+Q
gyk03or6yxJfEzw4SbyU+sU=
=rgiX
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list