Pushing from packs to knits

John Arbash Meinel john at arbash-meinel.com
Fri Nov 16 02:07:36 GMT 2007


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

Robert Collins wrote:
> On Thu, 2007-11-15 at 19:51 -0600, John Arbash Meinel wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Pushing from a pack repo to a knit repo is really painful at the moment. I
>> notice a lot because I use bound branches and my laptop/desktop are packs,
>> while my service is knits. (That may change eventually, but I don't want to run
>> reconcile on that machine just yet.)
>>
>> Anyway, I believe the current code completely re-annotates the file when it
>> pushes a new text to the knit. 
> 
> It doesn't.
> 
>> Wouldn't it be possible to just extract the
>> annotated form from the target knit, and then add the new text value to it?
> 
> Thats what it does. It uses the abstract join, which is degrades to just
> add_version(get_version())
> 
>> I could be wrong, but we are talking about >1 minute to commit a 2 line change
>> to NEWS. Which is why I assumed it was reannotating from scratch rather than
>> just annotating the new lines relative to the knit's text.
> 
> Something else was happening here.
> 
> -Rob

I don't think the generic code does what you think it does.
InterVersionedFile.join() builds an entirely new versioned file in memory with
the entire ancestry of the file into the new format. And then does a local join.

What you may not realize is that verisioned_file.get_graph(version_ids) returns
the full ancestry of all of those version ids. So the next step which is:

        order = tsort.topo_sort(graph.items())

Is getting an order for all texts.
Which then does:
            for index, version in enumerate(order):
                pb.update('Converting versioned data', index, total)
                _, _, parent_text = target.add_lines(version,
                                               self.source.get_parents(version),
                                               self.source.get_lines(version),
                                               parent_texts=parent_texts)
                parent_texts[version] = parent_text

And that means it completely rebuilds a Knit in memory with the full ancestry.

IE: PAIN

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

iD8DBQFHPPtnJdeBCYSNAAMRAl9gAKDMNFYqHC2+xfU6soAtbPA1jywV7gCfX9I1
fV0r1mdANoU4cZ/VckMLKrU=
=sWce
-----END PGP SIGNATURE-----



More information about the bazaar mailing list