bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
2052.3.1
by John Arbash Meinel
 Add tests to cleanup the copyright of all source files  | 
1  | 
# Copyright (C) 2005, 2006 Canonical Ltd
 | 
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
2  | 
#
 | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
7  | 
#
 | 
|
8  | 
# This program is distributed in the hope that it will be useful,
 | 
|
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
12  | 
#
 | 
|
13  | 
# You should have received a copy of the GNU General Public License
 | 
|
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
17  | 
"""Test testaments for gpg signing."""
 | 
|
18  | 
||
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
19  | 
# TODO: Testaments with x-bits
 | 
| 
1185.16.23
by Martin Pool
 - clean up imports  | 
20  | 
|
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
21  | 
import os  | 
| 
1185.16.22
by Martin Pool
 - more testament development  | 
22  | 
from sha import sha  | 
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
23  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
24  | 
from bzrlib.tests import TestCaseWithTransport  | 
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
25  | 
from bzrlib.testament import Testament, StrictTestament, StrictTestament3  | 
| 
1551.7.5
by Aaron Bentley
 Make sure strict testaments indicate when an execute bit is true  | 
26  | 
from bzrlib.transform import TreeTransform  | 
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
27  | 
from bzrlib.osutils import has_symlinks  | 
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
28  | 
|
| 
1442.1.62
by Robert Collins
 Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.  | 
29  | 
|
| 
1930.2.1
by John Arbash Meinel
 Move out the blackbox testament tests into a real blackbox module  | 
30  | 
class TestamentSetup(TestCaseWithTransport):  | 
| 
1442.1.62
by Robert Collins
 Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.  | 
31  | 
|
| 
1185.16.15
by Martin Pool
 - test text form for testaments  | 
32  | 
def setUp(self):  | 
| 
1930.2.1
by John Arbash Meinel
 Move out the blackbox testament tests into a real blackbox module  | 
33  | 
super(TestamentSetup, self).setUp()  | 
| 
2255.2.194
by Robert Collins
 [BROKEN] Many updates to stop using experimental formats in tests.  | 
34  | 
self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')  | 
| 
1731.1.53
by Aaron Bentley
 Fix testament text now that root are variable  | 
35  | 
self.wt.set_root_id('TREE_ROT')  | 
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
36  | 
b = self.b = self.wt.branch  | 
| 
1185.35.16
by Aaron Bentley
 Fixed tests  | 
37  | 
b.nick = "test branch"  | 
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
38  | 
self.wt.commit(message='initial null commit',  | 
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
39  | 
committer='test@user',  | 
40  | 
timestamp=1129025423, # 'Tue Oct 11 20:10:23 2005'  | 
|
41  | 
timezone=0,  | 
|
42  | 
rev_id='test@user-1')  | 
|
| 
1514
by Robert Collins
 Unbreak self.build_tree_shape in tests.  | 
43  | 
self.build_tree_contents([('hello', 'contents of hello file'),  | 
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
44  | 
('src/', ),  | 
| 
1185.16.22
by Martin Pool
 - more testament development  | 
45  | 
('src/foo.c', 'int main()\n{\n}\n')])  | 
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
46  | 
self.wt.add(['hello', 'src', 'src/foo.c'],  | 
| 
1508.1.5
by Robert Collins
 Move add from Branch to WorkingTree.  | 
47  | 
['hello-id', 'src-id', 'foo.c-id'])  | 
| 
1551.7.5
by Aaron Bentley
 Make sure strict testaments indicate when an execute bit is true  | 
48  | 
tt = TreeTransform(self.wt)  | 
49  | 
trans_id = tt.trans_id_tree_path('hello')  | 
|
50  | 
tt.set_executability(True, trans_id)  | 
|
51  | 
tt.apply()  | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
52  | 
self.wt.commit(message='add files and directories',  | 
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
53  | 
timestamp=1129025483,  | 
54  | 
timezone=36000,  | 
|
55  | 
rev_id='test@user-2',  | 
|
56  | 
committer='test@user')  | 
|
| 
1185.16.15
by Martin Pool
 - test text form for testaments  | 
