def serialize_graftpoints(graftpoints):
 graft_lines = []
 for (commit, parents) in graftpoints.items():
  if parents:
   graft_lines.append(((commit + ' ') + ' '.join(parents)))
  else:
   graft_lines.append(commit)
 return '\n'.join(graft_lines)

def serialize_graftpoints ( graftpoints ) : graft_lines = [ ] for ( commit , parents ) in graftpoints . items ( ) : if parents : graft_lines . append ( ( ( commit + ' ' ) + ' ' . join ( parents ) ) ) else : graft_lines . append ( commit ) return '\n' . join ( graft_lines )
convert a dictionary of grafts into string the graft dictionary is: <commit sha1>: [<parent sha1>*] each line is formatted as: <commit sha1> <parent sha1> [<parent sha1>]* URL .