2323 get_user_id ,
2424 parse_date ,
2525 Actor ,
26- altz_to_utctz_str
26+ altz_to_utctz_str ,
2727 parse_actor_and_date
2828 )
2929from time import (
3030 time ,
3131 altzone
3232 )
33+ import os
3334
3435__all__ = ('Commit' , )
3536
@@ -76,7 +77,7 @@ def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, aut
7677 :param parents: tuple( Commit, ... )
7778 is a tuple of commit ids or actual Commits
7879 :param tree: Tree
79- 20 byte tree sha
80+ Tree object
8081 :param author: Actor
8182 is the author string ( will be implicitly converted into an Actor object )
8283 :param authored_date: int_seconds_since_epoch
@@ -103,7 +104,7 @@ def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, aut
103104 :note: Timezone information is in the same format and in the same sign
104105 as what time.altzone returns. The sign is inverted compared to git's
105106 UTC timezone."""
106- super (Commit ,self ).__init__ (repo , sha )
107+ super (Commit ,self ).__init__ (repo , binsha )
107108 self ._set_self_from_args_ (locals ())
108109
109110 @classmethod
@@ -227,14 +228,14 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
227228 line = readline ()
228229 if not line :
229230 break
230- sha = line .strip ()
231- if len (sha ) > 40 :
231+ hexsha = line .strip ()
232+ if len (hexsha ) > 40 :
232233 # split additional information, as returned by bisect for instance
233- sha , rest = line .split (None , 1 )
234+ hexsha , rest = line .split (None , 1 )
234235 # END handle extra info
235236
236- assert len (sha ) == 40 , "Invalid line: %s" % sha
237- yield Commit (repo , sha )
237+ assert len (hexsha ) == 40 , "Invalid line: %s" % hexsha
238+ yield Commit (repo , hex_to_bin ( hexsha ) )
238239 # END for each line in stream
239240
240241
@@ -282,7 +283,7 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
282283
283284 # COMMITER AND AUTHOR INFO
284285 cr = repo .config_reader ()
285- env = environ
286+ env = os . environ
286287 default_email = get_user_id ()
287288 default_name = default_email .split ('@' )[0 ]
288289
0 commit comments