Use posixpath where possible.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 1 Apr 2010 17:07:25 +0000 (19:07 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 1 Apr 2010 17:07:25 +0000 (19:07 +0200)
dulwich/object_store.py
dulwich/pack.py

index 461fc17e41456ee77c26e5c867dc3c64abe337d2..9e5455f866fa1e2b52bfb122cdaa6ea12f6365e7 100644 (file)
@@ -23,6 +23,7 @@
 import errno
 import itertools
 import os
+import posixpath
 import stat
 import tempfile
 import urllib2
@@ -137,10 +138,7 @@ class BaseObjectStore(object):
             else:
                 ttree = {}
             for name, oldmode, oldhexsha in stree.iteritems():
-                if path == "":
-                    oldchildpath = name
-                else:
-                    oldchildpath = "%s/%s" % (path, name)
+                oldchildpath = posixpath.join(path, name)
                 try:
                     (newmode, newhexsha) = ttree[name]
                     newchildpath = oldchildpath
@@ -166,10 +164,7 @@ class BaseObjectStore(object):
                             yield ((oldchildpath, newchildpath), (oldmode, newmode), (oldhexsha, newhexsha))
 
             for name, newmode, newhexsha in ttree.iteritems():
-                if path == "":
-                    childpath = name
-                else:
-                    childpath = "%s/%s" % (path, name)
+                childpath = posixpath.join(path, name)
                 if not name in stree:
                     if not stat.S_ISDIR(newmode):
                         yield ((None, childpath), (None, newmode), (None, newhexsha))
@@ -186,10 +181,7 @@ class BaseObjectStore(object):
             (tid, tpath) = todo.pop()
             tree = self[tid]
             for name, mode, hexsha in tree.iteritems(): 
-                if tpath == "":
-                    path = name
-                else:
-                    path = "%s/%s" % (tpath, name)
+                path = posixpath.join(tpath, name)
                 if stat.S_ISDIR(mode):
                     todo.add((hexsha, path))
                 else:
index 97c9ba5baf9863b2a177d79afc48c64e18278f22..dcebc3c76cf0746a58c0f25bcb6b910904888db9 100644 (file)
@@ -625,7 +625,6 @@ class PackData(object):
         for (offset, type, obj, crc32) in todo:
             assert isinstance(offset, int)
             assert isinstance(type, int)
-            assert isinstance(obj, list) or isinstance(obj, str)
             try:
                 type, obj = self.resolve_object(offset, type, obj, get_ref_text)
             except Postpone, (sha, ):