Rev 6308: (jelmer) Support verifying remote signatures without VFS calls. (Jelmer in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Nov 28 03:03:27 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6308 [merge]
revision-id: pqm at pqm.ubuntu.com-20111128030327-ps8yfespwmhati3y
parent: pqm at pqm.ubuntu.com-20111128023842-8en2yd6tuo8v4mb6
parent: jelmer at samba.org-20111125192011-4eo7rrbtmjt6mz0q
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-11-28 03:03:27 +0000
message:
(jelmer) Support verifying remote signatures without VFS calls. (Jelmer
Vernooij)
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2011-11-25 18:45:53 +0000
+++ b/bzrlib/remote.py 2011-11-28 03:03:27 +0000
@@ -24,6 +24,7 @@
controldir,
debug,
errors,
+ gpg,
graph,
lock,
lockdir,
@@ -32,6 +33,7 @@
revision as _mod_revision,
static_tuple,
symbol_versioning,
+ testament as _mod_testament,
urlutils,
vf_repository,
)
@@ -2177,8 +2179,9 @@
@needs_write_lock
def sign_revision(self, revision_id, gpg_strategy):
- self._ensure_real()
- return self._real_repository.sign_revision(revision_id, gpg_strategy)
+ testament = _mod_testament.Testament.from_revision(self, revision_id)
+ plaintext = testament.as_short_text()
+ self.store_revision_signature(gpg_strategy, plaintext, revision_id)
@property
def texts(self):
@@ -2240,10 +2243,16 @@
raise SmartProtocolError('unexpected response code %s' % (response,))
return (response[0] == 'yes')
+ @needs_read_lock
def verify_revision_signature(self, revision_id, gpg_strategy):
- self._ensure_real()
- return self._real_repository.verify_revision_signature(
- revision_id, gpg_strategy)
+ if not self.has_signature_for_revision_id(revision_id):
+ return gpg.SIGNATURE_NOT_SIGNED, None
+ signature = self.get_signature_text(revision_id)
+
+ testament = _mod_testament.Testament.from_revision(self, revision_id)
+ plaintext = testament.as_short_text()
+
+ return gpg_strategy.verify(signature, plaintext)
def item_keys_introduced_by(self, revision_ids, _files_pb=None):
self._ensure_real()
More information about the bazaar-commits
mailing list