def parse_graftpoints(graftpoints):
 grafts = {}
 for l in graftpoints:
  raw_graft = l.split(None, 1)
  commit = raw_graft[0]
  if (len(raw_graft) == 2):
   parents = raw_graft[1].split()
  else:
   parents = []
  for sha in ([commit] + parents):
   check_hexsha(sha, 'Invalid graftpoint')
  grafts[commit] = parents
 return grafts

def parse_graftpoints ( graftpoints ) : grafts = { } for l in graftpoints : raw_graft = l . split ( None , 1 ) commit = raw_graft [ 0 ] if ( len ( raw_graft ) == 2 ) : parents = raw_graft [ 1 ] . split ( ) else : parents = [ ] for sha in ( [ commit ] + parents ) : check_hexsha ( sha , 'Invalid graftpoint' ) grafts [ commit ] = parents return grafts
convert a list of graftpoints into a dict .