From a67586829f9d4405a4690a5556e3df6a3fa23174 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 13 Jul 2007 23:43:55 +0100 Subject: [PATCH] Add --keep option to goto This option is similar to the one for the pop command. Signed-off-by: Catalin Marinas --- stgit/commands/goto.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py index e129b8d..a4427fa 100644 --- a/stgit/commands/goto.py +++ b/stgit/commands/goto.py @@ -31,7 +31,9 @@ line becomes current. This is a shortcut for the 'push --to' or 'pop --to' commands. There is no '--undo' option for 'goto'. Use the 'push' command for this.""" -options = [] +options = [make_option('-k', '--keep', + help = 'keep the local changes when popping patches', + action = 'store_true')] def func(parser, options, args): @@ -40,10 +42,12 @@ def func(parser, options, args): if len(args) != 1: parser.error('incorrect number of arguments') - check_local_changes() check_conflicts() check_head_top_equal() + if not options.keep: + check_local_changes() + applied = crt_series.get_applied() unapplied = crt_series.get_unapplied() patch = args[0] @@ -51,8 +55,10 @@ def func(parser, options, args): if patch in applied: applied.reverse() patches = applied[:applied.index(patch)] - pop_patches(patches) + pop_patches(patches, options.keep) elif patch in unapplied: + if options.keep: + raise CmdException, 'Cannot use --keep with patch pushing' patches = unapplied[:unapplied.index(patch)+1] push_patches(patches) else: -- 2.11.0