{"thread":{"id":"43163","subject":"Re: [PATCH 2/2] Don't require config file for \"stg mail\"","startedAt":"2006-11-29T03:59:25Z","lastAt":"2006-11-30T08:32:08Z","messageCount":5,"participants":["Pavel Roskin","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"296954","messageId":"20061129035925.6118.78329.stgit@dv.roinet.com","threadId":"43163","inReplyTo":null,"subject":"[PATCH 1/2] Set HOME to the test directory to avoid reading ~/.stgitrc","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2006-11-29T03:59:25Z","receivedAt":"2006-11-29T03:59:25Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"This makes the tests more system independent and allows better testing\nfor \"stg mail\" command.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n---\n\n t/test-lib.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 6339c54..459d5cb 100755\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -193,7 +193,8 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in trash subdirectory.\n PATH=$(pwd)/..:$PATH\n-export PATH\n+HOME=$(pwd)/trash\n+export PATH HOME\n \n \n # Test repository\n"},{"id":"296835","messageId":"20061129035930.6118.88435.stgit@dv.roinet.com","threadId":"43163","inReplyTo":"20061129035925.6118.78329.stgit@dv.roinet.com","subject":"[PATCH 2/2] Don't require config file for \"stg mail\"","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2006-11-29T03:59:30Z","receivedAt":"2006-11-29T03:59:30Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"When calculating the string to be used in the From: field, don't require\nit to come from the configuration file.  Instead, reuse already known\nauthname and authemail values as the default.  They can be taken from\nthe GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n---\n\n stgit/commands/mail.py |   15 +++++----------\n 1 files changed, 5 insertions(+), 10 deletions(-)\n\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex 176d7a2..70b091f 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -122,18 +122,13 @@ options = [make_option('-a', '--all',\n                        action = 'store_true')]\n \n \n-def __get_sender():\n-    \"\"\"Return the 'authname <authemail>' string as read from the\n-    configuration file\n+def __get_sender(authname, authemail):\n+    \"\"\"Return the string to be used in the From: field\n     \"\"\"\n     if config.has_option('stgit', 'sender'):\n         return config.get('stgit', 'sender')\n-    elif config.has_option('stgit', 'authname') \\\n-             and config.has_option('stgit', 'authemail'):\n-        return '%s <%s>' % (config.get('stgit', 'authname'),\n-                            config.get('stgit', 'authemail'))\n     else:\n-        raise CmdException, 'unknown sender details'\n+        return '%s <%s>' % (authname, authemail)\n \n def __parse_addresses(addresses):\n     \"\"\"Return a two elements tuple: (from, [to])\n@@ -298,7 +293,7 @@ def __edit_message(msg):\n def __build_cover(tmpl, total_nr, msg_id, options):\n     \"\"\"Build the cover message (series description) to be sent via SMTP\n     \"\"\"\n-    sender = __get_sender()\n+    sender = __get_sender(authname, authemail)\n \n     if options.version:\n         version_str = ' %s' % options.version\n@@ -372,7 +367,7 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):\n     commname = p.get_commname();\n     commemail = p.get_commemail();\n \n-    sender = __get_sender()\n+    sender = __get_sender(authname, authemail)\n \n     fromauth = '%s <%s>' % (authname, authemail)\n     if fromauth != sender:\n"},{"id":"294536","messageId":"b0943d9e0611290829h291942d7x13247511d16afeee@mail.gmail.com","threadId":"43163","inReplyTo":"20061129035930.6118.88435.stgit@dv.roinet.com","subject":"Re: [PATCH 2/2] Don't require config file for \"stg mail\"","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-29T16:29:32Z","receivedAt":"2006-11-29T16:29:32Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 29/11/06, Pavel Roskin <proski@gnu.org> wrote:\n> When calculating the string to be used in the From: field, don't require\n> it to come from the configuration file.  Instead, reuse already known\n> authname and authemail values as the default.  They can be taken from\n> the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables.\n\nYour patch uses the author of the patch which can be different from\nthe person sending the e-mail. It could indeed use the author from GIT\nvariables or configuration (not the patch author) and I already have a\npatch from Karl Hasselström for this (which I haven't found the time\nto check properly).\n\nThe reason I added a sender option is because the sender (that gets\nadded to the e-mail headers) may differ from the author of the patch.\nI use one e-mail address as the author but I might be behind an SMTP\nserver which only allows a different e-mail address and therefore I\nset the sender accordingly.\n\nOnce I merge Karl's patch, I'll modify StGIT to use the GIT defaults\nif there is no sender configured.\n\n-- \n"},{"id":"293952","messageId":"1164842841.23643.28.camel@dv","threadId":"43163","inReplyTo":"b0943d9e0611290829h291942d7x13247511d16afeee@mail.gmail.com","subject":"Re: [PATCH 2/2] Don't require config file for \"stg mail\"","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2006-11-29T23:27:21Z","receivedAt":"2006-11-29T23:27:21Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello, Catalin!\n\nOn Wed, 2006-11-29 at 16:29 +0000, Catalin Marinas wrote:\n> On 29/11/06, Pavel Roskin <proski@gnu.org> wrote:\n> > When calculating the string to be used in the From: field, don't require\n> > it to come from the configuration file.  Instead, reuse already known\n> > authname and authemail values as the default.  They can be taken from\n> > the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables.\n> \n> Your patch uses the author of the patch which can be different from\n> the person sending the e-mail. It could indeed use the author from GIT\n> variables or configuration (not the patch author) and I already have a\n> patch from Karl Hasselström for this (which I haven't found the time\n> to check properly).\n\nThe funny thing it, GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are only used\nin the code to determine the author of the patch.\n\nApparently, things are more twisted than I expected, so they need some\nuntangling first.\n\n> Once I merge Karl's patch, I'll modify StGIT to use the GIT defaults\n> if there is no sender configured.\n\nSounds good.\n\n-- \nRegards,\nPavel Roskin\n\n"},{"id":"296289","messageId":"b0943d9e0611300032r38f2b03ai463494930cf63a8a@mail.gmail.com","threadId":"43163","inReplyTo":"1164842841.23643.28.camel@dv","subject":"Re: [PATCH 2/2] Don't require config file for \"stg mail\"","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-30T08:32:08Z","receivedAt":"2006-11-30T08:32:08Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 29/11/06, Pavel Roskin <proski@gnu.org> wrote:\n> On Wed, 2006-11-29 at 16:29 +0000, Catalin Marinas wrote:\n> > Your patch uses the author of the patch which can be different from\n> > the person sending the e-mail. It could indeed use the author from GIT\n> > variables or configuration (not the patch author) and I already have a\n> > patch from Karl Hasselström for this (which I haven't found the time\n> > to check properly).\n>\n> The funny thing it, GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are only used\n> in the code to determine the author of the patch.\n\nYes, but only for a newly created patch. If you import a patch from an\nmbox or e-mail or simply pass the --author option to \"new\", the author\nwill be different.\n\n-- \n"}]}