57  | 
|
| 
1930.2.1
by John Arbash Meinel
 Move out the blackbox testament tests into a real blackbox module  | 
58  | 
|
59  | 
class TestamentTests(TestamentSetup):  | 
|
60  | 
||
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
61  | 
def testament_class(self):  | 
62  | 
return Testament  | 
|
63  | 
||
64  | 
def expected(self, key):  | 
|
65  | 
return texts[self.testament_class()][key]  | 
|
66  | 
||
67  | 
def from_revision(self, repository, revision_id):  | 
|
68  | 
return self.testament_class().from_revision(repository, revision_id)  | 
|
69  | 
||
| 
1185.16.15
by Martin Pool
 - test text form for testaments  | 
70  | 
def test_null_testament(self):  | 
71  | 
"""Testament for a revision with no contents."""  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
72  | 
t = self.from_revision(self.b.repository, 'test@user-1')  | 
| 
1185.16.12
by Martin Pool
 - basic testament class  | 
73  | 
ass = self.assertTrue  | 
74  | 
eq = self.assertEqual  | 
|
75  | 
ass(isinstance(t, Testament))  | 
|
76  | 
eq(t.revision_id, 'test@user-1')  | 
|
77  | 
eq(t.committer, 'test@user')  | 
|
78  | 
eq(t.timestamp, 1129025423)  | 
|
79  | 
eq(t.timezone, 0)  | 
|
80  | 
||
| 
1185.16.15
by Martin Pool
 - test text form for testaments  | 
81  | 
def test_testment_text_form(self):  | 
82  | 
"""Conversion of testament to canonical text form."""  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
83  | 
t = self.from_revision(self.b.repository, 'test@user-1')  | 
84  | 
text_form = t.as_text()  | 
|
85  | 
self.log('testament text form:\n' + text_form)  | 
|
86  | 
self.assertEqualDiff(text_form, self.expected('rev_1'))  | 
|
87  | 
short_text_form = t.as_short_text()  | 
|
88  | 
self.assertEqualDiff(short_text_form, self.expected('rev_1_short'))  | 
|
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
89  | 
|
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
90  | 
def test_testament_with_contents(self):  | 
91  | 
"""Testament containing a file and a directory."""  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
92  | 
t = self.from_revision(self.b.repository, 'test@user-2')  | 
93  | 
text_form = t.as_text()  | 
|
94  | 
self.log('testament text form:\n' + text_form)  | 
|
95  | 
self.assertEqualDiff(text_form, self.expected('rev_2'))  | 
|
96  | 
actual_short = t.as_short_text()  | 
|
97  | 
self.assertEqualDiff(actual_short, self.expected('rev_2_short'))  | 
|
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
98  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
99  | 
def test_testament_symlinks(self):  | 
100  | 
"""Testament containing symlink (where possible)"""  | 
|
101  | 
if not has_symlinks():  | 
|
102  | 
            return
 | 
|
103  | 
os.symlink('wibble/linktarget', 'link')  | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
104  | 
self.wt.add(['link'], ['link-id'])  | 
105  | 
self.wt.commit(message='add symlink',  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
106  | 
timestamp=1129025493,  | 
107  | 
timezone=36000,  | 
|
108  | 
rev_id='test@user-3',  | 
|
109  | 
committer='test@user')  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
110  | 
t = self.from_revision(self.b.repository, 'test@user-3')  | 
111  | 
self.assertEqualDiff(t.as_text(), self.expected('rev_3'))  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
112  | 
|
| 
1185.16.59
by mbp at sourcefrog
 - store revprops in testaments  | 
113  | 
def test_testament_revprops(self):  | 
114  | 
"""Testament to revision with extra properties"""  | 
|
115  | 
props = dict(flavor='sour cherry\ncream cheese',  | 
|
| 
1886.1.5
by John Arbash Meinel
 Assert that Testament can handle empty revprops as well  | 
116  | 
size='medium',  | 
117  | 
empty='',  | 
|
118  | 
                    )
 | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
