@@ -16,13 +16,13 @@ class Object(LazyMixin):
1616 This Object also serves as a constructor for instances of the correct type::
1717
1818 inst = Object.new(repo,id)
19- inst.id # objects sha in hex
19+ inst.sha # objects sha in hex
2020 inst.size # objects uncompressed data size
2121 inst.data # byte string containing the whole data of the object
2222 """
2323 NULL_HEX_SHA = '0' * 40
2424 TYPES = ("blob" , "tree" , "commit" , "tag" )
25- __slots__ = ("repo" , "id " , "size" , "data" )
25+ __slots__ = ("repo" , "sha " , "size" , "data" )
2626 type = None # to be set by subclass
2727
2828 def __init__ (self , repo , id ):
@@ -38,7 +38,7 @@ def __init__(self, repo, id):
3838 """
3939 super (Object ,self ).__init__ ()
4040 self .repo = repo
41- self .id = id
41+ self .sha = id
4242
4343 @classmethod
4444 def new (cls , repo , id ):
@@ -76,11 +76,11 @@ def _set_cache_(self, attr):
7676 Retrieve object information
7777 """
7878 if attr == "size" :
79- hexsha , typename , self .size = self .repo .git .get_object_header (self .id )
80- assert typename == self .type , _assertion_msg_format % (self .id , typename , self .type )
79+ hexsha , typename , self .size = self .repo .git .get_object_header (self .sha )
80+ assert typename == self .type , _assertion_msg_format % (self .sha , typename , self .type )
8181 elif attr == "data" :
82- hexsha , typename , self .size , self .data = self .repo .git .get_object_data (self .id )
83- assert typename == self .type , _assertion_msg_format % (self .id , typename , self .type )
82+ hexsha , typename , self .size , self .data = self .repo .git .get_object_data (self .sha )
83+ assert typename == self .type , _assertion_msg_format % (self .sha , typename , self .type )
8484 else :
8585 super (Object ,self )._set_cache_ (attr )
8686
@@ -89,43 +89,43 @@ def __eq__(self, other):
8989 Returns
9090 True if the objects have the same SHA1
9191 """
92- return self .id == other .id
92+ return self .sha == other .sha
9393
9494 def __ne__ (self , other ):
9595 """
9696 Returns
9797 True if the objects do not have the same SHA1
9898 """
99- return self .id != other .id
99+ return self .sha != other .sha
100100
101101 def __hash__ (self ):
102102 """
103103 Returns
104104 Hash of our id allowing objects to be used in dicts and sets
105105 """
106- return hash (self .id )
106+ return hash (self .sha )
107107
108108 def __str__ (self ):
109109 """
110110 Returns
111111 string of our SHA1 as understood by all git commands
112112 """
113- return self .id
113+ return self .sha
114114
115115 def __repr__ (self ):
116116 """
117117 Returns
118118 string with pythonic representation of our object
119119 """
120- return '<git.%s "%s">' % (self .__class__ .__name__ , self .id )
120+ return '<git.%s "%s">' % (self .__class__ .__name__ , self .sha )
121121
122122 @property
123123 def data_stream (self ):
124124 """
125125 Returns
126126 File Object compatible stream to the uncompressed raw data of the object
127127 """
128- proc = self .repo .git .cat_file (self .type , self .id , as_process = True )
128+ proc = self .repo .git .cat_file (self .type , self .sha , as_process = True )
129129 return utils .ProcessStreamAdapter (proc , "stdout" )
130130
131131 def stream_data (self , ostream ):
@@ -138,7 +138,7 @@ def stream_data(self, ostream):
138138 Returns
139139 self
140140 """
141- self .repo .git .cat_file (self .type , self .id , output_stream = ostream )
141+ self .repo .git .cat_file (self .type , self .sha , output_stream = ostream )
142142 return self
143143
144144class IndexObject (Object ):
@@ -148,13 +148,13 @@ class IndexObject(Object):
148148 """
149149 __slots__ = ("path" , "mode" )
150150
151- def __init__ (self , repo , id , mode = None , path = None ):
151+ def __init__ (self , repo , sha , mode = None , path = None ):
152152 """
153153 Initialize a newly instanced IndexObject
154154 ``repo``
155155 is the Repo we are located in
156156
157- ``id `` : string
157+ ``sha `` : string
158158 is the git object id as hex sha
159159
160160 ``mode`` : int
@@ -168,7 +168,7 @@ def __init__(self, repo, id, mode=None, path=None):
168168 Path may not be set of the index object has been created directly as it cannot
169169 be retrieved without knowing the parent tree.
170170 """
171- super (IndexObject , self ).__init__ (repo , id )
171+ super (IndexObject , self ).__init__ (repo , sha )
172172 self ._set_self_from_args_ (locals ())
173173 if isinstance (mode , basestring ):
174174 self .mode = self ._mode_str_to_int (mode )
0 commit comments