make_option('-i', '--ignore',
help = 'ignore the applied patches in the series',
action = 'store_true'),
+ make_option('--replace',
+ help = 'replace the unapplied patches in the series',
+ action = 'store_true'),
make_option('-b', '--base',
help = 'use BASE instead of HEAD for file importing'),
make_option('-e', '--edit',
re.match('Index: ', line)
def __strip_patch_name(name):
- return re.sub('^[0-9]+-(.*)\.(diff|patch)$', '\g<1>', name)
+ stripped = re.sub('^[0-9]+-(.*)$', '\g<1>', name)
+ stripped = re.sub('^(.*)\.(diff|patch)$', '\g<1>', stripped)
+
+ return stripped
def __parse_description(descr):
"""Parse the patch description and return the new description and
if options.commemail:
committer_email = options.commemail
+ if options.replace and patch in crt_series.get_unapplied():
+ crt_series.delete_patch(patch)
+
crt_series.new_patch(patch, message = message, can_edit = False,
author_name = author_name,
author_email = author_email,
patch = re.sub('#.*$', '', line).strip()
if not patch:
continue
+ patchfile = os.path.join(patchdir, patch)
+
if options.strip:
patch = __strip_patch_name(patch)
if options.ignore and patch in applied:
print 'Ignoring already applied patch "%s"' % patch
continue
- patchfile = os.path.join(patchdir, patch)
__import_patch(patch, patchfile, options)
def func(parser, options, args):