From 1c9a3ed29fd1d4270b80317f0687a60bd895a4e5 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 18 Oct 2018 18:02:21 +0200 Subject: [PATCH] allow not applying any patch --- git_redmine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_redmine.py b/git_redmine.py index de7c29e..588f256 100644 --- a/git_redmine.py +++ b/git_redmine.py @@ -161,8 +161,11 @@ def apply_attachments(repo, issue): for i, attachment in enumerate(attachments): print i, attachment.created_on, '%6d bytes' % attachment.filesize, attachment.filename while True: - indexes = click.prompt('Which patch would you like to apply (id separated by spaces) ?', type=str) + indexes = click.prompt('Which patch would you like to apply (id separated by spaces) ?', type=str, default='') try: + indexes = indexes.strip() + if not indexes: + break indexes = map(int, indexes.split()) if not all(i < len(attachments) for i in indexes): raise ValueError('invalid values', indexes)