git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: git@vger.kernel.org
Cc: kha@treskal.com
Subject: [StGIT PATCH 1/5] Allow stack.patchorder.all to return hidden patches
Date: Wed, 04 Jun 2008 22:13:17 +0100	[thread overview]
Message-ID: <20080604211316.32531.84226.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080604210655.32531.82580.stgit@localhost.localdomain>

A new property, patchorder.all_visible, was added to return only the
applied + unapplied patches. This is used in the "commit" command to
avoid automatically committing the hidden patches.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---

 stgit/commands/commit.py  |    4 ++--
 stgit/lib/stack.py        |    4 ++--
 stgit/lib/stackupgrade.py |    7 +++++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/stgit/commands/commit.py b/stgit/commands/commit.py
index cc2f13a..1bdbeea 100644
--- a/stgit/commands/commit.py
+++ b/stgit/commands/commit.py
@@ -45,11 +45,11 @@ options = [make_option('-n', '--number', type = 'int',
 def func(parser, options, args):
     """Commit a number of patches."""
     stack = directory.repository.current_stack
-    args = common.parse_patches(args, list(stack.patchorder.all))
+    args = common.parse_patches(args, list(stack.patchorder.all_visible))
     if len([x for x in [args, options.number != None, options.all] if x]) > 1:
         parser.error('too many options')
     if args:
-        patches = [pn for pn in stack.patchorder.all if pn in args]
+        patches = [pn for pn in stack.patchorder.all_visible if pn in args]
         bad = set(args) - set(patches)
         if bad:
             raise common.CmdException('Bad patch names: %s'
diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py
index f9e750e..bdd21b1 100644
--- a/stgit/lib/stack.py
+++ b/stgit/lib/stack.py
@@ -102,8 +102,8 @@ class PatchOrder(object):
                          lambda self, val: self.__set_list('unapplied', val))
     hidden = property(lambda self: self.__get_list('hidden'),
                       lambda self, val: self.__set_list('hidden', val))
-    # don't return the hidden patches, these have to be returned explicitly
-    all = property(lambda self: self.applied + self.unapplied)
+    all = property(lambda self: self.applied + self.unapplied + self.hidden)
+    all_visible = property(lambda self: self.applied + self.unapplied)
 
 class Patches(object):
     """Creates L{Patch} objects. Makes sure there is only one such object
diff --git a/stgit/lib/stackupgrade.py b/stgit/lib/stackupgrade.py
index 96ccb79..4b437dc 100644
--- a/stgit/lib/stackupgrade.py
+++ b/stgit/lib/stackupgrade.py
@@ -90,6 +90,13 @@ def update_to_current_format_version(repository, branch):
         rm_ref('refs/bases/%s' % branch)
         set_format_version(2)
 
+    # compatibility with the new infrastructure. The changes here do not
+    # affect the compatibility with the old infrastructure (format version 2)
+    if get_format_version() == 2:
+        hidden_file = os.path.join(branch_dir, 'hidden')
+        if not os.path.isfile(hidden_file):
+            utils.create_empty_file(hidden_file)
+
     # Make sure we're at the latest version.
     fv = get_format_version()
     if not fv in [None, FORMAT_VERSION]:

  reply	other threads:[~2008-06-04 21:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 21:13 [StGIT PATCH 0/5] Various updates to the new infrastructure Catalin Marinas
2008-06-04 21:13 ` Catalin Marinas [this message]
2008-06-05  6:41   ` [StGIT PATCH 1/5] Allow stack.patchorder.all to return hidden patches Karl Hasselström
2008-06-05 11:46     ` Catalin Marinas
2008-06-04 21:13 ` [StGIT PATCH 2/5] Rename Repository.head to Repository.head_ref Catalin Marinas
2008-06-05  6:46   ` Karl Hasselström
2008-06-05 11:49     ` Catalin Marinas
2008-06-05 11:58       ` Karl Hasselström
2008-06-05 12:06         ` Catalin Marinas
2008-06-05 12:46           ` Karl Hasselström
2008-06-04 21:13 ` [StGIT PATCH 3/5] Create a git.Branch class as ancestor of stack.Stack Catalin Marinas
2008-06-05  7:01   ` Karl Hasselström
2008-06-05 12:03     ` Catalin Marinas
2008-06-05 13:04       ` Karl Hasselström
2008-06-06  8:44         ` Catalin Marinas
2008-06-07  9:06           ` Karl Hasselström
2008-06-08 22:16             ` Catalin Marinas
2008-06-09  0:07               ` David Aguilar
2008-06-09  0:46                 ` Sverre Rabbelier
2008-06-09  7:07               ` Karl Hasselström
2008-06-04 21:13 ` [StGIT PATCH 4/5] Add stack creation and initialisation support to lib.Stack Catalin Marinas
2008-06-05  7:28   ` Karl Hasselström
2008-06-05 12:42     ` Catalin Marinas
2008-06-07  8:59       ` Karl Hasselström
2008-06-04 21:13 ` [StGIT PATCH 5/5] Add stack creation and deletion support to the new infrastructure Catalin Marinas
2008-06-05  7:34   ` Karl Hasselström
2008-06-05  9:43     ` Catalin Marinas
2008-06-05  7:38 ` [StGIT PATCH 0/5] Various updates " 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=20080604211316.32531.84226.stgit@localhost.localdomain \
    --to=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).