git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGIT PATCH 1/5] Allow stack.patchorder.all to return hidden patches

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Jun 4, 2008, 21:13 UTC
Message-ID
<20080604211316.32531.84226.stgit@localhost.localdomain>
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]:
Previous: Catalin MarinasNext: Karl Hasselström
Message 2 of 28 in “Various updates to the new infrastructure”
  1. 0/5 Various updates to the new infrastructureCatalin Marinas, Jun 4, 2008
  2. 1/5 Allow stack.patchorder.all to return hidden patchesCatalin Marinas, Jun 4, 2008
  3. Karl HasselströmJun 5, 2008
  4. Catalin MarinasJun 5, 2008
  5. 2/5 Rename Repository.head to Repository.head_refCatalin Marinas, Jun 4, 2008
  6. Karl HasselströmJun 5, 2008
  7. Catalin MarinasJun 5, 2008
  8. Karl HasselströmJun 5, 2008
  9. Catalin MarinasJun 5, 2008
  10. Karl HasselströmJun 5, 2008
  11. 3/5 Create a git.Branch class as ancestor of stack.StackCatalin Marinas, Jun 4, 2008
  12. Karl HasselströmJun 5, 2008
  13. Catalin MarinasJun 5, 2008
  14. Karl HasselströmJun 5, 2008
  15. Catalin MarinasJun 6, 2008
  16. Karl HasselströmJun 7, 2008
  17. Catalin MarinasJun 8, 2008
  18. David AguilarJun 9, 2008
  19. Sverre RabbelierJun 9, 2008
  20. Karl HasselströmJun 9, 2008
  21. 4/5 Add stack creation and initialisation support to lib.StackCatalin Marinas, Jun 4, 2008
  22. Karl HasselströmJun 5, 2008
  23. Catalin MarinasJun 5, 2008
  24. Karl HasselströmJun 7, 2008
  25. 5/5 Add stack creation and deletion support to the new infrastructureCatalin Marinas, Jun 4, 2008
  26. Karl HasselströmJun 5, 2008
  27. Catalin MarinasJun 5, 2008
  28. Karl HasselströmJun 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.