def rev_parse(committish, repo_dir=None):
 head = read_ref(committish, repo_dir=repo_dir)
 if head:
  debug2(('resolved from ref: commit = %s\n' % head.encode('hex')))
  return head
 pL = PackIdxList(repo('objects/pack', repo_dir=repo_dir))
 if (len(committish) == 40):
  try:
   hash = committish.decode('hex')
  except TypeError:
   return None
  if pL.exists(hash):
   return hash
 return None

def rev_parse ( committish , repo_dir = None ) : head = read_ref ( committish , repo_dir = repo_dir ) if head : debug2 ( ( 'resolved from ref: commit = %s\n' % head . encode ( 'hex' ) ) ) return head pL = PackIdxList ( repo ( 'objects/pack' , repo_dir = repo_dir ) ) if ( len ( committish ) == 40 ) : try : hash = committish . decode ( 'hex' ) except TypeError : return None if pL . exists ( hash ) : return hash return None
resolve the full hash for committish .