basic_io format merged

Alexey Shamrin shamrin at gmail.com
Thu Nov 24 14:49:38 GMT 2005


On 24/11/05, Martin Pool <mbp at sourcefrog.net> wrote:
> I've just merged my basic_io branch into bzr.dev, which implements a
> simple textual metaformat used by monotone.  I think this would be good
> for holding structured data that needs to be human-readable or
> byte-for-byte reproducible.  Nothing is converted to use it at the
> moment but I'd like to suggest we use it for changesets, revisions,
> inventories, and machine-readable output.

>From testbasicio.py:

    def test_read_stanza(self):
        """Load stanza from string"""
        lines = """\
 revision "mbp at sourcefrog.net-123-abc"
timestamp 1130653962
 timezone 36000
committer "Martin Pool <mbp at test.sourcefrog.net>"
""".splitlines(True)
        s = read_stanza(lines)
        self.assertTrue('revision' in s)
        self.assertEqualDiff(s.get('revision'), 'mbp at sourcefrog.net-123-abc')
        self.assertEquals(list(s.iter_pairs()),
                [('revision', 'mbp at sourcefrog.net-123-abc'),
                 ('timestamp', 1130653962),
                 ('timezone', 36000),
                 ('committer', "Martin Pool <mbp at test.sourcefrog.net>")])
        self.assertEquals(len(s), 4)

I wouldn't say that the timestamp and timezone in this examle are
human-readable... 200511241447 (this moment in utc) is slightly better
for timestamp, but still not great... How about taking timestamp
format from "bzr log"?

--
Alexey




More information about the bazaar mailing list