~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

(jameinel) (bug #780544) when updating the WT,
 allow it to be done with a fast delta,
 rather than setting the state from scratch. (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
254
254
            "Called by the bzr server when it stops serving a directory. "
255
255
            "server_stopped is called with the same parameters as the "
256
256
            "server_started hook: (backing_urls, public_url).", (0, 16))
257
 
        self.add_hook('server_exception',
258
 
            "Called by the bzr server when an exception occurs. "
259
 
            "server_exception is called with the sys.exc_info() tuple "
260
 
            "return true for the hook if the exception has been handled, "
261
 
            "in which case the server will exit normally.", (2, 4))
262
257
 
263
258
SmartTCPServer.hooks = SmartServerHooks()
264
259
 
378
373
        for cleanup in reversed(self.cleanups):
379
374
            cleanup()
380
375
 
 
376
 
381
377
def serve_bzr(transport, host=None, port=None, inet=False):
382
378
    """This is the default implementation of 'bzr serve'.
383
379
    
389
385
    try:
390
386
        bzr_server.set_up(transport, host, port, inet)
391
387
        bzr_server.smart_server.serve()
392
 
    except:
393
 
        hook_caught_exception = False
394
 
        for hook in SmartTCPServer.hooks['server_exception']:
395
 
            hook_caught_exception = hook(sys.exc_info())
396
 
        if not hook_caught_exception:
397
 
            raise
398
388
    finally:
399
389
        bzr_server.tear_down()
 
390