253
253
self.get_branch().repository.get_revision,
257
# compare the gpg-to-sign info for a commit with a ghost and
258
# an identical tree without a ghost
259
# fetch missing should rewrite the TOC of weaves to list newly available parents.
261
def test_sign_existing_revision(self):
262
wt = self.make_branch_and_tree('.')
264
wt.commit("base", allow_pointless=True, rev_id='A')
265
from bzrlib.testament import Testament
266
strategy = gpg.LoopbackGPGStrategy(None)
267
branch.repository.lock_write()
268
branch.repository.start_write_group()
269
branch.repository.sign_revision('A', strategy)
270
branch.repository.commit_write_group()
271
branch.repository.unlock()
272
self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n' +
273
Testament.from_revision(branch.repository,
274
'A').as_short_text() +
275
'-----END PSEUDO-SIGNED CONTENT-----\n',
276
branch.repository.get_signature_text('A'))
278
def test_store_signature(self):
279
wt = self.make_branch_and_tree('.')
283
branch.repository.start_write_group()
285
branch.repository.store_revision_signature(
286
gpg.LoopbackGPGStrategy(None), 'FOO', 'A')
288
branch.repository.abort_write_group()
291
branch.repository.commit_write_group()
294
# A signature without a revision should not be accessible.
295
self.assertRaises(errors.NoSuchRevision,
296
branch.repository.has_signature_for_revision_id,
298
wt.commit("base", allow_pointless=True, rev_id='A')
299
self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n'
300
'FOO-----END PSEUDO-SIGNED CONTENT-----\n',
301
branch.repository.get_signature_text('A'))
303
def test_branch_keeps_signatures(self):
304
wt = self.make_branch_and_tree('source')
305
wt.commit('A', allow_pointless=True, rev_id='A')
306
repo = wt.branch.repository
308
repo.start_write_group()
309
repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
310
repo.commit_write_group()
312
#FIXME: clone should work to urls,
313
# wt.clone should work to disks.
314
self.build_tree(['target/'])
315
d2 = repo.bzrdir.clone(urlutils.local_path_to_url('target'))
316
self.assertEqual(repo.get_signature_text('A'),
317
d2.open_repository().get_signature_text('A'))
319
256
def test_nicks_bzr(self):
320
257
"""Test the behaviour of branch nicks specific to bzr branches.