X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/6dd8fafabb5b8e266a85f13c8851ca8a66a1a405..111251132edff92d1681d915af0d060af35250d2:/stgit/commands/rebase.py diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py index bbb3e12..b949a5c 100644 --- a/stgit/commands/rebase.py +++ b/stgit/commands/rebase.py @@ -16,26 +16,38 @@ 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 import stack, git +from stgit import argparse, stack, git +help = 'Move the stack base to another point in history' +kind = 'stack' +usage = ['[options] '] +description = """ +Pop all patches from current stack, move the stack base to the given + and push the patches back. -help = 'move the stack base to another point in history' -usage = """%prog [options] +If you experience merge conflicts, resolve the problem and continue +the rebase by executing the following sequence: -Pop all patches from current stack, move the stack base to the given - and push the patches back.""" + $ git add --update + $ stg refresh + $ stg goto top-patch + +Or if you want to skip that patch: + + $ stg undo --hard + $ stg push next-patch..top-patch""" + +args = [argparse.commit] +options = [ + opt('-n', '--nopush', action = 'store_true', + short = 'Do not push the patches back after rebasing'), + opt('-m', '--merged', action = 'store_true', + short = 'Check for patches merged upstream')] -directory = DirectoryHasRepository() -options = [make_option('-n', '--nopush', - help = 'do not push the patches back after rebasing', - action = 'store_true'), - make_option('-m', '--merged', - help = 'check for patches merged upstream', - action = 'store_true')] +directory = DirectoryGotoToplevel(log = True) def func(parser, options, args): """Rebase the current stack @@ -48,14 +60,14 @@ def func(parser, options, args): check_local_changes() check_conflicts() - check_head_top_equal() + check_head_top_equal(crt_series) # ensure an exception is raised before popping on non-existent target - if git_id(args[0]) == None: + if git_id(crt_series, args[0]) == None: raise GitException, 'Unknown revision: %s' % args[0] - applied = prepare_rebase() - rebase(args[0]) - post_rebase(applied, options.nopush, options.merged) + applied = prepare_rebase(crt_series) + rebase(crt_series, args[0]) + post_rebase(crt_series, applied, options.nopush, options.merged) - print_crt_patch() + print_crt_patch(crt_series)