Rev 56: Python 2.6 compatibility (Matt Nordhoff, Robert Collins) in http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

Robert Collins robertc at robertcollins.net
Thu Nov 6 23:06:14 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

------------------------------------------------------------
revno: 56
revision-id: robertc at robertcollins.net-20081106230612-i46wehvrp2hzpwos
parent: robertc at robertcollins.net-20080828035037-nsnsrcwhossdod6v
parent: mnordhoff at mattnordhoff.com-20081104183811-yxsp8lkvl3ka3gx6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Fri 2008-11-07 10:06:12 +1100
message:
  Python 2.6 compatibility (Matt Nordhoff, Robert Collins)
modified:
  NEWS                           news-20080608052041-z5bahsl8kwl0uf4x-2
  index.py                       index.py-20080608055509-hnimeek7q8tctkqf-2
    ------------------------------------------------------------
    revno: 55.1.1
    revision-id: mnordhoff at mattnordhoff.com-20081104183811-yxsp8lkvl3ka3gx6
    parent: robertc at robertcollins.net-20080828035037-nsnsrcwhossdod6v
    committer: Matt Nordhoff <mnordhoff at mattnordhoff.com>
    branch nick: py2.6
    timestamp: Tue 2008-11-04 18:38:11 +0000
    message:
      Use osutils.md5 to avoid Python 2.6's deprecation warning
    modified:
      index.py                       index.py-20080608055509-hnimeek7q8tctkqf-2
=== modified file 'NEWS'
--- a/NEWS	2008-08-27 08:37:30 +0000
+++ b/NEWS	2008-11-06 23:06:12 +0000
@@ -24,6 +24,9 @@
 
   IMPROVEMENTS:
 
+    * Compatibility with python 2.6 (as long as bzrlib is also compatible.)
+      (Matt Nordhoff, Robert Collins)
+
   BUGFIXES:
 
   API BREAKS:

=== modified file 'index.py'
--- a/index.py	2008-08-28 03:50:37 +0000
+++ b/index.py	2008-11-06 23:06:12 +0000
@@ -19,7 +19,6 @@
 
 from itertools import chain
 import math
-import md5
 import re
 
 from bzrlib import branch as _mod_branch
@@ -33,6 +32,10 @@
 #    BTreeBuilder as InMemoryGraphIndex,
 #    )
 from bzrlib.lockdir import LockDir
+try:
+    from bzrlib.osutils import md5
+except ImportError:
+    from md5 import new as md5
 from bzrlib.osutils import split_lines
 from bzrlib.pack import ContainerWriter
 from bzrlib.plugins.search import errors
@@ -1018,7 +1021,7 @@
         index_file = self.revision_index.finish()
         index_bytes = index_file.read()
         del index_file
-        index_name = md5.new(index_bytes).hexdigest()
+        index_name = md5(index_bytes).hexdigest()
         write_stream = upload_transport.open_write_stream(index_name + ".pack")
         writer = ContainerWriter(write_stream.write)
         writer.begin()
@@ -1159,7 +1162,7 @@
         index_file = revision_index.finish()
         index_bytes = index_file.read()
         del index_file
-        self.index_name = md5.new(index_bytes).hexdigest()
+        self.index_name = md5(index_bytes).hexdigest()
         self.write_stream = self.transport.open_write_stream(
             self.index_name + ".pack")
         self.writer = ContainerWriter(self.write_stream.write)




More information about the bazaar-commits mailing list