{"thread":{"id":"43631","subject":"[StGIT PATCH 2/2] Regression test for \"stg mail\"","startedAt":"2006-11-08T10:12:43Z","lastAt":"2006-11-12T21:15:57Z","messageCount":4,"participants":["Karl Hasselström","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"297756","messageId":"b0943d9e0611080212q35dae8d0w2642ed1d0189f8fe@mail.gmail.com","threadId":"43631","inReplyTo":"20061108100103.GA18117@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Add a MIME-Version header to e-mails","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-08T10:12:43Z","receivedAt":"2006-11-08T10:12:43Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 08/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> On 2006-11-08 09:41:33 +0000, Catalin Marinas wrote:\n> > It would be great if you can run a test script. I've been thinking\n> > more of an \"import\" test that also checks both the \"export\" and \"mail\"\n> > commands.\n>\n> I didn't originally plan to thest the actual e-mail sending, but now\n> that I think of it, a simple script listening on a random port,\n> pretending to be an SMTP daemon, should be quite simple to set up.\n\nI'm not sure it's worth the hassle. You could just generate an mbox\nfile with \"mail\" and import it with \"import --mbox\" (it will hopefully\nbe ready this week). Problems with SMTP would be noticed quickly\nanyway.\n\n-- \n"},{"id":"296327","messageId":"20061112211434.19362.66077.stgit@localhost","threadId":"43631","inReplyTo":"b0943d9e0611080212q35dae8d0w2642ed1d0189f8fe@mail.gmail.com","subject":"[StGIT PATCH 0/2] mail and import tests","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-12T21:14:34Z","receivedAt":"2006-11-12T21:14:34Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Tests for \"stg import\" and \"stg mail\". The later test is not very\nambitious, but it can always be extended later.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"296229","messageId":"20061112211551.19362.91978.stgit@localhost","threadId":"43631","inReplyTo":"20061112211434.19362.66077.stgit@localhost","subject":"[StGIT PATCH 1/2] Regression test for \"stg import\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-12T21:15:51Z","receivedAt":"2006-11-12T21:15:51Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\n\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\n t/t1800-import.sh         |   85 ++++++++++++++++++++++++++++++++++++++\n t/t1800-import/email-8bit |   37 ++++++++++++++++\n t/t1800-import/email-mbox |  102 +++++++++++++++++++++++++++++++++++++++++++++\n t/t1800-import/email-qp   |   37 ++++++++++++++++\n t/t1800-import/git-diff   |   20 +++++++++\n t/t1800-import/gnu-diff   |   19 ++++++++\n t/t1800-import/stg-export |   26 +++++++++++\n 7 files changed, 326 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1800-import.sh b/t/t1800-import.sh\nnew file mode 100755\nindex 0000000..0c1baa3\n--- /dev/null\n+++ b/t/t1800-import.sh\n@@ -0,0 +1,85 @@\n+#!/bin/sh\n+# Copyright (c) 2006 Karl Hasselström\n+test_description='Test the import command'\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'Initialize the StGIT repository' \\\n+    '\n+    for x in {do,di,da}{be,bi,bo}{dam,dim,dum}; do\n+      echo $x\n+    done > foo.txt &&\n+    git add foo.txt &&\n+    git commit -a -m \"initial version\" &&\n+    stg init\n+    '\n+\n+test_expect_success \\\n+    'Apply a patch created with \"git diff\"' \\\n+    '\n+    stg import ../t1800-import/git-diff &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"tree e96b1fba2160890ff600b675d7140d46b022b155\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_expect_success \\\n+    'Apply a patch created with GNU diff' \\\n+    '\n+    stg import ../t1800-import/gnu-diff &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"tree e96b1fba2160890ff600b675d7140d46b022b155\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_expect_success \\\n+    'Apply a patch created with \"stg export\"' \\\n+    '\n+    stg import ../t1800-import/stg-export &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"tree e96b1fba2160890ff600b675d7140d46b022b155\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_expect_success \\\n+    'Apply a patch from an 8bit-encoded e-mail' \\\n+    '\n+    stg import -m ../t1800-import/email-8bit &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"tree 030be42660323ff2a1958f9ee79589a4f3fbee2f\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"author Inge Ström <inge@power.com>\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_expect_success \\\n+    'Apply a patch from a QP-encoded e-mail' \\\n+    '\n+    stg import -m ../t1800-import/email-qp &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"tree 030be42660323ff2a1958f9ee79589a4f3fbee2f\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id) \\\n+        | grep -c \"author Inge Ström <inge@power.com>\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_expect_success \\\n+    'Apply several patches from an mbox file' \\\n+    '\n+    stg import -M ../t1800-import/email-mbox &&\n+    [ $(git cat-file -p $(stg id change-1) \\\n+        | grep -c \"tree 401bef82cd9fb403aba18f480a63844416a2e023\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id change-1) \\\n+        | grep -c \"author Inge Ström <inge@power.com>\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id change-2) \\\n+        | grep -c \"tree e49dbce010ec7f441015a8c64bce0b99108af4cc\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id change-2) \\\n+        | grep -c \"author Inge Ström <inge@power.com>\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id change-3) \\\n+        | grep -c \"tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5\") == 1 ] &&\n+    [ $(git cat-file -p $(stg id change-3) \\\n+        | grep -c \"author Inge Ström <inge@power.com>\") == 1 ] &&\n+    stg delete ..\n+    '\n+\n+test_done\ndiff --git a/t/t1800-import/email-8bit b/t/t1800-import/email-8bit\nnew file mode 100644\nindex 0000000..316fe27\n--- /dev/null\n+++ b/t/t1800-import/email-8bit\n@@ -0,0 +1,37 @@\n+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>\n+Subject: [PATCH] test patch\n+To: Upstream <foo@bar.baz>\n+Date: Sat, 11 Nov 2006 11:58:14 +0100\n+Message-ID: <20061111105814.23209.46952.stgit@localhost>\n+User-Agent: StGIT/0.11\n+MIME-Version: 1.0\n+Content-Type: text/plain; charset=\"utf-8\"\n+Content-Transfer-Encoding: 8bit\n+\n+Signed-off-by: Inge Ström <inge@power.com>\n+---\n+\n+ foo.txt |    2 ++\n+ 1 files changed, 2 insertions(+), 0 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index ad01662..d3cd5b6 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -3,6 +3,7 @@ dobedim\n+ dobedum\n+ dobidam\n+ dobidim\n++pum-pöddelipåm\n+ dobidum\n+ dobodam\n+ dobodim\n+@@ -20,6 +21,7 @@ dabedam\n+ dabedim\n+ dabedum\n+ dabidam\n++pum-däddelidum\n+ dabidim\n+ dabidum\n+ dabodam\n+\ndiff --git a/t/t1800-import/email-mbox b/t/t1800-import/email-mbox\nnew file mode 100644\nindex 0000000..e4103e5\n--- /dev/null\n+++ b/t/t1800-import/email-mbox\n@@ -0,0 +1,102 @@\n+From nobody Sat Nov 11 12:45:27 2006\n+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>\n+Subject: [PATCH 1/3] Change 1\n+To: Upstream <foo@bar.baz>\n+Date: Sat, 11 Nov 2006 12:45:27 +0100\n+Message-ID: <20061111114527.31778.12942.stgit@localhost>\n+User-Agent: StGIT/0.11\n+MIME-Version: 1.0\n+Content-Type: text/plain; charset=\"utf-8\"\n+Content-Transfer-Encoding: 8bit\n+Status: RO\n+Content-Length: 304\n+Lines: 19\n+\n+Signed-off-by: Inge Ström <inge@power.com>\n+---\n+\n+ foo.txt |    2 +-\n+ 1 files changed, 1 insertions(+), 1 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index ad01662..91527b1 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -7,7 +7,7 @@ dobidum\n+ dobodam\n+ dobodim\n+ dobodum\n+-dibedam\n++dibedad\n+ dibedim\n+ dibedum\n+ dibidam\n+\n+From nobody Sat Nov 11 12:45:27 2006\n+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>\n+Subject: [PATCH 2/3] Change 2\n+To: Upstream <foo@bar.baz>\n+Date: Sat, 11 Nov 2006 12:45:27 +0100\n+Message-ID: <20061111114527.31778.92851.stgit@localhost>\n+In-Reply-To: <20061111114527.31778.12942.stgit@localhost>\n+References: <20061111114527.31778.12942.stgit@localhost>\n+User-Agent: StGIT/0.11\n+MIME-Version: 1.0\n+Content-Type: text/plain; charset=\"utf-8\"\n+Content-Transfer-Encoding: 8bit\n+Status: RO\n+Content-Length: 296\n+Lines: 18\n+\n+Signed-off-by: Inge Ström <inge@power.com>\n+---\n+\n+ foo.txt |    1 +\n+ 1 files changed, 1 insertions(+), 0 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index 91527b1..79922d7 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -18,6 +18,7 @@ dibodim\n+ dibodum\n+ dabedam\n+ dabedim\n++dibedam\n+ dabedum\n+ dabidam\n+ dabidim\n+\n+From nobody Sat Nov 11 12:45:27 2006\n+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>\n+Subject: [PATCH 3/3] Change 3\n+To: Upstream <foo@bar.baz>\n+Date: Sat, 11 Nov 2006 12:45:27 +0100\n+Message-ID: <20061111114527.31778.45876.stgit@localhost>\n+In-Reply-To: <20061111114527.31778.12942.stgit@localhost>\n+References: <20061111114527.31778.12942.stgit@localhost>\n+User-Agent: StGIT/0.11\n+MIME-Version: 1.0\n+Content-Type: text/plain; charset=\"utf-8\"\n+Content-Transfer-Encoding: 8bit\n+Status: RO\n+Content-Length: 278\n+Lines: 16\n+\n+Signed-off-by: Inge Ström <inge@power.com>\n+---\n+\n+ foo.txt |    1 -\n+ 1 files changed, 0 insertions(+), 1 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index 79922d7..6f978b4 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -24,5 +24,4 @@ dabidam\n+ dabidim\n+ dabidum\n+ dabodam\n+-dabodim\n+ dabodum\n+\ndiff --git a/t/t1800-import/email-qp b/t/t1800-import/email-qp\nnew file mode 100644\nindex 0000000..1a77c57\n--- /dev/null\n+++ b/t/t1800-import/email-qp\n@@ -0,0 +1,37 @@\n+From: Inge =?utf-8?q?Str=C3=B6m?= <inge@power.com>\n+Subject: [PATCH] test patch\n+To: Upstream <foo@bar.baz>\n+Date: Sat, 11 Nov 2006 11:58:14 +0100\n+Message-ID: <20061111105814.23209.46952.stgit@localhost>\n+User-Agent: StGIT/0.11\n+MIME-Version: 1.0\n+Content-Type: text/plain; charset=\"utf-8\"\n+Content-Transfer-Encoding: quoted-printable\n+\n+Signed-off-by: Inge Str=C3=B6m <inge@power.com>\n+---\n+\n+ foo.txt |    2 ++\n+ 1 files changed, 2 insertions(+), 0 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index ad01662..d3cd5b6 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -3,6 +3,7 @@ dobedim\n+ dobedum\n+ dobidam\n+ dobidim\n++pum-p=C3=B6ddelip=C3=A5m\n+ dobidum\n+ dobodam\n+ dobodim\n+@@ -20,6 +21,7 @@ dabedam\n+ dabedim\n+ dabedum\n+ dabidam\n++pum-d=C3=A4ddelidum\n+ dabidim\n+ dabidum\n+ dabodam\n+\ndiff --git a/t/t1800-import/git-diff b/t/t1800-import/git-diff\nnew file mode 100644\nindex 0000000..642e11d\n--- /dev/null\n+++ b/t/t1800-import/git-diff\n@@ -0,0 +1,20 @@\n+diff --git a/foo.txt b/foo.txt\n+index ad01662..d3cd5b6 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -3,6 +3,7 @@ dobedim\n+ dobedum\n+ dobidam\n+ dobidim\n++dabadadash\n+ dobidum\n+ dobodam\n+ dobodim\n+@@ -20,6 +21,7 @@ dabedam\n+ dabedim\n+ dabedum\n+ dabidam\n++dadadadash\n+ dabidim\n+ dabidum\n+ dabodam\ndiff --git a/t/t1800-import/gnu-diff b/t/t1800-import/gnu-diff\nnew file mode 100644\nindex 0000000..46b338a\n--- /dev/null\n+++ b/t/t1800-import/gnu-diff\n@@ -0,0 +1,19 @@\n+diff -Naur old/foo.txt new/foo.txt\n+--- old/foo.txt\t2006-11-11 11:26:18.000000000 +0100\n++++ new/foo.txt\t2006-11-11 11:25:18.000000000 +0100\n+@@ -3,6 +3,7 @@\n+ dobedum\n+ dobidam\n+ dobidim\n++dabadadash\n+ dobidum\n+ dobodam\n+ dobodim\n+@@ -20,6 +21,7 @@\n+ dabedim\n+ dabedum\n+ dabidam\n++dadadadash\n+ dabidim\n+ dabidum\n+ dabodam\ndiff --git a/t/t1800-import/stg-export b/t/t1800-import/stg-export\nnew file mode 100644\nindex 0000000..ddcfc3e\n--- /dev/null\n+++ b/t/t1800-import/stg-export\n@@ -0,0 +1,26 @@\n+test patch\n+---\n+\n+ foo.txt |    2 ++\n+ 1 files changed, 2 insertions(+), 0 deletions(-)\n+\n+diff --git a/foo.txt b/foo.txt\n+index ad01662..d3cd5b6 100644\n+--- a/foo.txt\n++++ b/foo.txt\n+@@ -3,6 +3,7 @@ dobedim\n+ dobedum\n+ dobidam\n+ dobidim\n++dabadadash\n+ dobidum\n+ dobodam\n+ dobodim\n+@@ -20,6 +21,7 @@ dabedam\n+ dabedim\n+ dabedum\n+ dabidam\n++dadadadash\n+ dabidim\n+ dabidum\n"},{"id":"296131","messageId":"20061112211556.19362.68287.stgit@localhost","threadId":"43631","inReplyTo":"20061112211434.19362.66077.stgit@localhost","subject":"[StGIT PATCH 2/2] Regression test for \"stg mail\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-12T21:15:57Z","receivedAt":"2006-11-12T21:15:57Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\n\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\n t/t1900-mail.sh |   34 ++++++++++++++++++++++++++++++++++\n 1 files changed, 34 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1900-mail.sh b/t/t1900-mail.sh\nnew file mode 100755\nindex 0000000..6a950b4\n--- /dev/null\n+++ b/t/t1900-mail.sh\n@@ -0,0 +1,34 @@\n+#!/bin/sh\n+# Copyright (c) 2006 Karl Hasselström\n+test_description='Test the mail command'\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'Initialize the StGIT repository' \\\n+    '\n+    for i in 1 2 3 4 5; do\n+      touch foo.txt &&\n+      echo \"line $i\" >> foo.txt &&\n+      git add foo.txt &&\n+      git commit -a -m \"Patch $i\"\n+    done &&\n+    stg init &&\n+    stg uncommit -n 5 foo\n+    '\n+\n+test_expect_success \\\n+    'Put all the patches in an mbox' \\\n+    'stg mail --to=\"Inge Ström <inge@example.com>\" -a -m \\\n+       -t ../../templates/patchmail.tmpl > mbox0'\n+\n+test_expect_success \\\n+    'Import the mbox and compare' \\\n+    '\n+    t1=$(git cat-file -p $(stg id) | grep ^tree)\n+    stg pop -a &&\n+    stg import -M mbox0 &&\n+    t2=$(git cat-file -p $(stg id) | grep ^tree) &&\n+    [ \"$t1\" == \"$t2\" ]\n+    '\n+\n"}]}