119  | 
self.wt.commit(message='revision with properties',  | 
| 
1185.16.59
by mbp at sourcefrog
 - store revprops in testaments  | 
120  | 
timestamp=1129025493,  | 
121  | 
timezone=36000,  | 
|
122  | 
rev_id='test@user-3',  | 
|
123  | 
committer='test@user',  | 
|
124  | 
revprops=props)  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
125  | 
t = self.from_revision(self.b.repository, 'test@user-3')  | 
126  | 
self.assertEqualDiff(t.as_text(), self.expected('rev_props'))  | 
|
| 
1442.1.62
by Robert Collins
 Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.  | 
127  | 
|
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
128  | 
def test_testament_unicode_commit_message(self):  | 
| 
1558.1.3
by Aaron Bentley
 Fixed deprecated op use in test suite  | 
129  | 
self.wt.commit(  | 
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
130  | 
message=u'non-ascii commit \N{COPYRIGHT SIGN} me',  | 
131  | 
timestamp=1129025493,  | 
|
132  | 
timezone=36000,  | 
|
133  | 
rev_id='test@user-3',  | 
|
| 
1930.2.2
by John Arbash Meinel
 Avoid needless encode/decode. Only encode at the boundary (as suggested by hpk)  | 
134  | 
committer='Erik B\xe5gfors <test@user>',  | 
135  | 
revprops={'uni':u'\xb5'}  | 
|
136  | 
            )
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
137  | 
t = self.from_revision(self.b.repository, 'test@user-3')  | 
| 
1553.3.4
by Marien Zwart
 Move the encoding step into the test to make it more obvious we are comparing bytestrings.  | 
138  | 
self.assertEqualDiff(  | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
139  | 
self.expected('sample_unicode').encode('utf-8'), t.as_text())  | 
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
140  | 
|
| 
1442.1.62
by Robert Collins
 Allow creation of testaments from uncommitted data, and use that to get signatures before committing revisions.  | 
141  | 
def test___init__(self):  | 
| 
1185.67.2
by Aaron Bentley
 Renamed Branch.storage to Branch.repository  | 
142  | 
revision = self.b.repository.get_revision('test@user-2')  | 
143  | 
inventory = self.b.repository.get_inventory('test@user-2')  | 
|
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
144  | 
testament_1 = self.testament_class()(revision, inventory)  | 
145  | 
text_1 = testament_1.as_short_text()  | 
|
146  | 
text_2 = self.from_revision(self.b.repository,  | 
|
147  | 
'test@user-2').as_short_text()  | 
|
148  | 
self.assertEqual(text_1, text_2)  | 
|
| 
1185.16.59
by mbp at sourcefrog
 - store revprops in testaments  | 
149  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
150  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
151  | 
class TestamentTestsStrict(TestamentTests):  | 
152  | 
||
153  | 
def testament_class(self):  | 
|
154  | 
return StrictTestament  | 
|
155  | 
||
156  | 
||
157  | 
class TestamentTestsStrict2(TestamentTests):  | 
|
158  | 
||
159  | 
def testament_class(self):  | 
|
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
160  | 
return StrictTestament3  | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
161  | 
|
162  | 
||
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
163  | 
REV_1_TESTAMENT = """\  | 
164  | 
bazaar-ng testament version 1
 | 
|
165  | 
revision-id: test@user-1
 | 
|
166  | 
committer: test@user
 | 
|
167  | 
timestamp: 1129025423
 | 
|
168  | 
timezone: 0
 | 
|
169  | 
parents:
 | 
|
170  | 
message:
 | 
|
171  | 
  initial null commit
 | 
|
172  | 
inventory:
 | 
|
| 
1185.35.16
by Aaron Bentley
 Fixed tests  | 
173  | 
properties:
 | 
174  | 
  branch-nick:
 | 
|
175  | 
    test branch
 | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
176  | 
"""
 | 
177  | 
||
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
178  | 
|
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
179  | 
REV_1_STRICT_TESTAMENT = """\  | 
180  | 
bazaar-ng testament version 2.1
 | 
|
181  | 
revision-id: test@user-1
 | 
|
182  | 
committer: test@user
 | 
|
183  | 
timestamp: 1129025423
 | 
|
184  | 
timezone: 0
 | 
|
185  | 
parents:
 | 
|
186  | 
message:
 | 
|
187  | 
  initial null commit
 | 
|
188  | 
inventory:
 | 
|
189  | 
properties:
 | 
|
190  | 
  branch-nick:
 | 
|
191  | 
    test branch
 | 
|
192  | 
"""
 | 
|
193  | 
||
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
194  | 
|
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
195  | 
REV_1_STRICT_TESTAMENT3 = """\  | 
196  | 
bazaar testament version 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
197  | 
revision-id: test@user-1
 | 
198  | 
committer: test@user
 | 
|
199  | 
timestamp: 1129025423
 | 
|
200  | 
timezone: 0
 | 
|
201  | 
parents:
 | 
|
202  | 
message:
 | 
|
203  | 
  initial null commit
 | 
|
204  | 
inventory:
 | 
|
| 
1731.1.53
by Aaron Bentley
 Fix testament text now that root are variable  | 
205  | 
  directory . TREE_ROT test@user-1 no
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
206  | 
properties:
 | 
207  | 
  branch-nick:
 | 
|
208  | 
    test branch
 | 
|
209  | 
"""
 | 
|
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
210  | 
|
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
211  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
212  | 
REV_1_SHORT = """\  | 
213  | 
bazaar-ng testament short form 1
 | 
|
214  | 
revision-id: test@user-1
 | 
|
215  | 
sha1: %s  | 
|
216  | 
""" % sha(REV_1_TESTAMENT).hexdigest()  | 
|
217  | 
||
| 
1185.16.24
by Martin Pool
 - add and test 'testament' builtin command  | 
218  | 
|
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
219  | 
REV_1_SHORT_STRICT = """\  | 
220  | 
bazaar-ng testament short form 2.1
 | 
|
221  | 
revision-id: test@user-1
 | 
|
222  | 
sha1: %s  | 
|
223  | 
""" % sha(REV_1_STRICT_TESTAMENT).hexdigest()  | 
|
224  | 
||
225  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
226  | 
REV_1_SHORT_STRICT3 = """\  | 
227  | 
bazaar testament short form 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
228  | 
revision-id: test@user-1
 | 
229  | 
sha1: %s  | 
|
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
230  | 
""" % sha(REV_1_STRICT_TESTAMENT3).hexdigest()  | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
231  | 
|
232  | 
||
| 
1185.16.24
by Martin Pool
 - add and test 'testament' builtin command  | 
233  | 
REV_2_TESTAMENT = """\  | 
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
234  | 
bazaar-ng testament version 1
 | 
235  | 
revision-id: test@user-2
 | 
|
236  | 
committer: test@user
 | 
|
| 
1185.16.22
by Martin Pool
 - more testament development  | 
237  | 
timestamp: 1129025483
 | 
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
238  | 
timezone: 36000
 | 
239  | 
parents:
 | 
|
240  | 
  test@user-1
 | 
|
241  | 
message:
 | 
|
242  | 
  add files and directories
 | 
|
243  | 
inventory:
 | 
|
| 
1185.16.22
by Martin Pool
 - more testament development  | 
244  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 | 
245  | 
  directory src src-id
 | 
|
246  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 | 
|
| 
1185.35.16
by Aaron Bentley
 Fixed tests  | 
247  | 
properties:
 | 
248  | 
  branch-nick:
 | 
|
249  | 
    test branch
 | 
|
| 
1185.16.19
by Martin Pool
 - testament now contains summary of parents and inventory  | 
250  | 
"""
 | 
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
251  | 
|
252  | 
||
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
253  | 
REV_2_STRICT_TESTAMENT = """\  | 
254  | 
bazaar-ng testament version 2.1
 | 
|
255  | 
revision-id: test@user-2
 | 
|
256  | 
committer: test@user
 | 
|
257  | 
timestamp: 1129025483
 | 
|
258  | 
timezone: 36000
 | 
|
259  | 
parents:
 | 
|
260  | 
  test@user-1
 | 
|
261  | 
message:
 | 
|
262  | 
  add files and directories
 | 
|
263  | 
inventory:
 | 
|
| 
1551.7.5
by Aaron Bentley
 Make sure strict testaments indicate when an execute bit is true  | 
264  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
265  | 
  directory src src-id test@user-2 no
 | 
266  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
267  | 
properties:
 | 
|
268  | 
  branch-nick:
 | 
|
269  | 
    test branch
 | 
|
270  | 
"""
 | 
