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)