- patch = make_patch_name(message, crt_series.patch_exists,
- alternative = not (options.ignore
- or options.replace))
+ if options.ignore or options.replace:
+ unacceptable_name = lambda name: False
+ else:
+ unacceptable_name = crt_series.patch_exists
+ patch = make_patch_name(message, unacceptable_name)
+ else:
+ # fix possible invalid characters in the patch name
+ patch = re.sub('[^\w.]+', '-', patch).strip('-')
+
+ if not diff:
+ raise CmdException, 'No diff found inside the patch'