~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-03-06 16:02:59 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: abentley@panoramicfeedback.com-20070306160259-dunx5d9kztvjdl3q
Use patch-style dates for timestamps in merge directives

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
            patch='', patch_type='diff')
32
32
 
33
33
    def test_serialization(self):
34
 
        time = 500.23
35
 
        timezone = 60
 
34
        time = 501
 
35
        timezone = 72
36
36
        md = merge_directive.MergeDirective('example:', 'sha', time, timezone,
37
37
            'http://example.com', source_branch="http://example.org",
38
38
            patch='booga', patch_type='diff')
64
64
# revision_id: rev2a
65
65
# target_branch: (.|\n)*
66
66
# testament_sha1: .*
67
 
# timestamp: Thu 1970-01-01 00:10:20.000000000 \\+0002
 
67
# timestamp: 1970-01-01 00:08:56 \\+0001
68
68
# source_branch: (.|\n)*
69
69
"""
70
70
 
77
77
# revision_id: rev2a
78
78
# target_branch: (.|\n)*
79
79
# testament_sha1: .*
80
 
# timestamp: Thu 1970-01-01 00:10:20.000000000 \\+0002
 
80
# timestamp: 1970-01-01 00:08:56 \\+0001
81
81
# source_branch: (.|\n)*
82
82
# message: Commit of rev2a with special message
83
83
"""
103
103
        tree_a, tree_b, branch_c = self.make_trees()
104
104
        self.assertRaises(errors.PublicBranchOutOfDate,
105
105
            merge_directive.MergeDirective.from_objects,
106
 
            tree_a.branch.repository, 'rev2a', 500, 120, tree_b.branch.base,
 
106
            tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
107
107
            public_branch=branch_c)
108
108
        md1 = merge_directive.MergeDirective.from_objects(
109
 
            tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base)
 
109
            tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base)
110
110
        self.assertContainsRe(md1.patch, 'Bazaar revision bundle')
111
111
        self.assertContainsRe(md1.patch, '\\+content_c')
112
112
        self.assertNotContainsRe(md1.patch, '\\+content_a')
113
113
        branch_c.pull(tree_a.branch)
114
114
        md2 = merge_directive.MergeDirective.from_objects(
115
 
            tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
 
115
            tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
116
116
            patch_type='diff', public_branch=branch_c)
117
117
        self.assertNotContainsRe(md2.patch, 'Bazaar revision bundle')
118
118
        self.assertContainsRe(md1.patch, '\\+content_c')
119
119
        self.assertNotContainsRe(md1.patch, '\\+content_a')
120
120
        md3 = merge_directive.MergeDirective.from_objects(
121
 
            tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
 
121
            tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
122
122
            patch_type=None, public_branch=branch_c, message='Merge message')
123
123
        md3.to_lines()
124
124
        self.assertIs(None, md3.patch)
125
125
        self.assertEqual('Merge message', md3.message)
126
126
 
127
127
    def test_signing(self):
128
 
        time = 500.23
129
 
        timezone = 60
 
128
        time = 501
 
129
        timezone = 72
130
130
        class FakeBranch(object):
131
131
            def get_config(self):
132
132
                return self
148
148
    def test_email(self):
149
149
        tree_a, tree_b, branch_c = self.make_trees()
150
150
        md = merge_directive.MergeDirective.from_objects(
151
 
            tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
 
151
            tree_a.branch.repository, 'rev2a', 500, 36, tree_b.branch.base,
152
152
            patch_type=None, public_branch=tree_a.branch)
153
153
        message = md.to_email('pqm@example.com', tree_a.branch)
154
154
        self.assertContainsRe(message.as_string(), EMAIL1)