1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

- fixed read_sizelimit: added missing strip

- fix for commit 89c9cb67f4: self.size_limit should be an int
- added testcase for local _size_limit constraint
This commit is contained in:
Marcus Huewe 2010-09-03 16:09:56 +02:00
parent 89c9cb67f4
commit 5c8b258a6b
16 changed files with 56 additions and 2 deletions

View File

@ -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

View File

@ -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')

View File

@ -0,0 +1 @@
http://localhost

View File

@ -0,0 +1,5 @@
<directory name="limitsize" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
</directory>

View File

@ -0,0 +1 @@
1.0

View File

@ -0,0 +1 @@
limitsize_local

View File

@ -0,0 +1 @@
osctest

View File

@ -0,0 +1 @@
30

View File

@ -0,0 +1 @@
This is a simple test.

View File

@ -0,0 +1,4 @@
Is it
possible to
merge this file?
I hope so...

View File

@ -0,0 +1 @@
This file didn't change.

View File

@ -0,0 +1 @@
This is a simple test.

View File

@ -0,0 +1,4 @@
Is it
possible to
merge this file?
I hope so...

View File

@ -0,0 +1,2 @@
This file didn't change but
is modified.

View File

@ -0,0 +1,6 @@
<directory name="limitsize_local" rev="2" srcmd5="e51a3133d3d3eb2a48e06efb79e2d503" vrev="2">
<entry md5="ed955c917012307d982b7cdd5799ff1a" mtime="1282320398" name="bigfile" size="69" skipped="true" />
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282320303" name="foo" size="23" />
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282320303" name="merge" size="48" skipped="true" />
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
</directory>

View File

@ -0,0 +1,6 @@
<directory name="limitsize_local" rev="2" vrev="2" srcmd5="e51a3133d3d3eb2a48e06efb79e2d503">
<entry name="bigfile" md5="ed955c917012307d982b7cdd5799ff1a" size="69" mtime="1282320398" />
<entry name="foo" md5="0d62ceea6020d75154078a20d8c9f9ba" size="23" mtime="1282320303" />
<entry name="merge" md5="17b9e9e1a032ed44e7a584dc6303ffa8" size="48" mtime="1282320303" />
<entry name="nochange" md5="7efa70f68983fad1cf487f69dedf93e9" size="25" mtime="1282047303" />
</directory>