patch = __strip_patch_name(patch)
if not patch:
- 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('-')
raise CmdException, 'No diff found inside the patch'
if options.ignore and patch in crt_series.get_applied():
- print 'Ignoring already applied patch "%s"' % patch
+ out.info('Ignoring already applied patch "%s"' % patch)
return
if options.replace and patch in crt_series.get_unapplied():
crt_series.delete_patch(patch)
committer_name = committer_name,
committer_email = committer_email)
- print 'Importing patch "%s"...' % patch,
- sys.stdout.flush()
-
+ out.start('Importing patch "%s"' % patch)
if options.base:
git.apply_patch(diff = diff, base = git_id(options.base))
else:
git.apply_patch(diff = diff)
-
crt_series.refresh_patch(edit = options.edit,
show_patch = options.showpatch)
-
- print 'done'
+ out.done()
def __import_file(filename, options, patch = None):
"""Import a patch from a file or standard input