/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: Jelmer Vernooij
  • Date: 2011-11-20 02:16:25 UTC
  • mto: This revision was merged to the branch mainline in revision 6318.
  • Revision ID: jelmer@samba.org-20111120021625-ckv3ro8u6v8yswme
Convert to iter_files_bytes_bz2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
# of a SmartServerRequest subclass.
32
32
 
33
33
 
34
 
import tempfile
35
 
import thread
36
34
import threading
37
35
 
38
36
from bzrlib import (
48
46
from bzrlib.lazy_import import lazy_import
49
47
lazy_import(globals(), """
50
48
from bzrlib.bundle import serializer
 
49
 
 
50
import tempfile
 
51
import thread
51
52
""")
52
53
 
53
54
 
134
135
        It will return a SmartServerResponse if the command does not expect a
135
136
        body.
136
137
 
137
 
        :param *args: the arguments of the request.
 
138
        :param args: the arguments of the request.
138
139
        """
139
140
        self._check_enabled()
140
141
        return self.do(*args)
414
415
    elif isinstance(err, errors.ShortReadvError):
415
416
        return ('ShortReadvError', err.path, str(err.offset), str(err.length),
416
417
                str(err.actual))
 
418
    elif isinstance(err, errors.RevisionNotPresent):
 
419
        return ('RevisionNotPresent', err.revision_id, err.file_id)
417
420
    elif isinstance(err, errors.UnstackableRepositoryFormat):
418
421
        return (('UnstackableRepositoryFormat', str(err.format), err.url))
419
422
    elif isinstance(err, errors.UnstackableBranchFormat):
446
449
        return ('TokenMismatch', err.given_token, err.lock_token)
447
450
    elif isinstance(err, errors.LockContention):
448
451
        return ('LockContention',)
 
452
    elif isinstance(err, MemoryError):
 
453
        # GZ 2011-02-24: Copy bzrlib.trace -Dmem_dump functionality here?
 
454
        return ('MemoryError',)
449
455
    # Unserialisable error.  Log it, and return a generic error
450
456
    trace.log_exception_quietly()
451
 
    return ('error', str(err))
 
457
    return ('error', trace._qualified_exception_name(err.__class__, True),
 
458
        str(err))
452
459
 
453
460
 
454
461
class HelloRequest(SmartServerRequest):
501
508
    'Branch.set_tags_bytes', 'bzrlib.smart.branch',
502
509
    'SmartServerBranchSetTagsBytes')
503
510
request_handlers.register_lazy(
 
511
    'Branch.heads_to_fetch', 'bzrlib.smart.branch',
 
512
    'SmartServerBranchHeadsToFetch')
 
513
request_handlers.register_lazy(
504
514
    'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
505
515
request_handlers.register_lazy(
506
516
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
510
520
    'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
511
521
request_handlers.register_lazy( 'Branch.set_config_option',
512
522
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption')
 
523
request_handlers.register_lazy( 'Branch.set_config_option_dict',
 
524
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOptionDict')
513
525
request_handlers.register_lazy( 'Branch.set_last_revision',
514
526
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
515
527
request_handlers.register_lazy(
545
557
    'BzrDir.get_config_file', 'bzrlib.smart.bzrdir',
546
558
    'SmartServerBzrDirRequestConfigFile')
547
559
request_handlers.register_lazy(
 
560
    'BzrDir.has_workingtree', 'bzrlib.smart.bzrdir',
 
561
    'SmartServerBzrDirRequestHasWorkingTree')
 
562
request_handlers.register_lazy(
 
563
    'BzrDir.destroy_repository', 'bzrlib.smart.bzrdir',
 
564
    'SmartServerBzrDirRequestDestroyRepository')
 
565
request_handlers.register_lazy(
548
566
    'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',
549
567
    'SmartServerRequestInitializeBzrDir')
550
568
request_handlers.register_lazy(
603
621
request_handlers.register_lazy(
604
622
    'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
605
623
request_handlers.register_lazy(
 
624
    'Repository.has_signature_for_revision_id', 'bzrlib.smart.repository',
 
625
    'SmartServerRequestHasSignatureForRevisionId')
 
626
request_handlers.register_lazy(
606
627
    'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
607
628
request_handlers.register_lazy(
608
629
    'Repository.insert_stream_1.19', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream_1_19')
611
632
request_handlers.register_lazy(
612
633
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
613
634
request_handlers.register_lazy(
 
635
    'Repository.iter_files_bytes_bz2', 'bzrlib.smart.repository',
 
636
    'SmartServerRepositoryIterFilesBytesBz2')
 
637
request_handlers.register_lazy(
614
638
    'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
615
639
request_handlers.register_lazy(
 
640
    'Repository.make_working_trees', 'bzrlib.smart.repository', 'SmartServerRepositoryMakeWorkingTrees')
 
641
request_handlers.register_lazy(
616
642
    'Repository.set_make_working_trees', 'bzrlib.smart.repository',
617
643
    'SmartServerRepositorySetMakeWorkingTrees')
618
644
request_handlers.register_lazy(