|
271  | 
||
272  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
273  | 
REV_2_STRICT_TESTAMENT3 = """\  | 
274  | 
bazaar testament version 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
275  | 
revision-id: test@user-2
 | 
276  | 
committer: test@user
 | 
|
277  | 
timestamp: 1129025483
 | 
|
278  | 
timezone: 36000
 | 
|
279  | 
parents:
 | 
|
280  | 
  test@user-1
 | 
|
281  | 
message:
 | 
|
282  | 
  add files and directories
 | 
|
283  | 
inventory:
 | 
|
| 
2230.3.19
by Aaron Bentley
 Fix testament tests  | 
284  | 
  directory . TREE_ROT test@user-1 no
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
285  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
286  | 
  directory src src-id test@user-2 no
 | 
|
287  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
288  | 
properties:
 | 
|
289  | 
  branch-nick:
 | 
|
290  | 
    test branch
 | 
|
291  | 
"""
 | 
|
292  | 
||
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
293  | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
294  | 
REV_2_SHORT = """\  | 
295  | 
bazaar-ng testament short form 1
 | 
|
296  | 
revision-id: test@user-2
 | 
|
297  | 
sha1: %s  | 
|
298  | 
""" % sha(REV_2_TESTAMENT).hexdigest()  | 
|
299  | 
||
300  | 
||
| 
1551.7.1
by Aaron Bentley
 Implement --strict at commandline, fix up strict format  | 
301  | 
REV_2_SHORT_STRICT = """\  | 
302  | 
bazaar-ng testament short form 2.1
 | 
|
303  | 
revision-id: test@user-2
 | 
|
304  | 
sha1: %s  | 
|
305  | 
""" % sha(REV_2_STRICT_TESTAMENT).hexdigest()  | 
|
306  | 
||
307  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
308  | 
REV_2_SHORT_STRICT3 = """\  | 
309  | 
bazaar testament short form 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
310  | 
revision-id: test@user-2
 | 
311  | 
sha1: %s  | 
|
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
312  | 
""" % sha(REV_2_STRICT_TESTAMENT3).hexdigest()  | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
313  | 
|
314  | 
||
| 
1185.16.59
by mbp at sourcefrog
 - store revprops in testaments  | 
315  | 
REV_PROPS_TESTAMENT = """\  | 
316  | 
bazaar-ng testament version 1
 | 
|
317  | 
revision-id: test@user-3
 | 
|
318  | 
committer: test@user
 | 
|
319  | 
timestamp: 1129025493
 | 
|
320  | 
timezone: 36000
 | 
|
321  | 
parents:
 | 
|
322  | 
  test@user-2
 | 
|
323  | 
message:
 | 
|
324  | 
  revision with properties
 | 
|
325  | 
inventory:
 | 
|
326  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 | 
|
327  | 
  directory src src-id
 | 
|
328  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 | 
|
329  | 
properties:
 | 
|
| 
1185.35.16
by Aaron Bentley
 Fixed tests  | 
330  | 
  branch-nick:
 | 
331  | 
    test branch
 | 
|
| 
1886.1.5
by John Arbash Meinel
 Assert that Testament can handle empty revprops as well  | 
332  | 
  empty:
 | 
| 
1185.16.59
by mbp at sourcefrog
 - store revprops in testaments  | 
333  | 
  flavor:
 | 
334  | 
    sour cherry
 | 
|
335  | 
    cream cheese
 | 
|
336  | 
  size:
 | 
|
337  | 
    medium
 | 
|
338  | 
"""
 | 
