changeset 92:6305f274fc63

fixed subtree issue and zero padding issue
author Scott Chacon <schacon@gmail.com>
date Sat, 09 May 2009 16:52:37 -0700
parents 91ad344df42f
children 312700177979
files TODO.txt dulwich/objects.py dulwich/repo.py git_handler.py
diffstat 4 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/TODO.txt
+++ b/TODO.txt
@@ -28,6 +28,7 @@
 
 Created in Git:
 * encoding field / utf-8
+* respect modes on tree write
 * octopus merge explode/implode
 
 WEBSITE
--- a/dulwich/objects.py
+++ b/dulwich/objects.py
@@ -429,6 +429,7 @@
         self._needs_serialization = True
 
     def entry(self, name):
+        self._ensure_parsed()
         try:
             return self._entries[name]
         except:
--- a/dulwich/repo.py
+++ b/dulwich/repo.py
@@ -374,7 +374,7 @@
             rawsha = hex_to_sha(entry[2])
             if entry[0] == 'tree':
                 tree_name = entry[1][0:-1]
-                tree_data += "%s %s\0%s" % ('040000', tree_name, rawsha)
+                tree_data += "%s %s\0%s" % ('40000', tree_name, rawsha)
             if entry[0] == 'blob':
                 # TODO : respect the modes
                 tree_data += "%s %s\0%s" % ('100644', entry[1], rawsha)
--- a/git_handler.py
+++ b/git_handler.py
@@ -294,7 +294,7 @@
         dirs.sort(lambda a, b: len(b.split('/'))-len(a.split('/')))
         dirs.remove('/')
         dirs.append('/')
-
+        
         # write all the trees
         tree_sha = None
         tree_shas = {}
@@ -308,6 +308,7 @@
                 tree_data.append(entry)
             tree_sha = self.git.write_tree_array(tree_data) # writing new trees to git
             tree_shas[dirnm] = tree_sha
+        
         return (tree_sha, renames) # should be the last root tree sha
 
     def remote_head(self, remote_name):
@@ -514,7 +515,7 @@
             try:
                 (mode, sha, data) = self.git.get_file(commit, f)
                 e = self.convert_git_int_mode(mode)
-            except TypeError, KeyError:
+            except TypeError:
                 raise IOError()
             if f in hg_renames:
                 copied_path = hg_renames[f]
@@ -557,7 +558,7 @@
 
         if hg_branch:
             extra['branch'] = hg_branch
-        
+                
         text = strip_message
         date = datetime.datetime.fromtimestamp(commit.author_time).strftime("%Y-%m-%d %H:%M:%S")
         ctx = context.memctx(self.repo, (p1, p2), text, files, getfilectx,