~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: Martin Pool
  • Date: 2006-02-22 04:29:54 UTC
  • mfrom: (1566 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060222042954-60333f08dd56a646
[merge] from bzr.dev before integration
Fix undefined ordering in sign_my_revisions breaking tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
    def setUp(self):
35
35
        super(TestamentTests, self).setUp()
36
 
        wt = self.make_branch_and_tree('.')
37
 
        b = self.b = wt.branch
 
36
        self.wt = self.make_branch_and_tree('.')
 
37
        b = self.b = self.wt.branch
38
38
        b.nick = "test branch"
39
 
        wt.commit(message='initial null commit',
 
39
        self.wt.commit(message='initial null commit',
40
40
                 committer='test@user',
41
41
                 timestamp=1129025423, # 'Tue Oct 11 20:10:23 2005'
42
42
                 timezone=0,
44
44
        self.build_tree_contents([('hello', 'contents of hello file'),
45
45
                             ('src/', ),
46
46
                             ('src/foo.c', 'int main()\n{\n}\n')])
47
 
        wt.add(['hello', 'src', 'src/foo.c'],
 
47
        self.wt.add(['hello', 'src', 'src/foo.c'],
48
48
                             ['hello-id', 'src-id', 'foo.c-id'])
49
 
        wt.commit(message='add files and directories',
 
49
        self.wt.commit(message='add files and directories',
50
50
                 timestamp=1129025483,
51
51
                 timezone=36000,
52
52
                 rev_id='test@user-2',
96
96
        if not has_symlinks():
97
97
            return
98
98
        os.symlink('wibble/linktarget', 'link')
99
 
        self.b.working_tree().add(['link'], ['link-id'])
100
 
        self.b.working_tree().commit(message='add symlink',
 
99
        self.wt.add(['link'], ['link-id'])
 
100
        self.wt.commit(message='add symlink',
101
101
                 timestamp=1129025493,
102
102
                 timezone=36000,
103
103
                 rev_id='test@user-3',
109
109
        """Testament to revision with extra properties"""
110
110
        props = dict(flavor='sour cherry\ncream cheese',
111
111
                     size='medium')
112
 
        self.b.working_tree().commit(message='revision with properties',
 
112
        self.wt.commit(message='revision with properties',
113
113
                      timestamp=1129025493,
114
114
                      timezone=36000,
115
115
                      rev_id='test@user-3',
118
118
        t = Testament.from_revision(self.b.repository, 'test@user-3')
119
119
        self.assertEqualDiff(t.as_text(), REV_PROPS_TESTAMENT)
120
120
 
 
121
    def test_testament_unicode_commit_message(self):
 
122
        self.wt.commit(
 
123
            message=u'non-ascii commit \N{COPYRIGHT SIGN} me',
 
124
            timestamp=1129025493,
 
125
            timezone=36000,
 
126
            rev_id='test@user-3',
 
127
            committer='test@user')
 
128
        t = Testament.from_revision(self.b.repository, 'test@user-3')
 
129
        self.assertEqualDiff(
 
130
            SAMPLE_UNICODE_TESTAMENT.encode('utf-8'), t.as_text())
 
131
 
121
132
    def test___init__(self):
122
133
        revision = self.b.repository.get_revision('test@user-2')
123
134
        inventory = self.b.repository.get_inventory('test@user-2')
220
231
  branch-nick:
221
232
    test branch
222
233
"""
 
234
 
 
235
 
 
236
SAMPLE_UNICODE_TESTAMENT = u"""\
 
237
bazaar-ng testament version 1
 
238
revision-id: test@user-3
 
239
committer: test@user
 
240
timestamp: 1129025493
 
241
timezone: 36000
 
242
parents:
 
243
  test@user-2
 
244
message:
 
245
  non-ascii commit \N{COPYRIGHT SIGN} me
 
246
inventory:
 
247
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 
248
  directory src src-id
 
249
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 
250
properties:
 
251
  branch-nick:
 
252
    test branch
 
253
"""