X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/6dd8fafabb5b8e266a85f13c8851ca8a66a1a405..58f09cf20b44f502fc56d56383461b71b7ae42fd:/stgit/commands/fold.py?ds=sidebyside diff --git a/stgit/commands/fold.py b/stgit/commands/fold.py index 6e43101..66a2dd9 100644 --- a/stgit/commands/fold.py +++ b/stgit/commands/fold.py @@ -16,17 +16,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import sys, os -from optparse import OptionParser, make_option - +from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git - - -help = 'integrate a GNU diff patch into the current patch' -usage = """%prog [options] [] +from stgit import argparse, stack, git +help = 'Integrate a GNU diff patch into the current patch' +kind = 'patch' +usage = ['[options] []'] +description = """ Apply the given GNU diff file (or the standard input) onto the top of the current patch. With the '--threeway' option, the patch is applied onto the bottom of the current patch and a three-way merge is @@ -34,13 +33,14 @@ performed with the current top. With the --base option, the patch is applied onto the specified base and a three-way merged is performed with the current top.""" -directory = DirectoryHasRepository() -options = [make_option('-t', '--threeway', - help = 'perform a three-way merge with the current patch', - action = 'store_true'), - make_option('-b', '--base', - help = 'use BASE instead of HEAD applying the patch')] +args = [argparse.files] +options = [ + opt('-t', '--threeway', action = 'store_true', + short = 'Perform a three-way merge with the current patch'), + opt('-b', '--base', args = [argparse.commit], + short = 'Use BASE instead of HEAD applying the patch')] +directory = DirectoryHasRepository(log = True) def func(parser, options, args): """Integrate a GNU diff patch into the current patch @@ -50,7 +50,7 @@ def func(parser, options, args): check_local_changes() check_conflicts() - check_head_top_equal() + check_head_top_equal(crt_series) if len(args) == 1: filename = args[0] @@ -74,7 +74,8 @@ def func(parser, options, args): bottom = crt_patch.get_bottom() git.apply_patch(filename = filename, base = bottom) elif options.base: - git.apply_patch(filename = filename, base = git_id(options.base)) + git.apply_patch(filename = filename, + base = git_id(crt_series, options.base)) else: git.apply_patch(filename = filename)