Rev 4914: (jam) Switch from threading.currentThread().ident to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Dec 21 19:52:02 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4914 [merge]
revision-id: pqm at pqm.ubuntu.com-20091221195200-eprzx977tt964etd
parent: pqm at pqm.ubuntu.com-20091221060307-uvja3vdy1o6dzzy0
parent: john at arbash-meinel.com-20091221170029-ef1zyr07p38p2qz6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-12-21 19:52:00 +0000
message:
  (jam) Switch from threading.currentThread().ident to
  	thread.get_ident()
modified:
  bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
  bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
  bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
  bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2009-12-18 22:14:18 +0000
+++ b/bzrlib/smart/medium.py	2009-12-21 17:00:29 +0000
@@ -33,7 +33,7 @@
 from bzrlib.lazy_import import lazy_import
 lazy_import(globals(), """
 import atexit
-import threading
+import thread
 import weakref
 
 from bzrlib import (
@@ -300,10 +300,7 @@
         tstart = osutils.timer_func()
         osutils.send_all(self.socket, bytes, self._report_activity)
         if 'hpss' in debug.debug_flags:
-            cur_thread = threading.currentThread()
-            thread_id = getattr(cur_thread, 'ident', None)
-            if thread_id is None:
-                thread_id = cur_thread.getName()
+            thread_id = thread.get_ident()
             trace.mutter('%12s: [%s] %d bytes to the socket in %.3fs'
                          % ('wrote', thread_id, len(bytes),
                             osutils.timer_func() - tstart))

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2009-12-18 22:14:18 +0000
+++ b/bzrlib/smart/protocol.py	2009-12-21 17:00:29 +0000
@@ -22,6 +22,7 @@
 from cStringIO import StringIO
 import struct
 import sys
+import thread
 import threading
 import time
 
@@ -1147,12 +1148,7 @@
         self.response_sent = False
         self._headers = {'Software version': bzrlib.__version__}
         if 'hpss' in debug.debug_flags:
-            # python 2.6 introduced 'ident' as a nice small integer to
-            # represent a thread. But it doesn't exist in 2.4/2.5
-            cur_thread = threading.currentThread()
-            self._thread_id = getattr(cur_thread, 'ident', None)
-            if self._thread_id is None:
-                self._thread_id = cur_thread.getName()
+            self._thread_id = thread.get_ident()
             self._response_start_time = None
 
     def _trace(self, action, message, extra_bytes=None, include_time=False):

=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py	2009-12-18 22:14:18 +0000
+++ b/bzrlib/smart/request.py	2009-12-21 17:00:29 +0000
@@ -32,6 +32,7 @@
 
 
 import tempfile
+import thread
 import threading
 
 from bzrlib import (
@@ -291,10 +292,7 @@
         self._command = None
         if 'hpss' in debug.debug_flags:
             self._request_start_time = osutils.timer_func()
-            cur_thread = threading.currentThread()
-            self._thread_id = getattr(cur_thread, 'ident', None)
-            if self._thread_id is None:
-                self._thread_id = cur_thread.getName()
+            self._thread_id = thread.get_ident()
 
     def _trace(self, action, message, extra_bytes=None, include_time=False):
         # It is a bit of a shame that this functionality overlaps with that of 

=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py	2009-12-18 21:54:54 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py	2009-12-21 17:00:29 +0000
@@ -233,7 +233,7 @@
         f = open(log_fname, 'rb')
         content = f.read()
         f.close()
-        self.assertContainsRe(content, 'hpss request: \[')
+        self.assertContainsRe(content, r'hpss request: \[[0-9-]+\]')
 
 
 class TestCmdServeChrooting(TestBzrServeBase):




More information about the bazaar-commits mailing list