def format_patch(repository, ref, from_ref=None):
    git = git_with_repo(repository)
    rev_range = (from_ref, ref) % '%s...%s' if from_ref else ref
    git_format_patch = git.bake('format-patch', stdout=True)
    if not from_ref:
        git_format_patch = git_format_patch.bake('-1')
    ret = git_format_patch(rev_range)
    return ret['stdout']
dataset/ETHPy150Open douban/ellen/ellen/git/format_patch.py/format_patch/swapped operands of `%`