Merge lp:~vila/bzr/397716-tz-dependent-test-failure into lp:~bzr/bzr/trunk-old

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: not available
Proposed branch: lp:~vila/bzr/397716-tz-dependent-test-failure
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 88 lines
To merge this branch: bzr merge lp:~vila/bzr/397716-tz-dependent-test-failure
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+8526@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Trivial but worth the exposure.

There should be lighter solutions to avoid that kind of easy traps...

Revision history for this message
Martin Pool (mbp) wrote :

> Trivial but worth the exposure.
>
> There should be lighter solutions to avoid that kind of easy traps...

Would it be better for branchbuilder to default to utc rather than to the local timezone?

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> "martin" == Martin Pool <email address hidden> writes:

    >> Trivial but worth the exposure.
    >>
    >> There should be lighter solutions to avoid that kind of easy traps...

    martin> Would it be better for branchbuilder to default to
    martin> utc rather than to the local timezone?

May be, but that will make it different from the rest of the code
base...

What I had in mind was more about having easier ways to create
commits for test purposes, having to specify even the timestamp
shouldn't be necessary or specified only once or something.

This is rarely needed except for log (and annotate here) and I'd
prefer to address it locally there. I started something along
these lines in blackbox.test_log.py: TestLog.commit_options(). It
makes the test clearer where used, but this still needs more
love...

Revision history for this message
Martin Pool (mbp) wrote :

ok, approve then

--
Martin <http://launchpad.net/~mbp/>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-07-09 01:44:00 +0000
3+++ NEWS 2009-07-10 15:35:30 +0000
4@@ -58,6 +58,9 @@
5 * Avoid progress bar artifacts being left behind on the screen.
6 (Martin Pool, #321935)
7
8+* BranchBuilder now accepts timezone to avoid test failures in countries far
9+ from GMT. (Vincent Ladeuil, #397716)
10+
11 * Better message in ``bzr split`` error suggesting a rich root format.
12 (Neil Martinsen-Burrell, #220067)
13
14
15=== modified file 'bzrlib/branchbuilder.py'
16--- bzrlib/branchbuilder.py 2009-06-19 21:25:51 +0000
17+++ bzrlib/branchbuilder.py 2009-07-10 15:35:30 +0000
18@@ -162,7 +162,7 @@
19
20 def build_snapshot(self, revision_id, parent_ids, actions,
21 message=None, timestamp=None, allow_leftmost_as_ghost=False,
22- committer=None):
23+ committer=None, timezone=None):
24 """Build a commit, shaped in a specific way.
25
26 :param revision_id: The handle for the new commit, can be None
27@@ -177,6 +177,7 @@
28 commit message will be written.
29 :param timestamp: If non-None, set the timestamp of the commit to this
30 value.
31+ :param timezone: An optional timezone for timestamp.
32 :param committer: An optional username to use for commit
33 :param allow_leftmost_as_ghost: True if the leftmost parent should be
34 permitted to be a ghost.
35@@ -243,7 +244,7 @@
36 for file_id, content in new_contents.iteritems():
37 tree.put_file_bytes_non_atomic(file_id, content)
38 return self._do_commit(tree, message=message, rev_id=revision_id,
39- timestamp=timestamp, committer=committer)
40+ timestamp=timestamp, timezone=timezone, committer=committer)
41 finally:
42 tree.unlock()
43
44
45=== modified file 'bzrlib/tests/test_annotate.py'
46--- bzrlib/tests/test_annotate.py 2009-06-19 21:32:28 +0000
47+++ bzrlib/tests/test_annotate.py 2009-07-10 15:35:30 +0000
48@@ -182,16 +182,16 @@
49 builder.build_snapshot('rev-1', None, [
50 ('add', ('', 'root-id', 'directory', None)),
51 ('add', ('a', 'a-id', 'file', 'first\n')),
52- ], timestamp=1166046000.00, committer="joe@foo.com")
53+ ], timestamp=1166046000.00, timezone=0, committer="joe@foo.com")
54 builder.build_snapshot('rev-2', ['rev-1'], [
55 ('modify', ('a-id', 'first\nsecond\n')),
56- ], timestamp=1166046001.00, committer="joe@foo.com")
57+ ], timestamp=1166046001.00, timezone=0, committer="joe@foo.com")
58 builder.build_snapshot('rev-1_1_1', ['rev-1'], [
59 ('modify', ('a-id', 'first\nthird\n')),
60- ], timestamp=1166046002.00, committer="barry@foo.com")
61+ ], timestamp=1166046002.00, timezone=0, committer="barry@foo.com")
62 builder.build_snapshot('rev-3', ['rev-2', 'rev-1_1_1'], [
63 ('modify', ('a-id', 'first\nsecond\nthird\n')),
64- ], timestamp=1166046003.00, committer="sal@foo.com")
65+ ], timestamp=1166046003.00, timezone=0, committer="sal@foo.com")
66 return builder
67
68 def create_deeply_merged_trees(self):
69@@ -222,15 +222,15 @@
70 builder.build_snapshot('rev-4', ['rev-3', 'rev-1_1_2'], [])
71 builder.build_snapshot('rev-1_2_1', ['rev-1_1_1'], [
72 ('modify', ('a-id', 'first\nthird\nfourth\n')),
73- ], timestamp=1166046003.00, committer="jerry@foo.com")
74+ ], timestamp=1166046003.00, timezone=0, committer="jerry@foo.com")
75 builder.build_snapshot('rev-1_2_2', ['rev-1_2_1'], [],
76- timestamp=1166046004.00, committer="jerry@foo.com")
77+ timestamp=1166046004.00, timezone=0, committer="jerry@foo.com")
78 builder.build_snapshot('rev-5', ['rev-4', 'rev-1_2_2'], [
79 ('modify', ('a-id', 'first\nsecond\nthird\nfourth\n')),
80- ], timestamp=1166046004.00, committer="jerry@foo.com")
81+ ], timestamp=1166046004.00, timezone=0, committer="jerry@foo.com")
82 builder.build_snapshot('rev-1_3_1', ['rev-1_2_1'], [
83 ('modify', ('a-id', 'first\nthird\nfourth\nfifth\nsixth\n')),
84- ], timestamp=1166046005.00, committer="george@foo.com")
85+ ], timestamp=1166046005.00, timezone=0, committer="george@foo.com")
86 builder.build_snapshot('rev-6', ['rev-5', 'rev-1_3_1'], [
87 ('modify', ('a-id',
88 'first\nsecond\nthird\nfourth\nfifth\nsixth\n')),