allow get_patches to work with explicit refs

This commit is contained in:
Benjamin Dauvergne 2019-03-11 15:40:52 +01:00
parent 672244a433
commit 554460811e
1 changed files with 2 additions and 2 deletions

View File

@ -110,12 +110,12 @@ def get_current_project():
return api.project.get(project_id)
def get_patches(number_of_commits=0):
def get_patches(number_of_commits=0, ref=None):
repo = get_repo()
tempdir = tempfile.mkdtemp()
if number_of_commits:
ref = 'HEAD' + '~' * number_of_commits
else:
elif not ref:
ref = '@{upstream}'
repo.git.format_patch(ref, o=tempdir)