|
339  | 
||
340  | 
||
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
341  | 
REV_PROPS_TESTAMENT_STRICT = """\  | 
342  | 
bazaar-ng testament version 2.1
 | 
|
343  | 
revision-id: test@user-3
 | 
|
344  | 
committer: test@user
 | 
|
345  | 
timestamp: 1129025493
 | 
|
346  | 
timezone: 36000
 | 
|
347  | 
parents:
 | 
|
348  | 
  test@user-2
 | 
|
349  | 
message:
 | 
|
350  | 
  revision with properties
 | 
|
351  | 
inventory:
 | 
|
352  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
|
353  | 
  directory src src-id test@user-2 no
 | 
|
354  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
355  | 
properties:
 | 
|
356  | 
  branch-nick:
 | 
|
357  | 
    test branch
 | 
|
358  | 
  empty:
 | 
|
359  | 
  flavor:
 | 
|
360  | 
    sour cherry
 | 
|
361  | 
    cream cheese
 | 
|
362  | 
  size:
 | 
|
363  | 
    medium
 | 
|
364  | 
"""
 | 
|
365  | 
||
366  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
367  | 
REV_PROPS_TESTAMENT_STRICT3 = """\  | 
368  | 
bazaar testament version 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
369  | 
revision-id: test@user-3
 | 
370  | 
committer: test@user
 | 
|
371  | 
timestamp: 1129025493
 | 
|
372  | 
timezone: 36000
 | 
|
373  | 
parents:
 | 
|
374  | 
  test@user-2
 | 
|
375  | 
message:
 | 
|
376  | 
  revision with properties
 | 
|
377  | 
inventory:
 | 
|
| 
2230.3.19
by Aaron Bentley
 Fix testament tests  | 
378  | 
  directory . TREE_ROT test@user-1 no
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
379  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
380  | 
  directory src src-id test@user-2 no
 | 
|
381  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
382  | 
properties:
 | 
|
383  | 
  branch-nick:
 | 
|
384  | 
    test branch
 | 
|
385  | 
  empty:
 | 
|
386  | 
  flavor:
 | 
|
387  | 
    sour cherry
 | 
|
388  | 
    cream cheese
 | 
|
389  | 
  size:
 | 
|
390  | 
    medium
 | 
|
391  | 
"""
 | 
|
392  | 
||
393  | 
||
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
394  | 
REV_3_TESTAMENT = """\  | 
395  | 
bazaar-ng testament version 1
 | 
|
396  | 
revision-id: test@user-3
 | 
|
397  | 
committer: test@user
 | 
|
398  | 
timestamp: 1129025493
 | 
|
399  | 
timezone: 36000
 | 
|
400  | 
parents:
 | 
|
401  | 
  test@user-2
 | 
|
402  | 
message:
 | 
|
403  | 
  add symlink
 | 
|
404  | 
inventory:
 | 
|
405  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 | 
|
406  | 
  symlink link link-id wibble/linktarget
 | 
|
407  | 
  directory src src-id
 | 
|
408  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 | 
|
| 
1185.35.16
by Aaron Bentley
 Fixed tests  | 
409  | 
properties:
 | 
410  | 
  branch-nick:
 | 
|
411  | 
    test branch
 | 
|
| 
1185.16.25
by Martin Pool
 - testament symlink support  | 
412  | 
"""
 | 
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
413  | 
|
| 
1553.3.3
by Marien Zwart
 Whitespace cleanup (pep 3)  | 
