Skip to contentSkip to conversation

Command to move a patch to the top

PATCH New Robin Rosenberg 1 participant 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Command to move a patch to the top

From: Robin Rosenberg <[email protected]>

---

 stgit/main.py    |    3 +++
 t/t1500-float.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)
stgit/main.py +3 -0
index f59bce6..e9cc6cd 100644
@@ -38,6 +38,7 @@ import stgit.commands.clone
 import stgit.commands.commit
 import stgit.commands.export
 import stgit.commands.files
+import stgit.commands.float
 import stgit.commands.fold
 import stgit.commands.goto
 import stgit.commands.id
@@ -77,6 +78,7 @@ commands = {
     'commit':   stgit.commands.commit,
     'export':   stgit.commands.export,
     'files':    stgit.commands.files,
+    'float':    stgit.commands.float,
     'fold':     stgit.commands.fold,
     'goto':     stgit.commands.goto,
     'id':       stgit.commands.id,
@@ -113,6 +115,7 @@ stackcommands = (
     'applied',
     'clean',
     'commit',
+    'float',
     'goto',
     'init',
     'pop',
t/t1500-float.sh new file +44 -0

44 lines not on this page · raw message

#1 lore raw

PATCH 2/3 Add an optional prefix to the PATCH subject when mailing.

From: Robin Rosenberg <[email protected]>

This is for submitting patches to mailing lists with multiple projects.

---

 stgit/commands/mail.py   |   15 +++++++++++++++
 templates/covermail.tmpl |    2 +-
 templates/patchmail.tmpl |    2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)
stgit/commands/mail.py +15 -0
index bd56f16..8a713a1 100644
@@ -65,6 +65,7 @@ the following variables:
   %(diffstat)s     - diff statistics
   %(date)s         - current date/time
   %(version)s      - ' version' string passed on the command line (or empty)
+  %(prefix)s       - prefix the subject lines's "PATCH" with this
   %(patchnr)s      - patch number
   %(totalnr)s      - total number of patches to be sent
   %(number)s       - empty if only one patch is sent or ' patchnr/totalnr'
@@ -95,6 +96,8 @@ options = [make_option('-a', '--all',
                        action = 'store_true'),
            make_option('-v', '--version', metavar = 'VERSION',
                        help = 'add VERSION to the [PATCH ...] prefix'),
+           make_option('--prefix', metavar = 'PREFIX',
+                       help = 'add PREFIX to the [...PATCH ...] prefix'),
            make_option('-t', '--template', metavar = 'FILE',
                        help = 'use FILE as the message template'),
            make_option('-c', '--cover', metavar = 'FILE',
@@ -232,6 +235,11 @@ def __build_cover(tmpl, total_nr, msg_id
     else:
         version_str = ''
 
+    if options.prefix:
+        prefix_str = options.prefix + ' '
+    else:
+        prefix_str = ''
+        
     total_nr_str = str(total_nr)
     patch_nr_str = '0'.zfill(len(total_nr_str))
     if total_nr > 1:
@@ -243,6 +251,7 @@ def __build_cover(tmpl, total_nr, msg_id
                  'endofheaders': headers_end,
                  'date':         email.Utils.formatdate(localtime = True),
                  'version':      version_str,
+                 'prefix':	 prefix_str,
                  'patchnr':      patch_nr_str,
                  'totalnr':      total_nr_str,
                  'number':       number_str}
@@ -312,6 +321,11 @@ def __build_message(tmpl, patch, patch_n
     else:
         version_str = ''
 
+    if options.prefix:
+        prefix_str = options.prefix + ' '
+    else:
+        prefix_str = ''
+        
     total_nr_str = str(total_nr)
     patch_nr_str = str(patch_nr).zfill(len(total_nr_str))
     if total_nr > 1:
@@ -330,6 +344,7 @@ def __build_message(tmpl, patch, patch_n
                                               rev2 = git_id('%s//top' % patch)),
                  'date':         email.Utils.formatdate(localtime = True),
                  'version':      version_str,
+                 'prefix':       prefix_str,
                  'patchnr':      patch_nr_str,
                  'totalnr':      total_nr_str,
                  'number':       number_str,
templates/covermail.tmpl +1 -1
index 44cd19e..ba1dd9d 100644
@@ -1,5 +1,5 @@
 From: %(maintainer)s
-Subject: [PATCH%(version)s%(number)s] Series short description
+Subject: [%(prefix)sPATCH%(version)s%(number)s] Series short description
 Date: %(date)s
 %(endofheaders)s
 The following series implements...
templates/patchmail.tmpl +1 -1
index 7881993..b0df904 100644
@@ -1,5 +1,5 @@
 From: %(maintainer)s
-Subject: [PATCH%(version)s%(number)s] %(shortdescr)s
+Subject: [%(prefix)sPATCH%(version)s%(number)s] %(shortdescr)s
 Date: %(date)s
 %(endofheaders)s
 From: %(authname)s <%(authemail)s>
#2 lore raw

PATCH 3/3 Fix the --cover option.

In reply to Robin Rosenberg

From: Robin Rosenberg <[email protected]>

---

 stgit/commands/mail.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
stgit/commands/mail.py +1 -1
index 8a713a1..c7f0f46 100644
@@ -419,7 +419,7 @@ def func(parser, options, args):
     if options.cover or options.edit:
         # find the template file
         if options.cover:
-            tmpl = file(options.template).read()
+            tmpl = file(options.cover).read()
         else:
             tmpl = templates.get_template('covermail.tmpl')
             if not tmpl: