/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: John Arbash Meinel
  • Date: 2009-12-11 21:57:03 UTC
  • mto: (4896.1.3 2.1.0b4-dev)
  • mto: This revision was merged to the branch mainline in revision 4898.
  • Revision ID: john@arbash-meinel.com-20091211215703-zxl1ygia6mlnvfyo
Get rid of -Dhpssthread, just always include it.

We might actually consider changing mutter() with a -Dlogthread sort of flag.
As it could be useful to have all threads and pids get logged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 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
32
32
 
33
33
 
34
34
import tempfile
35
 
import thread
36
35
import threading
37
36
 
38
37
from bzrlib import (
292
291
        self._command = None
293
292
        if 'hpss' in debug.debug_flags:
294
293
            self._request_start_time = osutils.timer_func()
295
 
            self._thread_id = thread.get_ident()
 
294
            self._thread_id = threading.currentThread().ident
296
295
 
297
 
    def _trace(self, action, message, extra_bytes=None, include_time=False):
 
296
    def _trace(self, action, message, extra_bytes=None, suppress_time=False):
298
297
        # It is a bit of a shame that this functionality overlaps with that of 
299
298
        # ProtocolThreeRequester._trace. However, there is enough difference
300
299
        # that just putting it in a helper doesn't help a lot. And some state
301
300
        # is taken from the instance.
302
 
        if include_time:
 
301
        if suppress_time:
 
302
            t = ''
 
303
        else:
303
304
            t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
304
 
        else:
305
 
            t = ''
306
305
        if extra_bytes is None:
307
306
            extra = ''
308
307
        else:
328
327
        # cannot read after this.
329
328
        self.finished_reading = True
330
329
        if 'hpss' in debug.debug_flags:
331
 
            self._trace('end of body', '', include_time=True)
 
330
            self._trace('end of body', '')
332
331
 
333
332
    def _run_handler_code(self, callable, args, kwargs):
334
333
        """Run some handler specific code 'callable'.
374
373
        except LookupError:
375
374
            if 'hpss' in debug.debug_flags:
376
375
                self._trace('hpss unknown request', 
377
 
                            cmd, repr(args)[1:-1])
 
376
                            cmd, repr(args)[1:-1],
 
377
                            suppress_time=True)
378
378
            raise errors.UnknownSmartMethod(cmd)
379
379
        if 'hpss' in debug.debug_flags:
380
380
            from bzrlib.smart import vfs
383
383
            else:
384
384
                action = 'hpss request'
385
385
            self._trace(action, 
386
 
                        '%s %s' % (cmd, repr(args)[1:-1]))
 
386
                        '%s %s' % (cmd, repr(args)[1:-1]),
 
387
                        suppress_time=True)
387
388
        self._command = command(
388
389
            self._backing_transport, self._root_client_path, self._jail_root)
389
390
        self._run_handler_code(self._command.execute, args, {})
394
395
            return
395
396
        self._run_handler_code(self._command.do_end, (), {})
396
397
        if 'hpss' in debug.debug_flags:
397
 
            self._trace('end', '', include_time=True)
 
398
            self._trace('end', '')
398
399
 
399
400
    def post_body_error_received(self, error_args):
400
401
        # Just a no-op at the moment.
561
562
    'BzrDir.open_branchV2', 'bzrlib.smart.bzrdir',
562
563
    'SmartServerRequestOpenBranchV2')
563
564
request_handlers.register_lazy(
564
 
    'BzrDir.open_branchV3', 'bzrlib.smart.bzrdir',
565
 
    'SmartServerRequestOpenBranchV3')
566
 
request_handlers.register_lazy(
567
565
    'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
568
566
request_handlers.register_lazy(
569
567
    'get', 'bzrlib.smart.vfs', 'GetRequest')