File tree Expand file tree Collapse file tree 3 files changed +26
-22
lines changed Expand file tree Collapse file tree 3 files changed +26
-22
lines changed Original file line number Diff line number Diff line change 1717from  itertools  import  islice 
1818
1919from  gitdb .utils .compat  import  izip 
20+ from  gitdb .typ  import  (
21+     str_blob_type ,
22+     str_commit_type ,
23+     str_tree_type ,
24+     str_tag_type ,
25+ )
2026
2127from  io  import  StringIO 
2228
2733
2834type_id_to_type_map  =    {
2935    0  : "" ,             # EXT 1 
30-     1  : "commit" ,
31-     2  : "tree" ,
32-     3  : "blob" ,
33-     4  : "tag" ,
36+     1  : str_commit_type ,
37+     2  : str_tree_type ,
38+     3  : str_blob_type ,
39+     4  : str_tag_type ,
3440    5  : "" ,             # EXT 2 
3541    OFS_DELTA  : "OFS_DELTA" ,    # OFFSET DELTA 
3642    REF_DELTA  : "REF_DELTA"      # REFERENCE DELTA 
3743}
3844
39- type_to_type_id_map  =  dict ( 
40-     commit = 1 ,
41-     tree = 2 ,
42-     blob = 3 ,
43-     tag = 4 ,
44-     OFS_DELTA = OFS_DELTA ,
45-     REF_DELTA = REF_DELTA 
46- ) 
45+ type_to_type_id_map  =  { 
46+     str_commit_type :  1 ,
47+     str_tree_type :  2 ,
48+     str_blob_type :  3 ,
49+     str_tag_type :  4 ,
50+     " OFS_DELTA" :  OFS_DELTA ,
51+     " REF_DELTA" :  REF_DELTA , 
52+ } 
4753
4854# used when dealing with larger streams 
4955chunk_size  =  1000  *  mmap .PAGESIZE 
@@ -398,7 +404,7 @@ def loose_object_header_info(m):
398404    hdr  =  decompressobj ().decompress (m , decompress_size )
399405    type_name , size  =  hdr [:hdr .find (NULL_BYTE )].split (" " .encode ("ascii" ))
400406
401-     return  force_text ( type_name ) , int (size )
407+     return  type_name , int (size )
402408
403409def  pack_object_header_info (data ):
404410    """ 
Original file line number Diff line number Diff line change 2929
3030from  gitdb .const  import  NULL_BYTE 
3131from  gitdb .utils .compat  import  buffer 
32- from  gitdb .utils .encoding  import  force_bytes ,  force_text 
32+ from  gitdb .utils .encoding  import  force_bytes 
3333
3434has_perf_mod  =  False 
3535try :
@@ -117,7 +117,7 @@ def _parse_header_info(self):
117117
118118        self ._phi  =  True 
119119
120-         return  force_text ( typ ) , size 
120+         return  typ , size 
121121
122122    #{ Interface 
123123
Original file line number Diff line number Diff line change 44# the New BSD License: http://www.opensource.org/licenses/bsd-license.php 
55"""Module containing information about types known to the database""" 
66
7- #{ String types  
7+ from   gitdb . utils . encoding   import   force_bytes 
88
9- str_blob_type  =  "blob" 
10- str_commit_type  =  "commit" 
11- str_tree_type  =  "tree" 
12- str_tag_type  =  "tag" 
13- 
14- #} END string types 
9+ str_blob_type  =  force_bytes ("blob" )
10+ str_commit_type  =  force_bytes ("commit" )
11+ str_tree_type  =  force_bytes ("tree" )
12+ str_tag_type  =  force_bytes ("tag" )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments