Rev 1731: Fix python2.6 deprecation warnings. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Mon Nov 3 02:12:33 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1731
revision-id: jelmer at samba.org-20081103021228-0pkqcw3cikpuc6zv
parent: jelmer at samba.org-20081010180416-pjcrar4dr033waod
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-11-03 03:12:28 +0100
message:
  Fix python2.6 deprecation warnings.
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  delta.py                       delta.py-20080316001917-xyng7m3jlxvdc4c9-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
  tests/test_mapping.py          test_mapping.py-20080201131338-0zd86eznn4bojtee-1
  tree.py                        tree.py-20060624222557-dudlwqcmkf22lt2s-1
=== modified file 'commit.py'
--- a/commit.py	2008-10-10 17:09:00 +0000
+++ b/commit.py	2008-11-03 02:12:28 +0000
@@ -226,7 +226,7 @@
         txdelta = file_editor.apply_textdelta()
         digest = send_stream(StringIO(contents), txdelta)
         if 'validate' in debug.debug_flags:
-            from fetch import md5_strings
+            from bzrlib.plugins.svn.fetch import md5_strings
             assert digest == md5_strings(contents)
 
     def _dir_process(self, path, file_id, dir_editor):

=== modified file 'delta.py'
--- a/delta.py	2008-06-27 15:37:22 +0000
+++ b/delta.py	2008-11-03 02:12:28 +0000
@@ -15,7 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Subversion delta operations."""
 
-import md5
+from bzrlib.osutils import md5
 
 TXDELTA_SOURCE = 0
 TXDELTA_TARGET = 1
@@ -54,7 +54,7 @@
 
 
 def send_stream(stream, handler, block_size=SEND_STREAM_BLOCK_SIZE):
-    hash = md5.new()
+    hash = md5()
     text = stream.read(block_size)
     while text != "":
         hash.update(text)

=== modified file 'fetch.py'
--- a/fetch.py	2008-09-05 20:55:36 +0000
+++ b/fetch.py	2008-11-03 02:12:28 +0000
@@ -23,7 +23,7 @@
 from bzrlib.trace import mutter
 
 from cStringIO import StringIO
-import md5
+from bzrlib.osutils import md5
 
 from bzrlib.plugins.svn import properties
 from bzrlib.plugins.svn.delta import apply_txdelta_handler
@@ -61,7 +61,7 @@
     :param strings: Strings to find the MD5sum of.
     :return: MD5sum
     """
-    s = md5.new()
+    s = md5()
     map(s.update, strings)
     return s.hexdigest()
 
@@ -322,7 +322,7 @@
         self.file_stream = None
 
     def _apply_textdelta(self, base_checksum=None):
-        actual_checksum = md5.new(self.file_data).hexdigest()
+        actual_checksum = md5(self.file_data).hexdigest()
         assert (base_checksum is None or base_checksum == actual_checksum,
             "base checksum mismatch: %r != %r" % (base_checksum, 
                                                   actual_checksum))

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-08-26 03:32:23 +0000
+++ b/mapping3/__init__.py	2008-11-03 02:12:28 +0000
@@ -26,7 +26,7 @@
                              parse_list_scheme_text, NoBranchingScheme,
                              TrunkBranchingScheme, ListBranchingScheme)
 from bzrlib.plugins.svn.ra import DIRENT_KIND
-import sha
+from bzrlib.osutils import sha
 
 SVN_PROP_BZR_BRANCHING_SCHEME = 'bzr:branching-scheme'
 
@@ -266,7 +266,7 @@
         if len(ret) > 150:
             ret = "%d@%s:%s;%s" % (revnum, uuid, 
                                 mapping.escape_svn_path(branch),
-                                sha.new(inv_path).hexdigest())
+                                sha(inv_path).hexdigest())
         assert isinstance(ret, str)
         return osutils.safe_file_id(ret)
 

=== modified file 'tests/test_mapping.py'
--- a/tests/test_mapping.py	2008-08-23 21:41:57 +0000
+++ b/tests/test_mapping.py	2008-11-03 02:12:28 +0000
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import sha
+from bzrlib.osutils import sha
 
 from bzrlib.errors import InvalidRevisionId
 from bzrlib.tests import TestCase, TestNotApplicable
@@ -229,7 +229,7 @@
 
 
 def sha1(text):
-    return sha.new(text).hexdigest()
+    return sha(text).hexdigest()
 
 
 class Mappingv3FilePropTests(MappingTestAdapter, TestCase):

=== modified file 'tree.py'
--- a/tree.py	2008-08-23 15:14:26 +0000
+++ b/tree.py	2008-11-03 02:12:28 +0000
@@ -23,7 +23,7 @@
 from bzrlib.revisiontree import RevisionTree
 
 import os
-import md5
+from bzrlib.osutils import md5
 from cStringIO import StringIO
 import urllib
 
@@ -196,7 +196,7 @@
             ie = self.tree._inventory.add_path(self.path, 'file', file_id)
         ie.revision = revision_id
 
-        actual_checksum = md5.new(file_data).hexdigest()
+        actual_checksum = md5(file_data).hexdigest()
         assert(checksum is None or checksum == actual_checksum,
                 "checksum mismatch: %r != %r" % (checksum, actual_checksum))
 




More information about the bazaar-commits mailing list