{"thread":{"id":"14285","subject":"[StGit PATCH 0/2] stg refresh -e/--edit","startedAt":"2008-07-04T06:40:24Z","lastAt":"2008-07-07T20:56:29Z","messageCount":5,"participants":["Karl Hasselström","Jakub Narebski","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"82203","messageId":"20080704063755.9637.23750.stgit@yoghurt","threadId":"14285","inReplyTo":null,"subject":"[StGit PATCH 0/2] stg refresh -e/--edit","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-04T06:40:24Z","receivedAt":"2008-07-04T06:40:24Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Jakub, this one's for you. ;-)\n\nThese live in my experimental branch for a little while yet, but the\nplan is to include them in v0.15 -- and release that reasonably soon.\n\n---\n\nKarl Hasselström (2):\n      Implement \"stg refresh --edit\" again\n      Refactor stgit.commands.edit\n\n\n stgit/commands/coalesce.py |    2 -\n stgit/commands/common.py   |    9 +++-\n stgit/commands/edit.py     |   82 ++++++------------------------------\n stgit/commands/imprt.py    |    2 -\n stgit/commands/new.py      |    3 +\n stgit/commands/refresh.py  |   44 +++++++++++++++-----\n stgit/lib/edit.py          |   99 ++++++++++++++++++++++++++++++++++++++++++++\n stgit/utils.py             |   18 +++++---\n 8 files changed, 167 insertions(+), 92 deletions(-)\n create mode 100644 stgit/lib/edit.py\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"82204","messageId":"20080704064030.9637.95802.stgit@yoghurt","threadId":"14285","inReplyTo":"20080704063755.9637.23750.stgit@yoghurt","subject":"[StGit PATCH 1/2] Refactor stgit.commands.edit","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-04T06:40:30Z","receivedAt":"2008-07-04T06:40:30Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Reorganize a few existing functions, and break out stuff from the main\nfunction into subroutines.\n\nWhile we're at it, move one of the old and all of the new functions to\nstgit.lib.edit, so that we can use them in a later patch to implement\n\"stg refresh --edit\".\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/common.py |    9 +++-\n stgit/commands/edit.py   |   79 +++++--------------------------------\n stgit/commands/imprt.py  |    2 -\n stgit/lib/edit.py        |   99 ++++++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 117 insertions(+), 72 deletions(-)\n create mode 100644 stgit/lib/edit.py\n\n\ndiff --git a/stgit/commands/common.py b/stgit/commands/common.py\nindex 2689a42..c92554d 100644\n--- a/stgit/commands/common.py\n+++ b/stgit/commands/common.py\n@@ -453,12 +453,15 @@ def parse_mail(msg):\n \n     return (descr, authname, authemail, authdate, diff)\n \n-def parse_patch(text):\n+def parse_patch(text, contains_diff):\n     \"\"\"Parse the input text and return (description, authname,\n     authemail, authdate, diff)\n     \"\"\"\n-    descr, diff = __split_descr_diff(text)\n-    descr, authname, authemail, authdate = __parse_description(descr)\n+    if contains_diff:\n+        (text, diff) = __split_descr_diff(text)\n+    else:\n+        diff = None\n+    (descr, authname, authemail, authdate) = __parse_description(text)\n \n     # we don't yet have an agreed place for the creation date.\n     # Just return None\ndiff --git a/stgit/commands/edit.py b/stgit/commands/edit.py\nindex a8499c6..a9e8991 100644\n--- a/stgit/commands/edit.py\n+++ b/stgit/commands/edit.py\n@@ -22,7 +22,7 @@ from optparse import make_option\n \n from stgit import git, utils\n from stgit.commands import common\n-from stgit.lib import git as gitlib, transaction\n+from stgit.lib import git as gitlib, transaction, edit\n from stgit.out import *\n \n help = 'edit a patch description or diff'\n@@ -64,45 +64,6 @@ options = [make_option('-d', '--diff',\n                 + utils.make_author_committer_options()\n                 + utils.make_diff_opts_option())\n \n-def patch_diff(repository, cd, diff, diff_flags):\n-    if diff:\n-        diff = repository.diff_tree(cd.parent.data.tree, cd.tree, diff_flags)\n-        return '\\n'.join([git.diffstat(diff), diff])\n-    else:\n-        return None\n-\n-def patch_description(cd, diff):\n-    \"\"\"Generate a string containing the description to edit.\"\"\"\n-\n-    desc = ['From: %s <%s>' % (cd.author.name, cd.author.email),\n-            'Date: %s' % cd.author.date.isoformat(),\n-            '',\n-            cd.message]\n-    if diff:\n-        desc += ['---',\n-                 '',\n-                diff]\n-    return '\\n'.join(desc)\n-\n-def patch_desc(repository, cd, failed_diff, diff, diff_flags):\n-    return patch_description(cd, failed_diff or patch_diff(\n-            repository, cd, diff, diff_flags))\n-\n-def update_patch_description(repository, cd, text):\n-    message, authname, authemail, authdate, diff = common.parse_patch(text)\n-    cd = (cd.set_message(message)\n-            .set_author(cd.author.set_name(authname)\n-                                 .set_email(authemail)\n-                                 .set_date(gitlib.Date.maybe(authdate))))\n-    failed_diff = None\n-    if diff:\n-        tree = repository.apply(cd.parent.data.tree, diff)\n-        if tree == None:\n-            failed_diff = diff\n-        else:\n-            cd = cd.set_tree(tree)\n-    return cd, failed_diff\n-\n def func(parser, options, args):\n     \"\"\"Edit the given patch or the current one.\n     \"\"\"\n@@ -122,44 +83,26 @@ def func(parser, options, args):\n \n     cd = orig_cd = stack.patches.get(patchname).commit.data\n \n-    # Read patch from user-provided description.\n-    if options.message == None:\n-        failed_diff = None\n-    else:\n-        cd, failed_diff = update_patch_description(stack.repository, cd,\n-                                                   options.message)\n-\n-    # Modify author and committer data.\n-    a, c = options.author(cd.author), options.committer(cd.committer)\n-    if (a, c) != (cd.author, cd.committer):\n-        cd = cd.set_author(a).set_committer(c)\n-\n-    # Add Signed-off-by: or similar.\n-    if options.sign_str != None:\n-        cd = cd.set_message(utils.add_sign_line(\n-                cd.message, options.sign_str, gitlib.Person.committer().name,\n-                gitlib.Person.committer().email))\n+    cd, failed_diff = edit.auto_edit_patch(\n+        stack.repository, cd, msg = options.message, contains_diff = True,\n+        author = options.author, committer = options.committer,\n+        sign_str = options.sign_str)\n \n     if options.save_template:\n         options.save_template(\n-            patch_desc(stack.repository, cd, failed_diff,\n-                       options.diff, options.diff_flags))\n+            patch_desc(stack.repository, cd,\n+                       options.diff, options.diff_flags, failed_diff))\n         return utils.STGIT_SUCCESS\n \n-    # Let user edit the patch manually.\n     if cd == orig_cd or options.edit:\n-        fn = '.stgit-edit.' + ['txt', 'patch'][bool(options.diff)]\n-        cd, failed_diff = update_patch_description(\n-            stack.repository, cd, utils.edit_string(\n-                patch_desc(stack.repository, cd, failed_diff,\n-                           options.diff, options.diff_flags),\n-                fn))\n+        cd, failed_diff = edit.interactive_edit_patch(\n+            stack.repository, cd, options.diff, options.diff_flags, failed_diff)\n \n     def failed():\n         fn = '.stgit-failed.patch'\n         f = file(fn, 'w')\n-        f.write(patch_desc(stack.repository, cd, failed_diff,\n-                           options.diff, options.diff_flags))\n+        f.write(patch_desc(stack.repository, cd,\n+                           options.diff, options.diff_flags, failed_diff))\n         f.close()\n         out.error('Edited patch did not apply.',\n                   'It has been saved to \"%s\".' % fn)\ndiff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py\nindex 5fb4da3..b958412 100644\n--- a/stgit/commands/imprt.py\n+++ b/stgit/commands/imprt.py\n@@ -220,7 +220,7 @@ def __import_file(filename, options, patch = None):\n                  parse_mail(msg)\n     else:\n         message, author_name, author_email, author_date, diff = \\\n-                 parse_patch(f.read())\n+                 parse_patch(f.read(), contains_diff = True)\n \n     if filename:\n         f.close()\ndiff --git a/stgit/lib/edit.py b/stgit/lib/edit.py\nnew file mode 100644\nindex 0000000..6874355\n--- /dev/null\n+++ b/stgit/lib/edit.py\n@@ -0,0 +1,99 @@\n+\"\"\"This module contains utility functions for patch editing.\"\"\"\n+\n+from stgit import utils\n+from stgit.commands import common\n+from stgit.lib import git\n+\n+def update_patch_description(repo, cd, text, contains_diff):\n+    \"\"\"Update the given L{CommitData<stgit.lib.git.CommitData>} with the\n+    given text description, which may contain author name and time\n+    stamp in addition to a new commit message. If C{contains_diff} is\n+    true, it may also contain a replacement diff.\n+\n+    Return a pair: the new L{CommitData<stgit.lib.git.CommitData>};\n+    and the diff text if it didn't apply, or C{None} otherwise.\"\"\"\n+    (message, authname, authemail, authdate, diff\n+     ) = common.parse_patch(text, contains_diff)\n+    a = cd.author\n+    for val, setter in [(authname, 'set_name'), (authemail, 'set_email'),\n+                        (git.Date.maybe(authdate), 'set_date')]:\n+        if val != None:\n+            a = getattr(a, setter)(val)\n+    cd = cd.set_message(message).set_author(a)\n+    failed_diff = None\n+    if diff:\n+        tree = repo.apply(cd.parent.data.tree, diff)\n+        if tree == None:\n+            failed_diff = diff\n+        else:\n+            cd = cd.set_tree(tree)\n+    return cd, failed_diff\n+\n+def patch_desc(repo, cd, append_diff, diff_flags, replacement_diff):\n+    \"\"\"Return a description text for the patch, suitable for editing\n+    and/or reimporting with L{update_patch_description()}.\n+\n+    @param cd: The L{CommitData<stgit.lib.git.CommitData>} to generate\n+               a description of\n+    @param append_diff: Whether to append the patch diff to the\n+                        description\n+    @type append_diff: C{bool}\n+    @param diff_flags: Extra parameters to pass to C{git diff}\n+    @param replacement_diff: Diff text to use; or C{None} if it should\n+                             be computed from C{cd}\n+    @type replacement_diff: C{str} or C{None}\"\"\"\n+    desc = ['From: %s <%s>' % (cd.author.name, cd.author.email),\n+            'Date: %s' % cd.author.date.isoformat(),\n+            '',\n+            cd.message]\n+    if append_diff:\n+        if replacement_diff:\n+            diff = replacement_diff\n+        else:\n+            just_diff = repo.diff_tree(cd.parent.data.tree, cd.tree, diff_flags)\n+            diff = '\\n'.join([git.diffstat(just_diff), just_diff])\n+        desc += ['---', '', diff]\n+    return '\\n'.join(desc)\n+\n+def interactive_edit_patch(repo, cd, edit_diff, diff_flags, replacement_diff):\n+    \"\"\"Edit the patch interactively. If C{edit_diff} is true, edit the\n+    diff as well. If C{replacement_diff} is not C{None}, it contains a\n+    diff to edit instead of the patch's real diff.\n+\n+    Return a pair: the new L{CommitData<stgit.lib.git.CommitData>};\n+    and the diff text if it didn't apply, or C{None} otherwise.\"\"\"\n+    return update_patch_description(\n+        repo, cd, utils.edit_string(\n+            patch_desc(repo, cd, edit_diff, diff_flags, replacement_diff),\n+            '.stgit-edit.' + ['txt', 'patch'][bool(edit_diff)]),\n+        edit_diff)\n+\n+def auto_edit_patch(repo, cd, msg, contains_diff, author, committer, sign_str):\n+    \"\"\"Edit the patch noninteractively in a couple of ways:\n+\n+         - If C{msg} is not C{None}, parse it to find a replacement\n+           message, and possibly also replacement author and\n+           timestamp. If C{contains_diff} is true, also look for a\n+           replacement diff.\n+\n+         - C{author} and C{committer} are two functions that take the\n+           original L{Person<stgit.lib.git.Person>} value as argument,\n+           and return the new one.\n+\n+         - C{sign_str}, if not C{None}, is a sign string to append to\n+           the message.\n+\n+    Return a pair: the new L{CommitData<stgit.lib.git.CommitData>};\n+    and the diff text if it didn't apply, or C{None} otherwise.\"\"\"\n+    if msg == None:\n+        failed_diff = None\n+    else:\n+        cd, failed_diff = update_patch_description(repo, cd, msg, contains_diff)\n+    a, c = author(cd.author), committer(cd.committer)\n+    if (a, c) != (cd.author, cd.committer):\n+        cd = cd.set_author(a).set_committer(c)\n+    if sign_str != None:\n+        cd = cd.set_message(utils.add_sign_line(\n+                cd.message, sign_str, git.Person.committer().name,\n+                git.Person.committer().email))\n+    return cd, failed_diff\n"},{"id":"82205","messageId":"20080704064036.9637.52951.stgit@yoghurt","threadId":"14285","inReplyTo":"20080704063755.9637.23750.stgit@yoghurt","subject":"[StGit PATCH 2/2] Implement \"stg refresh --edit\" again","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-04T06:40:36Z","receivedAt":"2008-07-04T06:40:36Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"The -e/--edit flag to \"stg refresh\" was dropped between v0.13 and\nv0.14, causing severe user dissatisfaction. This patch restores it,\nalong with -m/--message, -f/--file, --sign, --ack, --author,\n--authname, --authemail, and --authdate.\n\nI omitted the --committer options on purpose; I think they are a\nmistake. Falsifying the committer info is not a common operation, and\nif one wishes to do it for some reason, one can always set the\nGIT_COMMITTER_* environment variables.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/coalesce.py |    2 +-\n stgit/commands/edit.py     |    3 ++-\n stgit/commands/new.py      |    3 ++-\n stgit/commands/refresh.py  |   44 +++++++++++++++++++++++++++++++++-----------\n stgit/utils.py             |   18 ++++++++++++------\n 5 files changed, 50 insertions(+), 20 deletions(-)\n\n\ndiff --git a/stgit/commands/coalesce.py b/stgit/commands/coalesce.py\nindex 1a34934..f3954ce 100644\n--- a/stgit/commands/coalesce.py\n+++ b/stgit/commands/coalesce.py\n@@ -35,7 +35,7 @@ done a sequence of pushes and pops yourself.\"\"\"\n \n directory = common.DirectoryHasRepositoryLib()\n options = [make_option('-n', '--name', help = 'name of coalesced patch')\n-           ] + utils.make_message_options()\n+           ] + utils.make_message_options(save_template = True)\n \n class SaveTemplateDone(Exception):\n     pass\ndiff --git a/stgit/commands/edit.py b/stgit/commands/edit.py\nindex a9e8991..a83ec9c 100644\n--- a/stgit/commands/edit.py\n+++ b/stgit/commands/edit.py\n@@ -60,7 +60,8 @@ options = [make_option('-d', '--diff',\n                        action = 'store_true'),\n            make_option('-e', '--edit', action = 'store_true',\n                        help = 'invoke interactive editor'),\n-           ] + (utils.make_sign_options() + utils.make_message_options()\n+           ] + (utils.make_sign_options()\n+                + utils.make_message_options(save_template = True)\n                 + utils.make_author_committer_options()\n                 + utils.make_diff_opts_option())\n \ndiff --git a/stgit/commands/new.py b/stgit/commands/new.py\nindex c4ee4e1..f468ab0 100644\n--- a/stgit/commands/new.py\n+++ b/stgit/commands/new.py\n@@ -38,7 +38,8 @@ line of the commit message.\"\"\"\n \n directory = common.DirectoryHasRepositoryLib()\n options = (utils.make_author_committer_options()\n-           + utils.make_message_options() + utils.make_sign_options())\n+           + utils.make_message_options(save_template = True)\n+           + utils.make_sign_options())\n \n def func(parser, options, args):\n     \"\"\"Create a new patch.\"\"\"\ndiff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py\nindex 7afc55e..37cb559 100644\n--- a/stgit/commands/refresh.py\n+++ b/stgit/commands/refresh.py\n@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n \n from optparse import make_option\n from stgit.commands import common\n-from stgit.lib import git, transaction\n+from stgit.lib import git, transaction, edit\n from stgit import utils\n \n help = 'generate a new commit for the current patch'\n@@ -53,7 +53,11 @@ options = [make_option('-u', '--update', action = 'store_true',\n                        help = ('only include changes from the index, not'\n                                ' from the work tree')),\n            make_option('-p', '--patch',\n-                       help = 'refresh PATCH instead of the topmost patch')]\n+                       help = 'refresh PATCH instead of the topmost patch'),\n+           make_option('-e', '--edit', action = 'store_true',\n+                       help = 'invoke an editor for the patch description')\n+           ] + (utils.make_message_options(save_template = False)\n+                + utils.make_sign_options() + utils.make_author_options())\n \n def get_patch(stack, given_patch):\n     \"\"\"Get the name of the patch we are to refresh.\"\"\"\n@@ -116,9 +120,12 @@ def make_temp_patch(stack, patch_name, paths, temp_index):\n     return trans.run(stack.repository.default_iw,\n                      print_current_patch = False), temp_name\n \n-def absorb_applied(trans, iw, patch_name, temp_name):\n+def absorb_applied(trans, iw, patch_name, temp_name, edit_fun):\n     \"\"\"Absorb the temp patch (C{temp_name}) into the given patch\n-    (C{patch_name}), which must be applied.\n+    (C{patch_name}), which must be applied. If the absorption\n+    succeeds, call C{edit_fun} on the resulting\n+    L{CommitData<stgit.lib.git.CommitData>} before committing it and\n+    commit the return value.\n \n     @return: C{True} if we managed to absorb the temp patch, C{False}\n              if we had to leave it for the user to deal with.\"\"\"\n@@ -136,7 +143,7 @@ def absorb_applied(trans, iw, patch_name, temp_name):\n         temp_cd = trans.patches[temp_name].data\n         assert trans.patches[patch_name] == temp_cd.parent\n         trans.patches[patch_name] = trans.stack.repository.commit(\n-            trans.patches[patch_name].data.set_tree(temp_cd.tree))\n+            edit_fun(trans.patches[patch_name].data.set_tree(temp_cd.tree)))\n         popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)\n         assert not popped # the temp patch was topmost\n         temp_absorbed = True\n@@ -148,9 +155,12 @@ def absorb_applied(trans, iw, patch_name, temp_name):\n         pass\n     return temp_absorbed\n \n-def absorb_unapplied(trans, iw, patch_name, temp_name):\n+def absorb_unapplied(trans, iw, patch_name, temp_name, edit_fun):\n     \"\"\"Absorb the temp patch (C{temp_name}) into the given patch\n-    (C{patch_name}), which must be unapplied.\n+    (C{patch_name}), which must be unapplied. If the absorption\n+    succeeds, call C{edit_fun} on the resulting\n+    L{CommitData<stgit.lib.git.CommitData>} before committing it and\n+    commit the return value.\n \n     @param iw: Not used.\n     @return: C{True} if we managed to absorb the temp patch, C{False}\n@@ -174,7 +184,7 @@ def absorb_unapplied(trans, iw, patch_name, temp_name):\n         # It worked. Refresh the patch with the new tree, and delete\n         # the temp patch.\n         trans.patches[patch_name] = trans.stack.repository.commit(\n-            patch_cd.set_tree(new_tree))\n+            edit_fun(patch_cd.set_tree(new_tree)))\n         popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)\n         assert not popped # the temp patch was not applied\n         return True\n@@ -183,13 +193,13 @@ def absorb_unapplied(trans, iw, patch_name, temp_name):\n         # leave the temp patch for the user.\n         return False\n \n-def absorb(stack, patch_name, temp_name):\n+def absorb(stack, patch_name, temp_name, edit_fun):\n     \"\"\"Absorb the temp patch into the target patch.\"\"\"\n     trans = transaction.StackTransaction(stack, 'refresh')\n     iw = stack.repository.default_iw\n     f = { True: absorb_applied, False: absorb_unapplied\n           }[patch_name in trans.applied]\n-    if f(trans, iw, patch_name, temp_name):\n+    if f(trans, iw, patch_name, temp_name, edit_fun):\n         def info_msg(): pass\n     else:\n         def info_msg():\n@@ -223,4 +233,16 @@ def func(parser, options, args):\n         stack, patch_name, paths, temp_index = path_limiting)\n     if retval != utils.STGIT_SUCCESS:\n         return retval\n-    return absorb(stack, patch_name, temp_name)\n+    def edit_fun(cd):\n+        cd, failed_diff = edit.auto_edit_patch(\n+            stack.repository, cd, msg = options.message, contains_diff = False,\n+            author = options.author, committer = lambda p: p,\n+            sign_str = options.sign_str)\n+        assert not failed_diff\n+        if options.edit:\n+            cd, failed_diff = edit.interactive_edit_patch(\n+                stack.repository, cd, edit_diff = False,\n+                diff_flags = [], replacement_diff = None)\n+            assert not failed_diff\n+        return cd\n+    return absorb(stack, patch_name, temp_name, edit_fun)\ndiff --git a/stgit/utils.py b/stgit/utils.py\nindex 2983ea8..c40e666 100644\n--- a/stgit/utils.py\n+++ b/stgit/utils.py\n@@ -264,13 +264,13 @@ def add_sign_line(desc, sign_str, name, email):\n         desc = desc + '\\n'\n     return '%s\\n%s\\n' % (desc, sign_str)\n \n-def make_message_options():\n+def make_message_options(save_template):\n     def no_dup(parser):\n         if parser.values.message != None:\n             raise optparse.OptionValueError(\n                 'Cannot give more than one --message or --file')\n     def no_combine(parser):\n-        if (parser.values.message != None\n+        if (save_template and parser.values.message != None\n             and parser.values.save_template != None):\n             raise optparse.OptionValueError(\n                 'Cannot give both --message/--file and --save-template')\n@@ -299,15 +299,18 @@ def make_message_options():\n         parser.values.save_template = w\n         no_combine(parser)\n     m = optparse.make_option\n-    return [m('-m', '--message', action = 'callback', callback = msg_callback,\n+    opts = [m('-m', '--message', action = 'callback', callback = msg_callback,\n               dest = 'message', type = 'string',\n               help = 'use MESSAGE instead of invoking the editor'),\n             m('-f', '--file', action = 'callback', callback = file_callback,\n               dest = 'message', type = 'string', metavar = 'FILE',\n-              help = 'use FILE instead of invoking the editor'),\n+              help = 'use FILE instead of invoking the editor')]\n+    if save_template:\n+        opts.append(\n             m('--save-template', action = 'callback', callback = templ_callback,\n               metavar = 'FILE', dest = 'save_template', type = 'string',\n-              help = 'save the message template to FILE and exit')]\n+              help = 'save the message template to FILE and exit'))\n+    return opts\n \n def make_diff_opts_option():\n     def diff_opts_callback(option, opt_str, value, parser):\n@@ -368,8 +371,11 @@ def make_person_options(person, short):\n                 callback_args = (f,), help = 'set the %s %s' % (person, f))\n                for f in ['name', 'email', 'date']])\n \n+def make_author_options():\n+    return make_person_options('author', 'auth')\n+\n def make_author_committer_options():\n-    return (make_person_options('author', 'auth')\n+    return (make_author_options()\n             + make_person_options('committer', 'comm'))\n \n # Exit codes.\n"},{"id":"82209","messageId":"200807040932.56166.jnareb@gmail.com","threadId":"14285","inReplyTo":"20080704064036.9637.52951.stgit@yoghurt","subject":"Re: [StGit PATCH 2/2] Implement \"stg refresh --edit\" again","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-07-04T07:32:54Z","receivedAt":"2008-07-04T07:32:54Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Karl Hasselström napisał:\n\n> The -e/--edit flag to \"stg refresh\" was dropped between v0.13 and\n> v0.14, causing severe user dissatisfaction. This patch restores it\n\nThanks a lot!\n-- \nJakub Narebski\nPoland\n"},{"id":"82493","messageId":"b0943d9e0807071356v2a249e4cx4a9f94e73bffb741@mail.gmail.com","threadId":"14285","inReplyTo":"20080704064036.9637.52951.stgit@yoghurt","subject":"Re: [StGit PATCH 2/2] Implement \"stg refresh --edit\" again","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2008-07-07T20:56:29Z","receivedAt":"2008-07-07T20:56:29Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"2008/7/4 Karl Hasselström <kha@treskal.com>:\n> The -e/--edit flag to \"stg refresh\" was dropped between v0.13 and\n> v0.14, causing severe user dissatisfaction. This patch restores it,\n> along with -m/--message, -f/--file, --sign, --ack, --author,\n> --authname, --authemail, and --authdate.\n\nThanks.\n\n> I omitted the --committer options on purpose; I think they are a\n> mistake. Falsifying the committer info is not a common operation, and\n> if one wishes to do it for some reason, one can always set the\n> GIT_COMMITTER_* environment variables.\n\nI agree.\n\n-- \nCatalin\n"}]}