[merge] 1ms resolution for commit timestamps
Jamie Wilkinson
jaq at spacepants.org
Thu Jul 20 01:50:08 BST 2006
This one time, at band camp, John Arbash Meinel wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Jamie Wilkinson wrote:
>> This one time, at band camp, John Arbash Meinel wrote:
>
>...
>
>> +1, referring back to a thread many months ago asking for a test that
>> revision data is stored idempotently.
>>
>> http://repo.spacepants.org/bzr/bzr.jaq , revno 1600
>>
>>
>> === modified file 'bzrlib/tests/test_revision.py'
>> --- bzrlib/tests/test_revision.py 2006-07-18 23:40:45 +0000
>> +++ bzrlib/tests/test_revision.py 2006-07-18 23:54:06 +0000
>> @@ -297,3 +297,33 @@
>> self.assertEqual({'B':['A'],
>> 'A':[]},
>> source.get_revision_graph('B'))
>> +
>> +class TestRevisionAttributes(TestCaseWithTransport):
>> + """Test that revision attributes are correct."""
>> +
>> + def test_revision_accessors(self):
>> + """Make sure the values that come out of a revision are the same as the ones that go in.
>> + """
>> + tree1 = self.make_branch_and_tree("br1")
>> +
>> + # create a revision
>> + tree1.commit(message="quux", allow_pointless=True, committer="jaq")
>> + assert len(tree1.branch.revision_history()) > 0
>> + rev_a = tree1.branch.repository.get_revision(tree1.branch.last_revision())
>> +
>> + tree2 = self.make_branch_and_tree("br2")
>> + tree2.commit(message=rev_a.message,
>> + timestamp=rev_a.timestamp,
>> + timezone=rev_a.timezone,
>> + committer=rev_a.committer,
>> + rev_id=rev_a.revision_id,
>> + allow_pointless=True, # there's nothing in this commit
>> + strict=True,
>> + verbose=True)
>> + rev_b = tree2.branch.repository.get_revision(tree2.branch.last_revision())
>> +
>> + self.assertEqual(rev_a.message, rev_b.message)
>> + self.assertEqual(rev_a.timestamp, rev_b.timestamp)
>> + self.assertEqual(rev_a.timezone, rev_b.timezone)
>> + self.assertEqual(rev_a.committer, rev_b.committer)
>> + self.assertEqual(rev_a.revision_id, rev_b.revision_id)
>>
>
>I already merged my 1ms changes. But I think this is a good test to also
>add. I'm +1 on adding this test, what do other people think?
I seem to recall Martin giving a +1 in theory, but at the time my patch
carried a dubious fix to the casting of timestamp in bzrlib/commit.py, so he
didn't want to merge it.
Martin, I'd appreciate it it you approved the merge of this test, finally ;)
My graft plugin needs to depend on having idempotent revision attributes.
More information about the bazaar
mailing list