[merge] 1ms resolution for commit timestamps
Jamie Wilkinson
jaq at spacepants.org
Wed Jul 19 04:09:35 BST 2006
This one time, at band camp, John Arbash Meinel wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>When creating a new commit, it is possible to specify the timestamp to
>use. The old code used to explicitly restrict this to 1s precision.
>While timestamps that were generated were preserved at something like
>nanosecond precision. (depended mostly on what a double() could hold, at
>16 digits of precision, there are 9 digits before the decimal, so it
>should be something like 7 digits afterwards, or 100ns resolution).
>
>Anyway, 1ns is a little excessive, especially because we don't actually
>have that much precision, but restricting it to 1s was also too limiting.
>
>So the attached patch changes it so that whether the timestamp is
>generated or supplied, it is restricted to 1ms resolution. That way,
>multiple commits within a second can be preserved. It seems a reasonable
>resolution to use.
+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)
More information about the bazaar
mailing list