~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testtestament.py

- refactor handling of short option names

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib.trace import mutter
30
30
from bzrlib.osutils import has_symlinks
31
31
 
32
 
 
33
32
class TestamentTests(TestCaseInTempDir):
34
 
 
35
33
    def setUp(self):
36
34
        super(TestamentTests, self).setUp()
37
35
        b = self.b = Branch.initialize('.')
104
102
        t = Testament.from_revision(self.b, 'test@user-3')
105
103
        self.assertEqualDiff(t.as_text(), REV_3_TESTAMENT)
106
104
 
107
 
    def test_testament_revprops(self):
108
 
        """Testament to revision with extra properties"""
109
 
        props = dict(flavor='sour cherry\ncream cheese',
110
 
                     size='medium')
111
 
        self.b.commit(message='revision with properties',
112
 
                      timestamp=1129025493,
113
 
                      timezone=36000,
114
 
                      rev_id='test@user-3',
115
 
                      committer='test@user',
116
 
                      revprops=props)
117
 
        t = Testament.from_revision(self.b, 'test@user-3')
118
 
        self.assertEqualDiff(t.as_text(), REV_PROPS_TESTAMENT)
119
 
 
120
 
    def test___init__(self):
121
 
        revision = self.b.get_revision('test@user-2')
122
 
        inventory = self.b.get_inventory('test@user-2')
123
 
        testament_1 = Testament(revision, inventory).as_short_text()
124
 
        testament_2 = Testament.from_revision(self.b, 
125
 
                                              'test@user-2').as_short_text()
126
 
        self.assertEqual(testament_1, testament_2)
127
 
                    
128
105
 
129
106
REV_1_TESTAMENT = """\
130
107
bazaar-ng testament version 1
169
146
""" % sha(REV_2_TESTAMENT).hexdigest()
170
147
 
171
148
 
172
 
REV_PROPS_TESTAMENT = """\
173
 
bazaar-ng testament version 1
174
 
revision-id: test@user-3
175
 
committer: test@user
176
 
timestamp: 1129025493
177
 
timezone: 36000
178
 
parents:
179
 
  test@user-2
180
 
message:
181
 
  revision with properties
182
 
inventory:
183
 
  file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
184
 
  directory src src-id
185
 
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
186
 
properties:
187
 
  flavor:
188
 
    sour cherry
189
 
    cream cheese
190
 
  size:
191
 
    medium
192
 
"""
193
 
 
194
 
 
195
149
REV_3_TESTAMENT = """\
196
150
bazaar-ng testament version 1
197
151
revision-id: test@user-3