Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-from optparse import make_option
+from stgit.argparse import opt
from stgit.out import *
-from stgit import utils
+from stgit import argparse, utils
from stgit.commands import common
from stgit.lib import git, transaction
-help = 'coalesce two or more patches into one'
-usage = """%prog [options] <patches>
-
+help = 'Coalesce two or more patches into one'
+kind = 'stack'
+usage = ['[options] <patches>']
+description = """
Coalesce two or more patches, creating one big patch that contains all
their changes.
you specify, you will have to resolve them manually just as if you had
done a sequence of pushes and pops yourself."""
+options = [opt('-n', '--name', short = 'Name of coalesced patch')
+ ] + argparse.message_options(save_template = True)
+
directory = common.DirectoryHasRepositoryLib()
-options = [make_option('-n', '--name', help = 'name of coalesced patch')
- ] + utils.make_message_options()
class SaveTemplateDone(Exception):
pass
def _coalesce_patches(trans, patches, msg, save_template):
cd = trans.patches[patches[0]].data
- cd = git.Commitdata(tree = cd.tree, parents = cd.parents)
+ cd = git.CommitData(tree = cd.tree, parents = cd.parents)
for pn in patches[1:]:
c = trans.patches[pn]
tree = trans.stack.repository.simple_merge(
trans.patches[name] = stack.repository.commit(new_commit_data)
trans.unapplied.insert(0, name)
- trans = transaction.StackTransaction(stack, 'coalesce')
+ trans = transaction.StackTransaction(stack, 'coalesce',
+ allow_conflicts = True)
push_new_patch = bool(set(patches) & set(trans.applied))
try:
new_commit_data = _coalesce_patches(trans, patches, msg, save_template)
def func(parser, options, args):
stack = directory.repository.current_stack
- patches = common.parse_patches(args, (list(stack.patchorder.applied)
- + list(stack.patchorder.unapplied)))
+ patches = common.parse_patches(args, list(stack.patchorder.all))
if len(patches) < 2:
raise common.CmdException('Need at least two patches')
return _coalesce(stack, stack.repository.default_iw, options.name,