{"thread":{"id":"1933","subject":"[PATCH] Fix earlier \"import quilt patches\" patch","startedAt":"2005-09-24T10:46:23Z","lastAt":"2005-09-24T19:47:55Z","messageCount":2,"participants":["Paolo 'Blaisorblade' Giarrusso","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9224","messageId":"20050924104622.17274.18611.stgit@zion.home.lan","threadId":"1933","inReplyTo":null,"subject":"[PATCH] Fix earlier \"import quilt patches\" patch","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-09-24T10:46:23Z","receivedAt":"2005-09-24T10:46:23Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n\nI forgot to update all cases - I updated __parse_mail, not __parse_patch, so\nrefactor together this duplication and use the fixed version.\n\nBtw, I don't like those regexps - they'd match in the middle of line too. What\nabout adding ^ to their beginning like for the \"^Index: \" regexp?\n\nSigned-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n---\n\n stgit/commands/imprt.py |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py\n--- a/stgit/commands/imprt.py\n+++ b/stgit/commands/imprt.py\n@@ -75,6 +75,10 @@ options = [make_option('-m', '--mail',\n                        help = 'use COMMEMAIL as the committer e-mail')]\n \n \n+def __end_descr(line):\n+    return re.match('---\\s*$', line) or re.match('diff -', line) or \\\n+            re.match('^Index: ', line)\n+    \n def __parse_mail(filename = None):\n     \"\"\"Parse the input file in a mail format and return (description,\n     authname, authemail, authdate)\n@@ -116,8 +120,7 @@ def __parse_mail(filename = None):\n         line = f.readline()\n         if not line:\n             break\n-        if re.match('---\\s*$', line) or re.match('diff -', line) or \\\n-                re.match('^Index: ', line):\n+        if __end_descr(line):\n             break\n         else:\n             descr += line\n@@ -150,7 +153,7 @@ def __parse_patch(filename = None):\n             auth = re.findall('^.*?:\\s+(.*)$', line)[0]\n             authname, authemail = name_email(auth)\n \n-        if re.match('---\\s*$', line) or re.match('diff -', line):\n+        if __end_descr(line):\n             break\n         else:\n             descr += line\n"},{"id":"9237","messageId":"b0943d9e0509241247b2a5c75@mail.gmail.com","threadId":"1933","inReplyTo":"20050924104622.17274.18611.stgit@zion.home.lan","subject":"Re: [PATCH] Fix earlier \"import quilt patches\" patch","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-09-24T19:47:55Z","receivedAt":"2005-09-24T19:47:55Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 24/09/05, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> wrote:\n> I forgot to update all cases - I updated __parse_mail, not __parse_patch, so\n> refactor together this duplication and use the fixed version.\n\nThanks. I'll apply it tomorrow.\n\n> Btw, I don't like those regexps - they'd match in the middle of line too. What\n> about adding ^ to their beginning like for the \"^Index: \" regexp?\n\nPython's re.match() only matches from the beginning of the line, so ^\nis not needed.\n\nCatalin\n\n--\nCatalin\n"}]}