[MERGE] [RFC] Split xml-independent bits out of bzrlib.xml_serializer.

Aaron Bentley aaron at aaronbentley.com
Fri Apr 3 21:51:31 BST 2009


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

Jelmer Vernooij wrote:
> This moves the Serializer class and the serializer registry 
> out of xml_serializer into a new bzrlib.serializer module, in preparation of 
> a Serializer that doesn't use any XML.

Seems reasonable.  The issues I have with the patch are small, but there
are quite a few, so:

bb:resubmit

> This moves format_registry and Serializer to a different location; should 
> they be deprecated or is removal ok in their case? (is there anybody out 
> there with custom serializers ?)

I think it's okay, because it's so unlikely that there are custom
serializers out there.  It should still be mentioned in NEWS, though.


> === added file 'bzrlib/serializer.py'
> --- bzrlib/serializer.py	1970-01-01 00:00:00 +0000
> +++ bzrlib/serializer.py	2009-04-02 15:28:11 +0000
> @@ -0,0 +1,74 @@
> +# Copyright (C) 2005, 2006 Canonical Ltd

I think this should include 2009.

> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> +
> +"""Inventory/revision serialization."""
> +
> +from bzrlib import registry
> +
> +class Serializer(object):

There should be two blank lines between
- - the copyright statement and the docstring
- - the docstring and the import
- - the import and the class

> +    """Abstract object serialize/deserialize"""

I think this could be more helpful if it said it was for serializing
Revisions and Inventories.

> === modified file 'bzrlib/tests/test_xml.py'
> --- bzrlib/tests/test_xml.py	2009-03-23 14:59:43 +0000
> +++ bzrlib/tests/test_xml.py	2009-04-02 15:28:11 +0000
> @@ -21,7 +21,7 @@
>      inventory,
>      xml7,
>      xml8,
> -    xml_serializer,
> +    serializer,
>      )
>  from bzrlib.tests import TestCase
>  from bzrlib.inventory import Inventory, InventoryEntry
> @@ -494,15 +494,15 @@
>  
>      def test_registry(self):
>          self.assertIs(serializer_v4,
> -                      xml_serializer.format_registry.get('4'))
> +                      serializer.format_registry.get('4'))
>          self.assertIs(bzrlib.xml5.serializer_v5,
> -                      xml_serializer.format_registry.get('5'))
> +                      serializer.format_registry.get('5'))
>          self.assertIs(bzrlib.xml6.serializer_v6,
> -                      xml_serializer.format_registry.get('6'))
> +                      serializer.format_registry.get('6'))
>          self.assertIs(bzrlib.xml7.serializer_v7,
> -                      xml_serializer.format_registry.get('7'))
> +                      serializer.format_registry.get('7'))
>          self.assertIs(bzrlib.xml8.serializer_v8,
> -                      xml_serializer.format_registry.get('8'))
> +                      serializer.format_registry.get('8'))
>  
>  

These tests should be split into a separate test_serializer file.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknWdtAACgkQ0F+nu1YWqI3PdACeMUcEmUMgOMs+u4400WZMTjrM
DJUAnjugjXzT/XEEcCMEdxPyTqHftlS/
=wAkS
-----END PGP SIGNATURE-----



More information about the bazaar mailing list