[MERGE] Shelf 1 / 5: TreeTransform serialization

John Arbash Meinel john at arbash-meinel.com
Mon Oct 20 21:49:15 BST 2008


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

Aaron Bentley wrote:
> Hi all,
> 
> This patch implements TreeTransform serialization so that we can
> reconstruct a preview tree for unshelving purposes.
> 
> A serialized TreeTransform is similar to a changeset, which is a staple
> of other VCSes.  However, a serialized TreeTransform can refer to
> unversioned, as well as versioned files.  This could for the basis of an
> undo command in the future.
> 
> Serialization uses single-parent mpdiffs for delta compression, packs
> for record separation, bencode for metadata storage.  It's all
> suspiciously like bundle format 4.
> 
> Aaron

+    def test_roundtrip_creation(self):
+        tree = self.make_branch_and_tree('.')
+        tt, tt2 = self.get_two_previews(tree)
+        tt.new_file(u'foo\u1234', tt.root, 'bar', 'baz', True)
+        tt.new_directory('qux', tt.root, 'quxx')
+        self.reserialize(tt, tt2)
+        self.assertEqual(3, tt2._id_number)
+        self.assertEqual({'new-1': u'foo\u1234',
+                          'new-2': 'qux'}, tt2._new_name)

^- Question, is it better to compare the exact contents of attributes
like "_new_name" or would it be better to do:
self.assertEqual(tt._new_name, tt2._new_name)

It also seems like you should be asserting that the other dicts are
empty. Though just having "self.assertEqual(tt, tt2)" might cover that
best.


Also, it seems like it would be good to test non-ascii as part of these
tests. Either by default, or as a separate test. (Mostly non-ascii
paths, and possibly symlink target, though that isn't very well
supported by the rest of bzr)


BB:tweak

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

iEYEARECAAYFAkj87ssACgkQJdeBCYSNAAOi8wCdHJuO3bJWwC4MMBh243GIcT/4
RN4An11qBE2g3BJeOe5DickZOjFCgnZU
=iedC
-----END PGP SIGNATURE-----



More information about the bazaar mailing list