python weave code

Martin Pool mbp at sourcefrog.net
Tue Jun 28 16:20:34 BST 2005


Hi,

Attached is a reasonably complete weave algorithm in Python.  It turns
out to be very simple once a couple of subtleties are understood about
how the blocks interact.  You could probably squash it down quite a lot
but it's written with a lot of comments and sanity checks.

It's moderately tested but I have not benchmarked it by loading in a
large number of large files.  I might try that tomorrow.  I suspect it
will be reasonably good because the processing is so simple; on the
other hand unlike other formats we do always need to read and rewrite
the whole weave, so the big O is not so good.

There is also the drawback that this is not write-once or append-only,
which is a nice property of Arch because it makes it less likely that
a crash or bug will lose existing data. 

There is, as yet, no external format and versions are only identified by
within-file identifiers.  For this to be really useful it would need to
map them to global IDs; either text-ids or revision-ids.  Probably the
second, so that that annotations are more useful.

Unpack all these into a directory to try them, and run testweave.py.
weave.py run as a program has a tiny command-line interface, including
an annotate command.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsweet.py
Type: text/x-python
Size: 9473 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050629/44c4d1ff/attachment.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testweave.py
Type: text/x-python
Size: 16360 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050629/44c4d1ff/attachment-0001.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: weave.py
Type: text/x-python
Size: 16609 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050629/44c4d1ff/attachment-0002.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050629/44c4d1ff/attachment.pgp 


More information about the bazaar mailing list