From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org, "David Kågedal" <davidk@lysator.liu.se>
Subject: [StGit PATCH 08/10] Let "stg clean" use the new transaction primitives
Date: Sun, 25 Nov 2007 21:51:46 +0100 [thread overview]
Message-ID: <20071125205146.7823.47696.stgit@yoghurt> (raw)
In-Reply-To: <20071125203717.7823.70046.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/clean.py | 33 +++++++--------------------------
1 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/stgit/commands/clean.py b/stgit/commands/clean.py
index e2d1678..cfcc004 100644
--- a/stgit/commands/clean.py
+++ b/stgit/commands/clean.py
@@ -37,33 +37,14 @@ options = [make_option('-a', '--applied',
def _clean(stack, clean_applied, clean_unapplied):
- def deleting(pn):
- out.info('Deleting empty patch %s' % pn)
trans = transaction.StackTransaction(stack, 'clean')
- if clean_unapplied:
- trans.unapplied = []
- for pn in stack.patchorder.unapplied:
- p = stack.patches.get(pn)
- if p.commit.data.is_empty():
- trans.patches[pn] = None
- deleting(pn)
- else:
- trans.unapplied.append(pn)
- if clean_applied:
- trans.applied = []
- parent = stack.base
- for pn in stack.patchorder.applied:
- p = stack.patches.get(pn)
- if p.commit.data.is_empty():
- trans.patches[pn] = None
- deleting(pn)
- else:
- if parent != p.commit.data.parent:
- parent = trans.patches[pn] = stack.repository.commit(
- p.commit.data.set_parent(parent))
- else:
- parent = p.commit
- trans.applied.append(pn)
+ def del_patch(pn):
+ if pn in stack.patchorder.applied:
+ return clean_applied and trans.patches[pn].data.is_empty()
+ elif pn in stack.patchorder.unapplied:
+ return clean_unapplied and trans.patches[pn].data.is_empty()
+ for pn in trans.delete_patches(del_patch):
+ trans.push_patch(pn)
trans.run()
def func(parser, options, args):
next prev parent reply other threads:[~2007-11-25 20:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-25 20:50 [StGit PATCH 00/10] Infrastructure rewrite series Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 01/10] New StGit core infrastructure: repository operations Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 02/10] Write metadata files used by the old infrastructure Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 03/10] Upgrade older stacks to newest version Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 04/10] Let "stg clean" use the new infrastructure Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 05/10] Add "stg coalesce" Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 06/10] Let "stg applied" and "stg unapplied" use the new infrastructure Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 07/10] Teach the new infrastructure about the index and worktree Karl Hasselström
2007-11-26 8:31 ` Karl Hasselström
2007-11-26 8:56 ` David Kågedal
2007-11-26 10:44 ` Karl Hasselström
2007-11-25 20:51 ` Karl Hasselström [this message]
2007-11-25 20:51 ` [StGit PATCH 09/10] Let "stg goto" use the new infrastructure Karl Hasselström
2007-11-25 20:51 ` [StGit PATCH 10/10] Convert "stg uncommit" to " 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=20071125205146.7823.47696.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=davidk@lysator.liu.se \
--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).