diff --git a/osc/core.py b/osc/core.py index 5bc8baf9..739bc467 100644 --- a/osc/core.py +++ b/osc/core.py @@ -1616,7 +1616,7 @@ rev: %s # size_limit is only temporary for this update old_size_limit = self.size_limit if not size_limit is None: - self.size_limit = size_limit + self.size_limit = int(size_limit) if os.path.isfile(os.path.join(self.storedir, '_in_update', '_files')): print 'resuming broken update...' root = ET.parse(os.path.join(self.storedir, '_in_update', '_files')).getroot() @@ -2326,7 +2326,7 @@ def read_sizelimit(dir): fname = os.path.join(dir, store, '_size_limit') if os.path.exists(fname): - r = open(fname).readline() + r = open(fname).readline().strip() if r is None or not r.isdigit(): return None diff --git a/tests/test_update.py b/tests/test_update.py index a3ae2cb7..a529a6e8 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -140,6 +140,25 @@ class TestUpdate(OscTestCase): self.assertFalse(os.path.exists('bigfile')) self._check_digests('testUpdateLimitSizeNoChange_files', 'bigfile') + @GET('http://localhost/source/osctest/limitsize_local?rev=latest', file='testUpdateLocalLimitSizeNoChange_filesremote') + @GET('http://localhost/source/osctest/limitsize_local/_meta', file='meta.xml') + def testUpdateLocalLimitSizeNoChange(self): + """ + a new file was added to the remote package but isn't checked out because + of the local size constraint + """ + self._change_to_pkg('limitsize_local') + p = osc.core.Package('.') + p.update() + exp = 'D bigfile\nD merge\nAt revision 2.\n' + self.assertEqual(sys.stdout.getvalue(), exp) + self.assertFalse(os.path.exists(os.path.join('.osc', 'bigfile'))) + self.assertFalse(os.path.exists(os.path.join('.osc', 'merge'))) + self.assertFalse(os.path.exists('bigfile')) + self._check_digests('testUpdateLocalLimitSizeNoChange_files', 'bigfile', 'merge') + self._check_status(p, 'bigfile', 'S') + self._check_status(p, 'merge', 'S') + @GET('http://localhost/source/osctest/limitsize?rev=latest', file='testUpdateLimitSizeAddDelete_filesremote') @GET('http://localhost/source/osctest/limitsize/exists?rev=2', file='testUpdateLimitSizeAddDelete_exists') @GET('http://localhost/source/osctest/limitsize/_meta', file='meta.xml') diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_apiurl b/tests/update_fixtures/osctest/limitsize_local/.osc/_apiurl new file mode 100644 index 00000000..0afeace7 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_apiurl @@ -0,0 +1 @@ +http://localhost diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_files b/tests/update_fixtures/osctest/limitsize_local/.osc/_files new file mode 100644 index 00000000..77d67af6 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_files @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_osclib_version b/tests/update_fixtures/osctest/limitsize_local/.osc/_osclib_version new file mode 100644 index 00000000..d3827e75 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_osclib_version @@ -0,0 +1 @@ +1.0 diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_package b/tests/update_fixtures/osctest/limitsize_local/.osc/_package new file mode 100644 index 00000000..64a5ed37 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_package @@ -0,0 +1 @@ +limitsize_local diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_project b/tests/update_fixtures/osctest/limitsize_local/.osc/_project new file mode 100644 index 00000000..cea3bc84 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_project @@ -0,0 +1 @@ +osctest \ No newline at end of file diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/_size_limit b/tests/update_fixtures/osctest/limitsize_local/.osc/_size_limit new file mode 100644 index 00000000..64bb6b74 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/_size_limit @@ -0,0 +1 @@ +30 diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/foo b/tests/update_fixtures/osctest/limitsize_local/.osc/foo new file mode 100644 index 00000000..3bb34cf8 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/foo @@ -0,0 +1 @@ +This is a simple test. diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/merge b/tests/update_fixtures/osctest/limitsize_local/.osc/merge new file mode 100644 index 00000000..0b4685d5 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/merge @@ -0,0 +1,4 @@ +Is it +possible to +merge this file? +I hope so... diff --git a/tests/update_fixtures/osctest/limitsize_local/.osc/nochange b/tests/update_fixtures/osctest/limitsize_local/.osc/nochange new file mode 100644 index 00000000..0569b03f --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/.osc/nochange @@ -0,0 +1 @@ +This file didn't change. diff --git a/tests/update_fixtures/osctest/limitsize_local/foo b/tests/update_fixtures/osctest/limitsize_local/foo new file mode 100644 index 00000000..3bb34cf8 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/foo @@ -0,0 +1 @@ +This is a simple test. diff --git a/tests/update_fixtures/osctest/limitsize_local/merge b/tests/update_fixtures/osctest/limitsize_local/merge new file mode 100644 index 00000000..0b4685d5 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/merge @@ -0,0 +1,4 @@ +Is it +possible to +merge this file? +I hope so... diff --git a/tests/update_fixtures/osctest/limitsize_local/nochange b/tests/update_fixtures/osctest/limitsize_local/nochange new file mode 100644 index 00000000..3a48a293 --- /dev/null +++ b/tests/update_fixtures/osctest/limitsize_local/nochange @@ -0,0 +1,2 @@ +This file didn't change but +is modified. diff --git a/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_files b/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_files new file mode 100644 index 00000000..f03a9b5a --- /dev/null +++ b/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_files @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_filesremote b/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_filesremote new file mode 100644 index 00000000..4ffd780d --- /dev/null +++ b/tests/update_fixtures/testUpdateLocalLimitSizeNoChange_filesremote @@ -0,0 +1,6 @@ + + + + + +