~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

Add new HPSS call ``Repository.has_signature_for_revision_id``.

Show diffs side-by-side

added added

removed removed

Lines of Context:
343
343
            return SuccessfulSmartServerResponse(('no', ))
344
344
 
345
345
 
 
346
class SmartServerRequestHasSignatureForRevisionId(
 
347
        SmartServerRepositoryRequest):
 
348
 
 
349
    def do_repository_request(self, repository, revision_id):
 
350
        """Return ok if a signature is present for a revision.
 
351
 
 
352
        :param repository: The repository to query in.
 
353
        :param revision_id: The utf8 encoded revision_id to lookup.
 
354
        :return: A smart server response of ('ok', ) if a
 
355
            signature for the revision is present.
 
356
        """
 
357
        try:
 
358
            if repository.has_signature_for_revision_id(revision_id):
 
359
                return SuccessfulSmartServerResponse(('yes', ))
 
360
            else:
 
361
                return SuccessfulSmartServerResponse(('no', ))
 
362
        except errors.NoSuchRevision:
 
363
            return FailedSmartServerResponse(
 
364
                ('NoSuchRevision', revision_id))
 
365
 
 
366
 
346
367
class SmartServerRepositoryGatherStats(SmartServerRepositoryRequest):
347
368
 
348
369
    def do_repository_request(self, repository, revid, committers):