diff git_handler.py @ 53:5deb5cbd86aa

respecting file modes on git import
author Scott Chacon <schacon@gmail.com>
date Wed, 29 Apr 2009 11:50:56 -0700 (2009-04-29)
parents 87d462a6b796
children f6e11b9d7562
line wrap: on
line diff
--- a/git_handler.py
+++ b/git_handler.py
@@ -424,6 +424,15 @@
         except AttributeError:
             self.repo.ui.warn('creating bookmarks failed, do you have'
                               ' bookmarks enabled?\n')
+                              
+    def convert_git_int_mode(self, mode):
+        convert = {
+         33188: '',
+         40960: 'l',
+         33261: 'e'}
+        if mode in convert:
+            return convert[mode]
+        return ''
         
     def import_git_commit(self, commit):
         print "importing: " + commit.id
@@ -435,10 +444,10 @@
         #        get_file call for removed files
         def getfilectx(repo, memctx, f):
             try:
-                (e, sha, data) = self.git.get_file(commit, f)
+                (mode, sha, data) = self.git.get_file(commit, f)
+                e = self.convert_git_int_mode(mode)
             except TypeError:
                 raise IOError()
-            e = '' # TODO : make this a real mode
             return context.memfilectx(f, data, 'l' in e, 'x' in e, None)
 
         p1 = "0" * 40