From: Catalin Marinas <catalin.marinas@arm.com>
To: git@vger.kernel.org, "Karl Hasselström" <kha@treskal.com>
Subject: [StGit PATCH 6/9] Convert 'unhide' to the lib infrastructure
Date: Tue, 28 Apr 2009 16:10:09 +0100 [thread overview]
Message-ID: <20090428151008.27261.10237.stgit@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <20090428150742.27261.19620.stgit@pc1117.cambridge.arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/unhide.py | 39 +++++++++++++++++++++------------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/stgit/commands/unhide.py b/stgit/commands/unhide.py
index 0c0832a..656ddea 100644
--- a/stgit/commands/unhide.py
+++ b/stgit/commands/unhide.py
@@ -1,5 +1,5 @@
__copyright__ = """
-Copyright (C) 2007, Catalin Marinas <catalin.marinas@gmail.com>
+Copyright (C) 2009, Catalin Marinas <catalin.marinas@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
@@ -15,12 +15,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
+from stgit.commands import common
+from stgit.lib import transaction
+from stgit import argparse
from stgit.argparse import opt
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import argparse, stack, git
help = 'Unhide a hidden patch'
kind = 'stack'
@@ -34,19 +32,24 @@ options = [
opt('-b', '--branch', args = [argparse.stg_branches],
short = 'Use BRANCH instead of the default branch')]
-directory = DirectoryHasRepository(log = True)
+directory = common.DirectoryHasRepositoryLib()
def func(parser, options, args):
- """Unhide a range of patches in the series
- """
- if args:
- # parsing all the patches for a more meaningful error reporting
- all_patches = crt_series.get_applied() + crt_series.get_unapplied() \
- + crt_series.get_hidden()
- patches = parse_patches(args, all_patches)
- else:
+ """Unhide a range of patch in the series."""
+ stack = directory.repository.current_stack
+ trans = transaction.StackTransaction(stack, 'hide')
+
+ if not args:
parser.error('No patches specified')
- for patch in patches:
- crt_series.unhide_patch(patch)
- out.info('Patch "%s" unhidden' % patch)
+ patches = common.parse_patches(args, trans.all_patches)
+ for p in patches:
+ if not p in trans.hidden:
+ raise common.CmdException('Patch "%s" not hidden' % p)
+
+ applied = list(trans.applied)
+ unapplied = trans.unapplied + patches
+ hidden = [p for p in trans.hidden if not p in set(patches)]
+
+ trans.reorder_patches(applied, unapplied, hidden)
+ return trans.run()
next prev parent reply other threads:[~2009-04-28 15:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 15:09 [StGit PATCH 0/9] Various StGit updates Catalin Marinas
2009-04-28 15:09 ` [StGit PATCH 1/9] Show "Pushing <patch>...done" when pushing a patch Catalin Marinas
2009-04-29 6:04 ` Karl Hasselström
2009-04-28 15:09 ` [StGit PATCH 2/9] Show some progress information when checking for upstream merges Catalin Marinas
2009-04-29 6:07 ` Karl Hasselström
2009-04-28 15:09 ` [StGit PATCH 3/9] Do not sleep after the last patch sent by e-mail Catalin Marinas
2009-04-29 6:13 ` Karl Hasselström
2009-04-28 15:09 ` [StGit PATCH 4/9] Convert 'clone' to the use stgit.lib Catalin Marinas
2009-04-29 6:21 ` Karl Hasselström
2009-05-13 16:10 ` Catalin Marinas
2009-04-28 15:10 ` [StGit PATCH 5/9] Convert 'hide' to the lib infrastructure Catalin Marinas
2009-04-29 6:27 ` Karl Hasselström
2009-05-13 16:08 ` Catalin Marinas
2009-04-28 15:10 ` Catalin Marinas [this message]
2009-04-29 6:29 ` [StGit PATCH 6/9] Convert 'unhide' " Karl Hasselström
2009-04-28 15:10 ` [StGit PATCH 7/9] Reinstate the --annotate option for refresh Catalin Marinas
2009-04-29 6:33 ` Karl Hasselström
2009-04-28 15:10 ` [StGit PATCH 8/9] Add the log --clear option Catalin Marinas
2009-04-29 6:35 ` Karl Hasselström
2009-04-28 15:10 ` [StGit PATCH 9/9] Use the default git colouring scheme rather than specific scripts Catalin Marinas
2009-04-29 6:43 ` Karl Hasselström
2009-04-29 11:48 ` Samuel Tardieu
2009-04-29 11:56 ` Samuel Tardieu
2009-04-29 14:25 ` Karl Hasselström
2009-05-04 12:48 ` Shinya Kuribayashi
2009-05-29 12:22 ` Catalin Marinas
2009-05-30 0:36 ` Shinya Kuribayashi
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=20090428151008.27261.10237.stgit@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
/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).