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

[PATCH 2/4] Allows to refresh a non-top applied patch.

From
Yann Dirson <ydirson@altern.org>
Date
Nov 23, 2006, 23:16 UTC
Message-ID
<20061123231649.9769.46624.stgit@gandelf.nowhere.earth>
In-Reply-To
<20061123230721.9769.38403.stgit@gandelf.nowhere.earth>
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 stgit/commands/refresh.py |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index 610d18a..ea0fe6f 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -66,6 +66,8 @@ options = [make_option('-f', '--force',
            make_option('--commemail',
                        help = 'use COMMEMAIL as the committer ' \
                        'e-mail'),
+           make_option('-p', '--patch',
+                       help = 'refresh named (applied) PATCH instead of the top one'),
            make_option('--sign',
                        help = 'add Signed-off-by line',
                        action = 'store_true'),
@@ -80,9 +82,15 @@ def func(parser, options, args):
     if autoresolved != 'yes':
         check_conflicts()
 
-    patch = crt_series.get_current()
-    if not patch:
-        raise CmdException, 'No patches applied'
+    if options.patch:
+        patch = options.patch
+        if not crt_series.patch_applied(patch):
+            raise CmdException, 'Patches "%s" not applied' % patch
+        origpatch = crt_series.get_current()
+    else:
+        patch = crt_series.get_current()
+        if not patch:
+            raise CmdException, 'No patches applied'
 
     if not options.force:
         check_head_top_equal()
@@ -110,6 +118,13 @@ def func(parser, options, args):
            or options.authname or options.authemail or options.authdate \
            or options.commname or options.commemail \
            or options.sign or options.ack:
+
+        if options.patch:
+            applied = crt_series.get_applied()
+            between = applied[applied.index(patch)+1:]
+            between.reverse()
+            pop_patches(between)
+
         print 'Refreshing patch "%s"...' % patch,
         sys.stdout.flush()
 
@@ -126,6 +141,10 @@ def func(parser, options, args):
                                  committer_email = options.commemail,
                                  backup = True, sign_str = sign_str)
 
+        if options.patch:
+            between.reverse()
+            push_patches(between)
+
         print 'done'
     else:
Previous: Yann DirsonNext: Yann Dirson
Message 3 of 6 in “Series short description”
  1. 0/4 Series short descriptionYann Dirson, Nov 23, 2006
  2. 1/4 Make Series::patch_applied public.Yann Dirson, Nov 23, 2006
  3. 2/4 Allows to refresh a non-top applied patch.Yann Dirson, Nov 23, 2006
  4. 3/4 Optimize stg goto in the pop case.Yann Dirson, Nov 23, 2006
  5. 4/4 Bomb out when --ack and --sign are both passed to "refresh".Yann Dirson, Nov 23, 2006
  6. Catalin MarinasNov 24, 2006

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.