From 70e43a87c226ecbbfac5e9f8fe715ca758bceaf2 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Fri, 17 Dec 2010 23:23:39 +0100 Subject: [PATCH] - added testcases for #658664 ("osc: a package internal error occured") - a file was marked as 'A' but the file didn't exist in the wc: - if it's part of the commit abort - otherwise ignore it --- .../osctest/added_missing/.osc/_apiurl | 1 + .../osctest/added_missing/.osc/_files | 3 ++ .../added_missing/.osc/_osclib_version | 1 + .../osctest/added_missing/.osc/_package | 1 + .../osctest/added_missing/.osc/_project | 1 + .../osctest/added_missing/.osc/_to_be_added | 2 ++ .../commit_fixtures/osctest/added_missing/bar | 1 + .../testAddedMissing_cfilesremote | 4 +++ .../testAddedMissing_filesremote | 3 ++ .../testAddedMissing_lfilelist | 1 + .../testAddedMissing_missingfilelist | 3 ++ tests/test_commit.py | 28 +++++++++++++++++++ 12 files changed, 49 insertions(+) create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_apiurl create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_files create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_osclib_version create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_package create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_project create mode 100644 tests/commit_fixtures/osctest/added_missing/.osc/_to_be_added create mode 100644 tests/commit_fixtures/osctest/added_missing/bar create mode 100644 tests/commit_fixtures/testAddedMissing_cfilesremote create mode 100644 tests/commit_fixtures/testAddedMissing_filesremote create mode 100644 tests/commit_fixtures/testAddedMissing_lfilelist create mode 100644 tests/commit_fixtures/testAddedMissing_missingfilelist diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_apiurl b/tests/commit_fixtures/osctest/added_missing/.osc/_apiurl new file mode 100644 index 00000000..0afeace7 --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_apiurl @@ -0,0 +1 @@ +http://localhost diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_files b/tests/commit_fixtures/osctest/added_missing/.osc/_files new file mode 100644 index 00000000..d474ef3b --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_files @@ -0,0 +1,3 @@ + + + diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_osclib_version b/tests/commit_fixtures/osctest/added_missing/.osc/_osclib_version new file mode 100644 index 00000000..d3827e75 --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_osclib_version @@ -0,0 +1 @@ +1.0 diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_package b/tests/commit_fixtures/osctest/added_missing/.osc/_package new file mode 100644 index 00000000..db0af96e --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_package @@ -0,0 +1 @@ +added_missing diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_project b/tests/commit_fixtures/osctest/added_missing/.osc/_project new file mode 100644 index 00000000..cea3bc84 --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_project @@ -0,0 +1 @@ +osctest \ No newline at end of file diff --git a/tests/commit_fixtures/osctest/added_missing/.osc/_to_be_added b/tests/commit_fixtures/osctest/added_missing/.osc/_to_be_added new file mode 100644 index 00000000..b03d55dc --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/.osc/_to_be_added @@ -0,0 +1,2 @@ +add +bar diff --git a/tests/commit_fixtures/osctest/added_missing/bar b/tests/commit_fixtures/osctest/added_missing/bar new file mode 100644 index 00000000..323fae03 --- /dev/null +++ b/tests/commit_fixtures/osctest/added_missing/bar @@ -0,0 +1 @@ +foobar diff --git a/tests/commit_fixtures/testAddedMissing_cfilesremote b/tests/commit_fixtures/testAddedMissing_cfilesremote new file mode 100644 index 00000000..a9c946e7 --- /dev/null +++ b/tests/commit_fixtures/testAddedMissing_cfilesremote @@ -0,0 +1,4 @@ + + + + diff --git a/tests/commit_fixtures/testAddedMissing_filesremote b/tests/commit_fixtures/testAddedMissing_filesremote new file mode 100644 index 00000000..03c7d890 --- /dev/null +++ b/tests/commit_fixtures/testAddedMissing_filesremote @@ -0,0 +1,3 @@ + + + diff --git a/tests/commit_fixtures/testAddedMissing_lfilelist b/tests/commit_fixtures/testAddedMissing_lfilelist new file mode 100644 index 00000000..c846f129 --- /dev/null +++ b/tests/commit_fixtures/testAddedMissing_lfilelist @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/commit_fixtures/testAddedMissing_missingfilelist b/tests/commit_fixtures/testAddedMissing_missingfilelist new file mode 100644 index 00000000..7070186c --- /dev/null +++ b/tests/commit_fixtures/testAddedMissing_missingfilelist @@ -0,0 +1,3 @@ + + + diff --git a/tests/test_commit.py b/tests/test_commit.py index f60221da..109ce55b 100644 --- a/tests/test_commit.py +++ b/tests/test_commit.py @@ -233,6 +233,34 @@ class TestCommit(OscTestCase): self._check_digests('testExpand_expandedfilesremote') self._check_status(p, 'simple', ' ') + @GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote') + def test_added_missing(self): + """commit an added file which is missing""" + self._change_to_pkg('added_missing') + p = osc.core.Package('.') + ret = p.commit() + self.assertTrue(ret == 1) + exp = 'file \'add\' is marked as \'A\' but does not exist\n' + self.assertEqual(sys.stdout.getvalue(), exp) + self._check_status(p, 'add', '!') + + @GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote') + @POST('http://localhost/source/osctest/added_missing?comment=&cmd=commitfilelist&user=Admin', + file='testAddedMissing_missingfilelist', expfile='testAddedMissing_lfilelist') + @PUT('http://localhost/source/osctest/added_missing/bar?rev=repository', exp='foobar\n', text=rev_dummy) + @POST('http://localhost/source/osctest/added_missing?comment=&cmd=commitfilelist&user=Admin', + file='testAddedMissing_cfilesremote', expfile='testAddedMissing_lfilelist') + def test_added_missing2(self): + """commit an added file, another added file missing (but it's not part of the commit)""" + self._change_to_pkg('added_missing') + p = osc.core.Package('.') + p.todo = ['bar'] + p.commit() + exp = 'Sending bar\nTransmitting file data .\nCommitted revision 2.\n' + self.assertEqual(sys.stdout.getvalue(), exp) + self._check_status(p, 'add', '!') + self._check_status(p, 'bar', ' ') + if __name__ == '__main__': import unittest unittest.main()