/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-25 15:05:42 UTC
  • mfrom: (1185.85.85 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060425150542-c7b518dca9928691
[merge] the old bzr-encoding changes, reparenting them on bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Test testaments for gpg signing."""
18
18
 
19
19
# TODO: Testaments with x-bits
20
20
 
21
21
import os
22
 
 
23
 
from breezy import osutils
24
 
from breezy.tests import TestCaseWithTransport
25
 
from breezy.bzr.testament import (
26
 
    Testament,
27
 
    StrictTestament,
28
 
    StrictTestament3,
29
 
    )
30
 
from breezy.tests.features import (
31
 
    SymlinkFeature,
32
 
    )
33
 
 
34
 
 
35
 
class TestamentSetup(TestCaseWithTransport):
 
22
from sha import sha
 
23
import sys
 
24
 
 
25
from bzrlib.tests import TestCaseWithTransport
 
26
from bzrlib.branch import Branch
 
27
from bzrlib.testament import Testament
 
28
from bzrlib.trace import mutter
 
29
from bzrlib.osutils import has_symlinks
 
30
 
 
31
 
 
32
class TestamentTests(TestCaseWithTransport):
36
33
 
37
34
    def setUp(self):
38
 
        super(TestamentSetup, self).setUp()
39
 
        self.wt = self.make_branch_and_tree('.', format='development-subtree')
40
 
        self.wt.set_root_id(b'TREE_ROT')
 
35
        super(TestamentTests, self).setUp()
 
36
        self.wt = self.make_branch_and_tree('.')
41
37
        b = self.b = self.wt.branch
42
38
        b.nick = "test branch"
43
39
        self.wt.commit(message='initial null commit',
44
 
                       committer='test@user',
45
 
                       timestamp=1129025423,  # 'Tue Oct 11 20:10:23 2005'
46
 
                       timezone=0,
47
 
                       rev_id=b'test@user-1')
48
 
        self.build_tree_contents([('hello', b'contents of hello file'),
49
 
                                  ('src/', ),
50
 
                                  ('src/foo.c', b'int main()\n{\n}\n')])
 
40
                 committer='test@user',
 
41
                 timestamp=1129025423, # 'Tue Oct 11 20:10:23 2005'
 
42
                 timezone=0,
 
43
                 rev_id='test@user-1')
 
44
        self.build_tree_contents([('hello', 'contents of hello file'),
 
45
                             ('src/', ),
 
46
                             ('src/foo.c', 'int main()\n{\n}\n')])
51
47
        self.wt.add(['hello', 'src', 'src/foo.c'],
52
 
                    [b'hello-id', b'src-id', b'foo.c-id'])
53
 
        tt = self.wt.get_transform()
54
 
        trans_id = tt.trans_id_tree_path('hello')
55
 
        tt.set_executability(True, trans_id)
56
 
        tt.apply()
 
48
                             ['hello-id', 'src-id', 'foo.c-id'])
57
49
        self.wt.commit(message='add files and directories',
58
 
                       timestamp=1129025483,
59
 
                       timezone=36000,
60
 
                       rev_id=b'test@user-2',
61
 
                       committer='test@user')
62
 
 
63
 
 
64
 
class TestamentTests(TestamentSetup):
65
 
 
66
 
    def testament_class(self):
67
 
        return Testament
68
 
 
69
 
    def expected(self, key):
70
 
        return texts[self.testament_class()][key]
71
 
 
72
 
    def from_revision(self, repository, revision_id):
73
 
        return self.testament_class().from_revision(repository, revision_id)
 
50
                 timestamp=1129025483,
 
51
                 timezone=36000,
 
52
                 rev_id='test@user-2',
 
53
                 committer='test@user')
74
54
 
75
55
    def test_null_testament(self):
76
56
        """Testament for a revision with no contents."""
77
 
        t = self.from_revision(self.b.repository, b'test@user-1')
 
57
        t = Testament.from_revision(self.b.repository, 'test@user-1')
78
58
        ass = self.assertTrue
79
59
        eq = self.assertEqual
80
60
        ass(isinstance(t, Testament))
81
 
        eq(t.revision_id, b'test@user-1')
 
61
        eq(t.revision_id, 'test@user-1')
82
62
        eq(t.committer, 'test@user')
83
63
        eq(t.timestamp, 1129025423)
84
64
        eq(t.timezone, 0)
85
65
 
86
66
    def test_testment_text_form(self):
87
67
        """Conversion of testament to canonical text form."""
88
 
        t = self.from_revision(self.b.repository, b'test@user-1')
 
68
        t = Testament.from_revision(self.b.repository, 'test@user-1')
89
69
        text_form = t.as_text()
90
 
        self.log('testament text form:\n%s' % text_form)
91
 
        self.assertEqualDiff(text_form, self.expected('rev_1'))
92
 
        short_text_form = t.as_short_text()
93
 
        self.assertEqualDiff(short_text_form, self.expected('rev_1_short'))
 
70
        self.log('testament text form:\n' + text_form)
 
71
        self.assertEqual(text_form, REV_1_TESTAMENT)
94
72
 
95
73
    def test_testament_with_contents(self):
96
74
        """Testament containing a file and a directory."""
97
 
        t = self.from_revision(self.b.repository, b'test@user-2')
 
75
        t = Testament.from_revision(self.b.repository, 'test@user-2')
98
76
        text_form = t.as_text()
99
 
        self.log('testament text form:\n%s' % text_form)
100
 
        self.assertEqualDiff(text_form, self.expected('rev_2'))
 
77
        self.log('testament text form:\n' + text_form)
 
78
        self.assertEqualDiff(text_form, REV_2_TESTAMENT)
101
79
        actual_short = t.as_short_text()
102
 
        self.assertEqualDiff(actual_short, self.expected('rev_2_short'))
 
80
        self.assertEqualDiff(actual_short, REV_2_SHORT)
 
81
 
 
82
    def test_testament_command(self):
 
83
        """Testament containing a file and a directory."""
 
84
        out, err = self.run_bzr_captured(['testament', '--long'])
 
85
        self.assertEqualDiff(err, '')
 
86
        self.assertEqualDiff(out, REV_2_TESTAMENT)
 
87
 
 
88
    def test_testament_command_2(self):
 
89
        """Command getting short testament of previous version."""
 
90
        out, err = self.run_bzr_captured(['testament', '-r1'])
 
91
        self.assertEqualDiff(err, '')
 
92
        self.assertEqualDiff(out, REV_1_SHORT)
103
93
 
104
94
    def test_testament_symlinks(self):
105
95
        """Testament containing symlink (where possible)"""
106
 
        self.requireFeature(SymlinkFeature)
 
96
        if not has_symlinks():
 
97
            return
107
98
        os.symlink('wibble/linktarget', 'link')
108
 
        self.wt.add(['link'], [b'link-id'])
 
99
        self.wt.add(['link'], ['link-id'])
109
100
        self.wt.commit(message='add symlink',
110
 
                       timestamp=1129025493,
111
 
                       timezone=36000,
112
 
                       rev_id=b'test@user-3',
113
 
                       committer='test@user')
114
 
        t = self.from_revision(self.b.repository, b'test@user-3')
115
 
        self.assertEqualDiff(t.as_text(), self.expected('rev_3'))
 
101
                 timestamp=1129025493,
 
102
                 timezone=36000,
 
103
                 rev_id='test@user-3',
 
104
                 committer='test@user')
 
105
        t = Testament.from_revision(self.b.repository, 'test@user-3')
 
106
        self.assertEqualDiff(t.as_text(), REV_3_TESTAMENT)
116
107
 
117
108
    def test_testament_revprops(self):
118
109
        """Testament to revision with extra properties"""
119
 
        props = {u'flavor': 'sour cherry\ncream cheese',
120
 
                 u'size': 'medium',
121
 
                 u'empty': '',
122
 
                 }
 
110
        props = dict(flavor='sour cherry\ncream cheese',
 
111
                     size='medium')
123
112
        self.wt.commit(message='revision with properties',
124
 
                       timestamp=1129025493,
125
 
                       timezone=36000,
126
 
                       rev_id=b'test@user-3',
127
 
                       committer='test@user',
128
 
                       revprops=props)
129
 
        t = self.from_revision(self.b.repository, b'test@user-3')
130
 
        self.assertEqualDiff(t.as_text(), self.expected('rev_props'))
 
113
                      timestamp=1129025493,
 
114
                      timezone=36000,
 
115
                      rev_id='test@user-3',
 
116
                      committer='test@user',
 
117
                      revprops=props)
 
118
        t = Testament.from_revision(self.b.repository, 'test@user-3')
 
119
        self.assertEqualDiff(t.as_text(), REV_PROPS_TESTAMENT)
131
120
 
132
121
    def test_testament_unicode_commit_message(self):
133
122
        self.wt.commit(
134
123
            message=u'non-ascii commit \N{COPYRIGHT SIGN} me',
135
124
            timestamp=1129025493,
136
125
            timezone=36000,
137
 
            rev_id=b'test@user-3',
138
 
            committer=u'Erik B\xe5gfors <test@user>',
139
 
            revprops={u'uni': u'\xb5'}
140
 
            )
141
 
        t = self.from_revision(self.b.repository, b'test@user-3')
 
126
            rev_id='test@user-3',
 
127
            committer='test@user')
 
128
        t = Testament.from_revision(self.b.repository, 'test@user-3')
142
129
        self.assertEqualDiff(
143
 
            self.expected('sample_unicode').encode('utf-8'), t.as_text())
144
 
 
145
 
    def test_from_tree(self):
146
 
        tree = self.b.repository.revision_tree(b'test@user-2')
147
 
        testament = self.testament_class().from_revision_tree(tree)
148
 
        text_1 = testament.as_short_text()
149
 
        text_2 = self.from_revision(self.b.repository,
150
 
                                    b'test@user-2').as_short_text()
151
 
        self.assertEqual(text_1, text_2)
 
130
            SAMPLE_UNICODE_TESTAMENT.encode('utf-8'), t.as_text())
152
131
 
153
132
    def test___init__(self):
154
 
        revision = self.b.repository.get_revision(b'test@user-2')
155
 
        tree = self.b.repository.revision_tree(b'test@user-2')
156
 
        testament_1 = self.testament_class()(revision, tree)
157
 
        text_1 = testament_1.as_short_text()
158
 
        text_2 = self.from_revision(self.b.repository,
159
 
                                    b'test@user-2').as_short_text()
160
 
        self.assertEqual(text_1, text_2)
161
 
 
162
 
 
163
 
class TestamentTestsStrict(TestamentTests):
164
 
 
165
 
    def testament_class(self):
166
 
        return StrictTestament
167
 
 
168
 
 
169
 
class TestamentTestsStrict2(TestamentTests):
170
 
 
171
 
    def testament_class(self):
172
 
        return StrictTestament3
173
 
 
174
 
 
175
 
REV_1_TESTAMENT = b"""\
176
 
bazaar-ng testament version 1
177
 
revision-id: test@user-1
178
 
committer: test@user
179
 
timestamp: 1129025423
180
 
timezone: 0
181
 
parents:
182
 
message:
183
 
  initial null commit
184
 
inventory:
185
 
properties:
186
 
  branch-nick:
187
 
    test branch
188
 
"""
189
 
 
190
 
 
191
 
REV_1_STRICT_TESTAMENT = b"""\
192
 
bazaar-ng testament version 2.1
193
 
revision-id: test@user-1
194
 
committer: test@user
195
 
timestamp: 1129025423
196
 
timezone: 0
197
 
parents:
198
 
message:
199
 
  initial null commit
200
 
inventory:
201
 
properties:
202
 
  branch-nick:
203
 
    test branch
204
 
"""
205
 
 
206
 
 
207
 
REV_1_STRICT_TESTAMENT3 = b"""\
208
 
bazaar testament version 3 strict
209
 
revision-id: test@user-1
210
 
committer: test@user
211
 
timestamp: 1129025423
212
 
timezone: 0
213
 
parents:
214
 
message:
215
 
  initial null commit
216
 
inventory:
217
 
  directory . TREE_ROT test@user-1 no
218
 
properties:
219
 
  branch-nick:
220
 
    test branch
221
 
"""
222
 
 
223
 
 
224
 
REV_1_SHORT = b"""\
225
 
bazaar-ng testament short form 1
226
 
revision-id: test@user-1
227
 
sha1: %s
228
 
""" % osutils.sha_string(REV_1_TESTAMENT)
229
 
 
230
 
 
231
 
REV_1_SHORT_STRICT = b"""\
232
 
bazaar-ng testament short form 2.1
233
 
revision-id: test@user-1
234
 
sha1: %s
235
 
""" % osutils.sha_string(REV_1_STRICT_TESTAMENT)
236
 
 
237
 
 
238
 
REV_1_SHORT_STRICT3 = b"""\
239
 
bazaar testament short form 3 strict
240
 
revision-id: test@user-1
241
 
sha1: %s
242
 
""" % osutils.sha_string(REV_1_STRICT_TESTAMENT3)
243
 
 
244
 
 
245
 
REV_2_TESTAMENT = b"""\
246
 
bazaar-ng testament version 1
247
 
revision-id: test@user-2
248
 
committer: test@user
249
 
timestamp: 1129025483
250
 
timezone: 36000
251
 
parents:
252
 
  test@user-1
253
 
message:
254
 
  add files and directories
255
 
inventory:
256
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
257
 
  directory src src-id
258
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
259
 
properties:
260
 
  branch-nick:
261
 
    test branch
262
 
"""
263
 
 
264
 
 
265
 
REV_2_STRICT_TESTAMENT = b"""\
266
 
bazaar-ng testament version 2.1
267
 
revision-id: test@user-2
268
 
committer: test@user
269
 
timestamp: 1129025483
270
 
timezone: 36000
271
 
parents:
272
 
  test@user-1
273
 
message:
274
 
  add files and directories
275
 
inventory:
276
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
277
 
  directory src src-id test@user-2 no
278
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
279
 
properties:
280
 
  branch-nick:
281
 
    test branch
282
 
"""
283
 
 
284
 
 
285
 
REV_2_STRICT_TESTAMENT3 = b"""\
286
 
bazaar testament version 3 strict
287
 
revision-id: test@user-2
288
 
committer: test@user
289
 
timestamp: 1129025483
290
 
timezone: 36000
291
 
parents:
292
 
  test@user-1
293
 
message:
294
 
  add files and directories
295
 
inventory:
296
 
  directory . TREE_ROT test@user-1 no
297
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
298
 
  directory src src-id test@user-2 no
299
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
300
 
properties:
301
 
  branch-nick:
302
 
    test branch
303
 
"""
304
 
 
305
 
 
306
 
REV_2_SHORT = b"""\
307
 
bazaar-ng testament short form 1
308
 
revision-id: test@user-2
309
 
sha1: %s
310
 
""" % osutils.sha_string(REV_2_TESTAMENT)
311
 
 
312
 
 
313
 
REV_2_SHORT_STRICT = b"""\
314
 
bazaar-ng testament short form 2.1
315
 
revision-id: test@user-2
316
 
sha1: %s
317
 
""" % osutils.sha_string(REV_2_STRICT_TESTAMENT)
318
 
 
319
 
 
320
 
REV_2_SHORT_STRICT3 = b"""\
321
 
bazaar testament short form 3 strict
322
 
revision-id: test@user-2
323
 
sha1: %s
324
 
""" % osutils.sha_string(REV_2_STRICT_TESTAMENT3)
325
 
 
326
 
 
327
 
REV_PROPS_TESTAMENT = b"""\
328
 
bazaar-ng testament version 1
329
 
revision-id: test@user-3
330
 
committer: test@user
331
 
timestamp: 1129025493
332
 
timezone: 36000
333
 
parents:
334
 
  test@user-2
335
 
message:
336
 
  revision with properties
337
 
inventory:
338
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
339
 
  directory src src-id
340
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
341
 
properties:
342
 
  branch-nick:
343
 
    test branch
344
 
  empty:
345
 
  flavor:
346
 
    sour cherry
347
 
    cream cheese
348
 
  size:
349
 
    medium
350
 
"""
351
 
 
352
 
 
353
 
REV_PROPS_TESTAMENT_STRICT = b"""\
354
 
bazaar-ng testament version 2.1
355
 
revision-id: test@user-3
356
 
committer: test@user
357
 
timestamp: 1129025493
358
 
timezone: 36000
359
 
parents:
360
 
  test@user-2
361
 
message:
362
 
  revision with properties
363
 
inventory:
364
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
365
 
  directory src src-id test@user-2 no
366
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
367
 
properties:
368
 
  branch-nick:
369
 
    test branch
370
 
  empty:
371
 
  flavor:
372
 
    sour cherry
373
 
    cream cheese
374
 
  size:
375
 
    medium
376
 
"""
377
 
 
378
 
 
379
 
REV_PROPS_TESTAMENT_STRICT3 = b"""\
380
 
bazaar testament version 3 strict
381
 
revision-id: test@user-3
382
 
committer: test@user
383
 
timestamp: 1129025493
384
 
timezone: 36000
385
 
parents:
386
 
  test@user-2
387
 
message:
388
 
  revision with properties
389
 
inventory:
390
 
  directory . TREE_ROT test@user-1 no
391
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
392
 
  directory src src-id test@user-2 no
393
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
394
 
properties:
395
 
  branch-nick:
396
 
    test branch
397
 
  empty:
398
 
  flavor:
399
 
    sour cherry
400
 
    cream cheese
401
 
  size:
402
 
    medium
403
 
"""
404
 
 
405
 
 
406
 
REV_3_TESTAMENT = b"""\
 
133
        revision = self.b.repository.get_revision('test@user-2')
 
134
        inventory = self.b.repository.get_inventory('test@user-2')
 
135
        testament_1 = Testament(revision, inventory).as_short_text()
 
136
        testament_2 = Testament.from_revision(self.b.repository, 
 
137
                                              'test@user-2').as_short_text()
 
138
        self.assertEqual(testament_1, testament_2)
 
139
                    
 
140
 
 
141
REV_1_TESTAMENT = """\
 
142
bazaar-ng testament version 1
 
143
revision-id: test@user-1
 
144
committer: test@user
 
145
timestamp: 1129025423
 
146
timezone: 0
 
147
parents:
 
148
message:
 
149
  initial null commit
 
150
inventory:
 
151
properties:
 
152
  branch-nick:
 
153
    test branch
 
154
"""
 
155
 
 
156
REV_1_SHORT = """\
 
157
bazaar-ng testament short form 1
 
158
revision-id: test@user-1
 
159
sha1: %s
 
160
""" % sha(REV_1_TESTAMENT).hexdigest()
 
161
 
 
162
 
 
163
REV_2_TESTAMENT = """\
 
164
bazaar-ng testament version 1
 
165
revision-id: test@user-2
 
166
committer: test@user
 
167
timestamp: 1129025483
 
168
timezone: 36000
 
169
parents:
 
170
  test@user-1
 
171
message:
 
172
  add files and directories
 
173
inventory:
 
174
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 
175
  directory src src-id
 
176
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 
177
properties:
 
178
  branch-nick:
 
179
    test branch
 
180
"""
 
181
 
 
182
 
 
183
REV_2_SHORT = """\
 
184
bazaar-ng testament short form 1
 
185
revision-id: test@user-2
 
186
sha1: %s
 
187
""" % sha(REV_2_TESTAMENT).hexdigest()
 
188
 
 
189
 
 
190
REV_PROPS_TESTAMENT = """\
 
191
bazaar-ng testament version 1
 
192
revision-id: test@user-3
 
193
committer: test@user
 
194
timestamp: 1129025493
 
195
timezone: 36000
 
196
parents:
 
197
  test@user-2
 
198
message:
 
199
  revision with properties
 
200
inventory:
 
201
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 
202
  directory src src-id
 
203
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 
204
properties:
 
205
  branch-nick:
 
206
    test branch
 
207
  flavor:
 
208
    sour cherry
 
209
    cream cheese
 
210
  size:
 
211
    medium
 
212
"""
 
213
 
 
214
 
 
215
REV_3_TESTAMENT = """\
407
216
bazaar-ng testament version 1
408
217
revision-id: test@user-3
409
218
committer: test@user
424
233
"""
425
234
 
426
235
 
427
 
REV_3_TESTAMENT_STRICT = b"""\
428
 
bazaar-ng testament version 2.1
429
 
revision-id: test@user-3
430
 
committer: test@user
431
 
timestamp: 1129025493
432
 
timezone: 36000
433
 
parents:
434
 
  test@user-2
435
 
message:
436
 
  add symlink
437
 
inventory:
438
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
439
 
  symlink link link-id wibble/linktarget test@user-3 no
440
 
  directory src src-id test@user-2 no
441
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
442
 
properties:
443
 
  branch-nick:
444
 
    test branch
445
 
"""
446
 
 
447
 
 
448
 
REV_3_TESTAMENT_STRICT3 = b"""\
449
 
bazaar testament version 3 strict
450
 
revision-id: test@user-3
451
 
committer: test@user
452
 
timestamp: 1129025493
453
 
timezone: 36000
454
 
parents:
455
 
  test@user-2
456
 
message:
457
 
  add symlink
458
 
inventory:
459
 
  directory . TREE_ROT test@user-1 no
460
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
461
 
  symlink link link-id wibble/linktarget test@user-3 no
462
 
  directory src src-id test@user-2 no
463
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
464
 
properties:
465
 
  branch-nick:
466
 
    test branch
467
 
"""
468
 
 
469
 
 
470
236
SAMPLE_UNICODE_TESTAMENT = u"""\
471
237
bazaar-ng testament version 1
472
238
revision-id: test@user-3
473
 
committer: Erik B\xe5gfors <test@user>
 
239
committer: test@user
474
240
timestamp: 1129025493
475
241
timezone: 36000
476
242
parents:
484
250
properties:
485
251
  branch-nick:
486
252
    test branch
487
 
  uni:
488
 
    \xb5
489
 
"""
490
 
 
491
 
 
492
 
SAMPLE_UNICODE_TESTAMENT_STRICT = u"""\
493
 
bazaar-ng testament version 2.1
494
 
revision-id: test@user-3
495
 
committer: Erik B\xe5gfors <test@user>
496
 
timestamp: 1129025493
497
 
timezone: 36000
498
 
parents:
499
 
  test@user-2
500
 
message:
501
 
  non-ascii commit \N{COPYRIGHT SIGN} me
502
 
inventory:
503
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
504
 
  directory src src-id test@user-2 no
505
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
506
 
properties:
507
 
  branch-nick:
508
 
    test branch
509
 
  uni:
510
 
    \xb5
511
 
"""
512
 
 
513
 
 
514
 
SAMPLE_UNICODE_TESTAMENT_STRICT3 = u"""\
515
 
bazaar testament version 3 strict
516
 
revision-id: test@user-3
517
 
committer: Erik B\xe5gfors <test@user>
518
 
timestamp: 1129025493
519
 
timezone: 36000
520
 
parents:
521
 
  test@user-2
522
 
message:
523
 
  non-ascii commit \N{COPYRIGHT SIGN} me
524
 
inventory:
525
 
  directory . TREE_ROT test@user-1 no
526
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
527
 
  directory src src-id test@user-2 no
528
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
529
 
properties:
530
 
  branch-nick:
531
 
    test branch
532
 
  uni:
533
 
    \xb5
534
 
"""
535
 
 
536
 
 
537
 
texts = {
538
 
    Testament: {'rev_1': REV_1_TESTAMENT,
539
 
                'rev_1_short': REV_1_SHORT,
540
 
                'rev_2': REV_2_TESTAMENT,
541
 
                'rev_2_short': REV_2_SHORT,
542
 
                'rev_3': REV_3_TESTAMENT,
543
 
                'rev_props': REV_PROPS_TESTAMENT,
544
 
                'sample_unicode': SAMPLE_UNICODE_TESTAMENT,
545
 
                },
546
 
    StrictTestament: {'rev_1': REV_1_STRICT_TESTAMENT,
547
 
                      'rev_1_short': REV_1_SHORT_STRICT,
548
 
                      'rev_2': REV_2_STRICT_TESTAMENT,
549
 
                      'rev_2_short': REV_2_SHORT_STRICT,
550
 
                      'rev_3': REV_3_TESTAMENT_STRICT,
551
 
                      'rev_props': REV_PROPS_TESTAMENT_STRICT,
552
 
                      'sample_unicode': SAMPLE_UNICODE_TESTAMENT_STRICT,
553
 
                      },
554
 
    StrictTestament3: {'rev_1': REV_1_STRICT_TESTAMENT3,
555
 
                       'rev_1_short': REV_1_SHORT_STRICT3,
556
 
                       'rev_2': REV_2_STRICT_TESTAMENT3,
557
 
                       'rev_2_short': REV_2_SHORT_STRICT3,
558
 
                       'rev_3': REV_3_TESTAMENT_STRICT3,
559
 
                       'rev_props': REV_PROPS_TESTAMENT_STRICT3,
560
 
                       'sample_unicode': SAMPLE_UNICODE_TESTAMENT_STRICT3,
561
 
                       },
562
 
}
 
253
"""