Rev 2325: Tune pack_stat a little. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Thu Mar 8 02:35:50 GMT 2007


At http://bazaar.launchpad.net/~bzr/bzr/dirstate

------------------------------------------------------------
revno: 2325
revision-id: robertc at robertcollins.net-20070308023456-qlqjwtwuxvyggan0
parent: robertc at robertcollins.net-20070307120012-cgx5yk2cob9v0i92
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Thu 2007-03-08 13:34:56 +1100
message:
  Tune pack_stat a little.
modified:
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/lsprof.py               lsprof.py-20051208071030-833790916798ceed
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2007-03-07 08:00:48 +0000
+++ b/bzrlib/dirstate.py	2007-03-08 02:34:56 +0000
@@ -200,7 +200,7 @@
 """
 
 
-import base64
+import binascii
 import bisect
 import errno
 import os
@@ -2285,7 +2285,7 @@
 
 
 
-def pack_stat(st, _encode=base64.encodestring, _pack=struct.pack):
+def pack_stat(st, _b2a_base64=binascii.b2a_base64, _pack=struct.pack):
     """Convert stat values into a packed representation."""
     # jam 20060614 it isn't really worth removing more entries if we
     # are going to leave it in packed form.
@@ -2294,6 +2294,6 @@
     # well within the noise margin
 
     # base64.encode always adds a final newline, so strip it off
-    return _encode(_pack('>llllll'
+    return _b2a_base64(_pack('>llllll'
         , st.st_size, int(st.st_mtime), int(st.st_ctime)
         , st.st_dev, st.st_ino, st.st_mode))[:-1]

=== modified file 'bzrlib/lsprof.py'
--- a/bzrlib/lsprof.py	2006-09-08 18:46:29 +0000
+++ b/bzrlib/lsprof.py	2007-03-08 02:34:56 +0000
@@ -187,6 +187,6 @@
         print >> sys.stderr, "usage: lsprof.py <script> <arguments...>"
         sys.exit(2)
     sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
-    stats = profile(execfile, sys.argv[0], globals(), locals())
+    _, stats = profile(execfile, sys.argv[0], globals(), locals())
     stats.sort()
     stats.pprint()



More information about the bazaar-commits mailing list