414  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
415  | 
REV_3_TESTAMENT_STRICT = """\  | 
416  | 
bazaar-ng testament version 2.1
 | 
|
417  | 
revision-id: test@user-3
 | 
|
418  | 
committer: test@user
 | 
|
419  | 
timestamp: 1129025493
 | 
|
420  | 
timezone: 36000
 | 
|
421  | 
parents:
 | 
|
422  | 
  test@user-2
 | 
|
423  | 
message:
 | 
|
424  | 
  add symlink
 | 
|
425  | 
inventory:
 | 
|
426  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
|
427  | 
  symlink link link-id wibble/linktarget test@user-3 no
 | 
|
428  | 
  directory src src-id test@user-2 no
 | 
|
429  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
430  | 
properties:
 | 
|
431  | 
  branch-nick:
 | 
|
432  | 
    test branch
 | 
|
433  | 
"""
 | 
|
434  | 
||
435  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
436  | 
REV_3_TESTAMENT_STRICT3 = """\  | 
437  | 
bazaar testament version 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
438  | 
revision-id: test@user-3
 | 
439  | 
committer: test@user
 | 
|
440  | 
timestamp: 1129025493
 | 
|
441  | 
timezone: 36000
 | 
|
442  | 
parents:
 | 
|
443  | 
  test@user-2
 | 
|
444  | 
message:
 | 
|
445  | 
  add symlink
 | 
|
446  | 
inventory:
 | 
|
| 
2230.3.19
by Aaron Bentley
 Fix testament tests  | 
447  | 
  directory . TREE_ROT test@user-1 no
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
448  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
449  | 
  symlink link link-id wibble/linktarget test@user-3 no
 | 
|
450  | 
  directory src src-id test@user-2 no
 | 
|
451  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
452  | 
properties:
 | 
|
453  | 
  branch-nick:
 | 
|
454  | 
    test branch
 | 
|
455  | 
"""
 | 
|
456  | 
||
| 
1910.2.62
by Aaron Bentley
 Cleanups  | 
457  | 
|
| 
1553.3.4
by Marien Zwart
 Move the encoding step into the test to make it more obvious we are comparing bytestrings.  | 
458  | 
SAMPLE_UNICODE_TESTAMENT = u"""\  | 
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
459  | 
bazaar-ng testament version 1
 | 
460  | 
revision-id: test@user-3
 | 
|
| 
1930.2.2
by John Arbash Meinel
 Avoid needless encode/decode. Only encode at the boundary (as suggested by hpk)  | 
461  | 
committer: Erik B\xe5gfors <test@user>  | 
| 
1553.3.1
by Marien Zwart
 Make Testament.as_text_lines return utf-8 instead of unicode objects and add a test for this.  | 
462  | 
timestamp: 1129025493
 | 
463  | 
timezone: 36000
 | 
|
464  | 
parents:
 | 
|
465  | 
  test@user-2
 | 
|
466  | 
message:
 | 
|
467  | 
non-ascii commit \N{COPYRIGHT SIGN} me  | 
|
468  | 
inventory:
 | 
|
469  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
 | 
|
470  | 
  directory src src-id
 | 
|
471  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
 | 
|
472  | 
properties:
 | 
|
473  | 
  branch-nick:
 | 
|
474  | 
    test branch
 | 
|
| 
1930.2.2
by John Arbash Meinel
 Avoid needless encode/decode. Only encode at the boundary (as suggested by hpk)  | 
475  | 
  uni:
 | 
476  | 
\xb5  | 
|
| 
1553.3.4
by Marien Zwart
 Move the encoding step into the test to make it more obvious we are comparing bytestrings.  | 
477  | 
"""
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
478  | 
|
479  | 
||
480  | 
SAMPLE_UNICODE_TESTAMENT_STRICT = u"""\  | 
|
481  | 
bazaar-ng testament version 2.1
 | 
|
482  | 
revision-id: test@user-3
 | 
|
483  | 
committer: Erik B\xe5gfors <test@user>  | 
|
484  | 
timestamp: 1129025493
 | 
|
485  | 
timezone: 36000
 | 
|
486  | 
parents:
 | 
|
487  | 
  test@user-2
 | 
|
488  | 
message:
 | 
|
489  | 
non-ascii commit \N{COPYRIGHT SIGN} me  | 
|
490  | 
inventory:
 | 
|
491  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
|
492  | 
  directory src src-id test@user-2 no
 | 
|
493  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
494  | 
properties:
 | 
|
495  | 
  branch-nick:
 | 
|
496  | 
    test branch
 | 
|
497  | 
  uni:
 | 
|
498  | 
\xb5  | 
|
499  | 
"""
 | 
