{"thread":{"id":"10952","subject":"[StGit PATCH] Added test case for stg refresh","startedAt":"2007-11-21T10:35:59Z","lastAt":"2007-11-22T08:38:26Z","messageCount":8,"participants":["David Kågedal","Karl Hasselström","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"60489","messageId":"87tznfvqb4.fsf@lysator.liu.se","threadId":"10952","inReplyTo":null,"subject":"[StGit PATCH] Added test case for stg refresh","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-11-21T10:35:59Z","receivedAt":"2007-11-21T10:35:59Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"Signed-off-by: David Kågedal <davidk@lysator.liu.se>\n---\n\nThis test case fails on the kha/experimental branch.  Using \"stg\nrefresh -p <patch>\" can cause all sorts of wieirdness, and there is no\ntest case for it.\n\n\n t/t2700-refresh.sh |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 65 insertions(+), 0 deletions(-)\n create mode 100755 t/t2700-refresh.sh\n\ndiff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh\nnew file mode 100755\nindex 0000000..2e7901c\n--- /dev/null\n+++ b/t/t2700-refresh.sh\n@@ -0,0 +1,65 @@\n+#!/bin/sh\n+\n+test_description='Run \"stg refresh\"'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'Initialize StGit stack' '\n+    stg init &&\n+    echo expected.txt >> .git/info/exclude &&\n+    echo patches.txt >> .git/info/exclude &&\n+    stg new p0 -m \"base\" &&\n+    for i in 1 2 3; do\n+        echo base >> foo$i.txt &&\n+        git add foo$i.txt\n+    done\n+    stg refresh &&\n+    for i in 1 2 3; do\n+        stg new p$i -m \"foo $i\" &&\n+        echo \"foo $i\" >> foo$i.txt &&\n+        stg refresh\n+    done\n+'\n+\n+cat > expected.txt <<EOF\n+p0\n+p3\n+EOF\n+test_expect_success 'Refresh top patch' '\n+    echo bar 3 >> foo3.txt &&\n+    stg refresh &&\n+    stg status &&\n+    test -z \"$(stg status)\" &&\n+    stg patches foo3.txt > patches.txt &&\n+    diff -u expected.txt patches.txt\n+'\n+\n+cat > expected.txt <<EOF\n+p0\n+p2\n+EOF\n+test_expect_success 'Refresh middle patch' '\n+    stg status &&\n+    echo bar 2 >> foo2.txt &&\n+    stg refresh -p p2 &&\n+    stg status &&\n+    test -z \"$(stg status)\" &&\n+    stg patches foo2.txt > patches.txt &&\n+    diff -u expected.txt patches.txt\n+'\n+\n+cat > expected.txt <<EOF\n+p0\n+p1\n+EOF\n+test_expect_success 'Refresh bottom patch' '\n+    stg status &&\n+    echo bar 1 >> foo1.txt &&\n+    stg refresh -p p1 &&\n+    stg status &&\n+    test -z \"$(stg status)\" &&\n+    stg patches foo1.txt > patches.txt &&\n+    diff -u expected.txt patches.txt\n+'\n+\n+test_done\n-- \n1.5.3.6.740.ge3d12\n\n\n-- \nDavid Kågedal\n"},{"id":"60491","messageId":"87oddnvpzf.fsf@virtutech.se","threadId":"10952","inReplyTo":"87tznfvqb4.fsf@lysator.liu.se","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"David Kågedal","fromEmail":"david@virtutech.se","sentAt":"2007-11-21T10:43:00Z","receivedAt":"2007-11-21T10:43:00Z","isPatch":true,"sender":{"key":"david@virtutech.se","avatar":null},"body":"David Kågedal <davidk@lysator.liu.se> writes:\n\n> Signed-off-by: David Kågedal <davidk@lysator.liu.se>\n> ---\n>\n> This test case fails on the kha/experimental branch.  Using \"stg\n> refresh -p <patch>\" can cause all sorts of wieirdness, and there is no\n> test case for it.\n\nI just checked, and it fails on kha/safe as well. So maybe there is\nsome problem with the test case, but I don't know what it is.\n\nAnd maybe it should be called t2301 instead?\n\n>  t/t2700-refresh.sh |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 files changed, 65 insertions(+), 0 deletions(-)\n>  create mode 100755 t/t2700-refresh.sh\n>\n> diff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh\n> new file mode 100755\n> index 0000000..2e7901c\n> --- /dev/null\n> +++ b/t/t2700-refresh.sh\n> @@ -0,0 +1,65 @@\n> +#!/bin/sh\n> +\n> +test_description='Run \"stg refresh\"'\n> +\n> +. ./test-lib.sh\n> +\n> +test_expect_success 'Initialize StGit stack' '\n> +    stg init &&\n> +    echo expected.txt >> .git/info/exclude &&\n> +    echo patches.txt >> .git/info/exclude &&\n> +    stg new p0 -m \"base\" &&\n> +    for i in 1 2 3; do\n> +        echo base >> foo$i.txt &&\n> +        git add foo$i.txt\n> +    done\n> +    stg refresh &&\n> +    for i in 1 2 3; do\n> +        stg new p$i -m \"foo $i\" &&\n> +        echo \"foo $i\" >> foo$i.txt &&\n> +        stg refresh\n> +    done\n> +'\n> +\n> +cat > expected.txt <<EOF\n> +p0\n> +p3\n> +EOF\n> +test_expect_success 'Refresh top patch' '\n> +    echo bar 3 >> foo3.txt &&\n> +    stg refresh &&\n> +    stg status &&\n> +    test -z \"$(stg status)\" &&\n> +    stg patches foo3.txt > patches.txt &&\n> +    diff -u expected.txt patches.txt\n> +'\n> +\n> +cat > expected.txt <<EOF\n> +p0\n> +p2\n> +EOF\n> +test_expect_success 'Refresh middle patch' '\n> +    stg status &&\n> +    echo bar 2 >> foo2.txt &&\n> +    stg refresh -p p2 &&\n> +    stg status &&\n> +    test -z \"$(stg status)\" &&\n> +    stg patches foo2.txt > patches.txt &&\n> +    diff -u expected.txt patches.txt\n> +'\n> +\n> +cat > expected.txt <<EOF\n> +p0\n> +p1\n> +EOF\n> +test_expect_success 'Refresh bottom patch' '\n> +    stg status &&\n> +    echo bar 1 >> foo1.txt &&\n> +    stg refresh -p p1 &&\n> +    stg status &&\n> +    test -z \"$(stg status)\" &&\n> +    stg patches foo1.txt > patches.txt &&\n> +    diff -u expected.txt patches.txt\n> +'\n> +\n> +test_done\n> -- \n> 1.5.3.6.740.ge3d12\n\n-- \nDavid Kågedal, Virtutech\n"},{"id":"60575","messageId":"20071121231553.GA19422@diana.vm.bytemark.co.uk","threadId":"10952","inReplyTo":"87oddnvpzf.fsf@virtutech.se","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-11-21T23:15:53Z","receivedAt":"2007-11-21T23:15:53Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-11-21 11:43:00 +0100, David Kågedal wrote:\n\n> David Kågedal <davidk@lysator.liu.se> writes:\n>\n> > This test case fails on the kha/experimental branch. Using \"stg\n> > refresh -p <patch>\" can cause all sorts of wieirdness, and there\n> > is no test case for it.\n>\n> I just checked, and it fails on kha/safe as well. So maybe there is\n> some problem with the test case, but I don't know what it is.\n\nThanks, more tests are always welcome. But it doesn't fail for me.\nI've just pushed out updated kha/safe and kha/experimental branches --\nwith this new test at the bottom of the stack -- and the whole test\nsuite passes at every step. Could you try the updated branches and see\nif you can still make it fail?\n\n> And maybe it should be called t2301 instead?\n\nThose numbers are just one big jumble anyway, so no need to bother.\n:-)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"60576","messageId":"b0943d9e0711211531v2f7b9c0bl99033c0bd58971c7@mail.gmail.com","threadId":"10952","inReplyTo":"20071121231553.GA19422@diana.vm.bytemark.co.uk","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-11-21T23:31:45Z","receivedAt":"2007-11-21T23:31:45Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 21/11/2007, Karl Hasselström <kha@treskal.com> wrote:\n> On 2007-11-21 11:43:00 +0100, David Kågedal wrote:\n>\n> > David Kågedal <davidk@lysator.liu.se> writes:\n> >\n> > > This test case fails on the kha/experimental branch. Using \"stg\n> > > refresh -p <patch>\" can cause all sorts of wieirdness, and there\n> > > is no test case for it.\n\nI noticed the weirdness few days ago and fixed it in\ne8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).\nDo you still see problems after this commit?\n\n-- \nCatalin\n"},{"id":"60578","messageId":"20071121235534.GA21008@diana.vm.bytemark.co.uk","threadId":"10952","inReplyTo":"b0943d9e0711211531v2f7b9c0bl99033c0bd58971c7@mail.gmail.com","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-11-21T23:55:34Z","receivedAt":"2007-11-21T23:55:34Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-11-21 23:31:45 +0000, Catalin Marinas wrote:\n\n> I noticed the weirdness few days ago and fixed it in\n> e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).\n> Do you still see problems after this commit?\n\nConfirmed: the test fails before e8813959, and succeeds afterwards.\n\n(You can pull the test from\n\n  git://repo.or.cz/stgit/kha.git safe\n\nif you like.)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"60611","messageId":"871waivhgq.fsf@virtutech.se","threadId":"10952","inReplyTo":"b0943d9e0711211531v2f7b9c0bl99033c0bd58971c7@mail.gmail.com","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-11-22T07:59:17Z","receivedAt":"2007-11-22T07:59:17Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"\"Catalin Marinas\" <catalin.marinas@gmail.com> writes:\n\n> On 21/11/2007, Karl Hasselström <kha@treskal.com> wrote:\n>> On 2007-11-21 11:43:00 +0100, David Kågedal wrote:\n>>\n>> > David Kågedal <davidk@lysator.liu.se> writes:\n>> >\n>> > > This test case fails on the kha/experimental branch. Using \"stg\n>> > > refresh -p <patch>\" can cause all sorts of wieirdness, and there\n>> > > is no test case for it.\n>\n> I noticed the weirdness few days ago and fixed it in\n> e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).\n> Do you still see problems after this commit?\n\nThe problem I see is that there still is no test case. That is bad and\nmeans that it could break again tomorrow without anyone noticing.\n\nLuckily, I just wrote one for you :-)\n\n-- \nDavid Kågedal\n"},{"id":"60612","messageId":"b0943d9e0711220015r64d1a5c2y25dfa44610864c99@mail.gmail.com","threadId":"10952","inReplyTo":"871waivhgq.fsf@virtutech.se","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-11-22T08:15:57Z","receivedAt":"2007-11-22T08:15:57Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 22/11/2007, David Kågedal <davidk@lysator.liu.se> wrote:\n> \"Catalin Marinas\" <catalin.marinas@gmail.com> writes:\n> > I noticed the weirdness few days ago and fixed it in\n> > e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).\n> > Do you still see problems after this commit?\n>\n> The problem I see is that there still is no test case. That is bad and\n> means that it could break again tomorrow without anyone noticing.\n>\n> Luckily, I just wrote one for you :-)\n\nThanks :-). We are still far from testing all the possible\ncombinations. Is there a way to do code coverage in Python?\n\n-- \nCatalin\n"},{"id":"60619","messageId":"87pry2u131.fsf@lysator.liu.se","threadId":"10952","inReplyTo":"b0943d9e0711220015r64d1a5c2y25dfa44610864c99@mail.gmail.com","subject":"Re: [StGit PATCH] Added test case for stg refresh","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-11-22T08:38:26Z","receivedAt":"2007-11-22T08:38:26Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"\"Catalin Marinas\" <catalin.marinas@gmail.com> writes:\n\n> On 22/11/2007, David Kågedal <davidk@lysator.liu.se> wrote:\n>> \"Catalin Marinas\" <catalin.marinas@gmail.com> writes:\n>> > I noticed the weirdness few days ago and fixed it in\n>> > e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).\n>> > Do you still see problems after this commit?\n>>\n>> The problem I see is that there still is no test case. That is bad and\n>> means that it could break again tomorrow without anyone noticing.\n>>\n>> Luckily, I just wrote one for you :-)\n>\n> Thanks :-). We are still far from testing all the possible\n> combinations. Is there a way to do code coverage in Python?\n\nBeing far from testing everything doesn't mean that you can't start\nadding tests for the things you know have a tendency to break. And for\nthe things that you are going to refactor. And as regression tests\nwhen you fix a bug. A test suite can be built up by adding small parts\nat a time.\n\nBut no, I don't know of any useful code coverage tool for python, but\nI haven't really looked.\n\n-- \nDavid Kågedal\n"}]}