<s> from ellen . utils . process import git_with_repo <EOL> def format_patch ( repository , ref , from_ref = None ) : <EOL> git = git_with_repo ( repository ) <EOL> rev_range = '<STR_LIT>' % ( from_ref , ref ) if from_ref else ref <EOL> git_format_patch = git . bake ( '<STR_LIT>' , stdout = True ) <EOL> if not from_ref : <EOL> git_format_patch = git_format_patch . bake ( '<STR_LIT>' ) <EOL> ret = git_format_patch ( rev_range ) <EOL> return ret [ '<STR_LIT>' ] </s>