|
500  | 
||
501  | 
||
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
502  | 
SAMPLE_UNICODE_TESTAMENT_STRICT3 = u"""\  | 
503  | 
bazaar testament version 3 strict
 | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
504  | 
revision-id: test@user-3
 | 
505  | 
committer: Erik B\xe5gfors <test@user>  | 
|
506  | 
timestamp: 1129025493
 | 
|
507  | 
timezone: 36000
 | 
|
508  | 
parents:
 | 
|
509  | 
  test@user-2
 | 
|
510  | 
message:
 | 
|
511  | 
non-ascii commit \N{COPYRIGHT SIGN} me  | 
|
512  | 
inventory:
 | 
|
| 
2230.3.19
by Aaron Bentley
 Fix testament tests  | 
513  | 
  directory . TREE_ROT test@user-1 no
 | 
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
514  | 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73 test@user-2 yes
 | 
515  | 
  directory src src-id test@user-2 no
 | 
|
516  | 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24 test@user-2 no
 | 
|
517  | 
properties:
 | 
|
518  | 
  branch-nick:
 | 
|
519  | 
    test branch
 | 
|
520  | 
  uni:
 | 
|
521  | 
\xb5  | 
|
522  | 
"""
 | 
|
523  | 
||
524  | 
||
525  | 
texts = {  | 
|
526  | 
Testament: { 'rev_1': REV_1_TESTAMENT,  | 
|
527  | 
'rev_1_short': REV_1_SHORT,  | 
|
528  | 
'rev_2': REV_2_TESTAMENT,  | 
|
529  | 
'rev_2_short': REV_2_SHORT,  | 
|
530  | 
'rev_3': REV_3_TESTAMENT,  | 
|
531  | 
'rev_props': REV_PROPS_TESTAMENT,  | 
|
532  | 
'sample_unicode': SAMPLE_UNICODE_TESTAMENT,  | 
|
533  | 
    },
 | 
|
534  | 
StrictTestament: {'rev_1': REV_1_STRICT_TESTAMENT,  | 
|
535  | 
'rev_1_short': REV_1_SHORT_STRICT,  | 
|
536  | 
'rev_2': REV_2_STRICT_TESTAMENT,  | 
|
537  | 
'rev_2_short': REV_2_SHORT_STRICT,  | 
|
538  | 
'rev_3': REV_3_TESTAMENT_STRICT,  | 
|
539  | 
'rev_props': REV_PROPS_TESTAMENT_STRICT,  | 
|
540  | 
'sample_unicode': SAMPLE_UNICODE_TESTAMENT_STRICT,  | 
|
541  | 
    },
 | 
|
| 
1910.2.64
by Aaron Bentley
 Changes from review  | 
542  | 
StrictTestament3: {'rev_1': REV_1_STRICT_TESTAMENT3,  | 
543  | 
'rev_1_short': REV_1_SHORT_STRICT3,  | 
|
544  | 
'rev_2': REV_2_STRICT_TESTAMENT3,  | 
|
545  | 
'rev_2_short': REV_2_SHORT_STRICT3,  | 
|
546  | 
'rev_3': REV_3_TESTAMENT_STRICT3,  | 
|
547  | 
'rev_props': REV_PROPS_TESTAMENT_STRICT3,  | 
|
548  | 
'sample_unicode': SAMPLE_UNICODE_TESTAMENT_STRICT3,  | 
|
| 
1910.2.54
by Aaron Bentley
 Implement testament format 3 strict  | 
549  | 
    },
 | 
550  | 
}
 |