From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 1/2] Add a new flag, --spill, to stg delete
Date: Sun, 21 Sep 2008 21:07:30 +0200 [thread overview]
Message-ID: <20080921190730.4503.52714.stgit@yoghurt> (raw)
In-Reply-To: <20080921190708.4503.20574.stgit@yoghurt>
It deletes the patches as usual, but doesn't touch index+worktree.
Useful for splitting up a patch, or undoing an "stg refresh".
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/delete.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/stgit/commands/delete.py b/stgit/commands/delete.py
index 1b59cdd..015fb49 100644
--- a/stgit/commands/delete.py
+++ b/stgit/commands/delete.py
@@ -30,6 +30,13 @@ Delete the patches passed as arguments."""
args = [argparse.patch_range(argparse.applied_patches,
argparse.unapplied_patches)]
options = [
+ opt('--spill', action = 'store_true',
+ short = 'Spill patch contents to worktree and index', long = """
+ Delete the patches, but do not touch the index and worktree.
+ This only works with applied patches at the top of the stack.
+ The effect is to "spill" the patch contents into the index and
+ worktree. This can be useful e.g. if you want to split a patch
+ into several smaller pieces."""),
opt('-b', '--branch', args = [argparse.stg_branches],
short = 'Use BRANCH instead of the default branch')]
@@ -46,6 +53,12 @@ def func(parser, options, args):
patches = set(common.parse_patches(args, list(stack.patchorder.all)))
else:
parser.error('No patches specified')
+
+ if options.spill:
+ if set(stack.patchorder.applied[-len(patches):]) != patches:
+ parser.error('Can only spill topmost applied patches')
+ iw = None # don't touch index+worktree
+
def allow_conflicts(trans):
# Allow conflicts if the topmost patch stays the same.
if stack.patchorder.applied:
next prev parent reply other threads:[~2008-09-21 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-21 19:07 [StGit PATCH 0/2] stg delete --spill Karl Hasselström
2008-09-21 19:07 ` Karl Hasselström [this message]
2008-09-21 19:07 ` [StGit PATCH 2/2] Test the new stg delete --spill flag Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080921190730.4503.52714.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).