Rev 4465: (abentley) Fix #363444 by fixing pack parsing with 0-length records. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sat Jun 20 03:58:23 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4465
revision-id: pqm at pqm.ubuntu.com-20090620025819-9fkf33yr3dvtwh2o
parent: pqm at pqm.ubuntu.com-20090619110117-rhph89w2k9gavp24
parent: aaron at aaronbentley.com-20090620015318-wpmuuoef5y0jgjbr
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2009-06-20 03:58:19 +0100
message:
(abentley) Fix #363444 by fixing pack parsing with 0-length records.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/pack.py container.py-20070607160755-tr8zc26q18rn0jnb-1
bzrlib/tests/test_pack.py test_container.py-20070607160755-tr8zc26q18rn0jnb-2
------------------------------------------------------------
revno: 4464.1.2
revision-id: aaron at aaronbentley.com-20090620015318-wpmuuoef5y0jgjbr
parent: aaron at aaronbentley.com-20090620011738-ui5v1f48fluueiix
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: fix-shelf
timestamp: Fri 2009-06-19 21:53:18 -0400
message:
Update NEWS
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4464.1.1
revision-id: aaron at aaronbentley.com-20090620011738-ui5v1f48fluueiix
parent: pqm at pqm.ubuntu.com-20090619110117-rhph89w2k9gavp24
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: fix-shelf
timestamp: Fri 2009-06-19 21:17:38 -0400
message:
ContainerPushParser.accept_bytes handles zero-length records correctly.
modified:
bzrlib/pack.py container.py-20070607160755-tr8zc26q18rn0jnb-1
bzrlib/tests/test_pack.py test_container.py-20070607160755-tr8zc26q18rn0jnb-2
=== modified file 'NEWS'
--- a/NEWS 2009-06-19 09:06:56 +0000
+++ b/NEWS 2009-06-20 01:53:18 +0000
@@ -42,6 +42,9 @@
``BZR_PROGRESS_BAR`` is set to ``none``.
(Martin Pool, #339385)
+* Unshelve works correctly when multiple zero-length files are present on
+ the shelf. (Aaron Bentley, #363444)
+
Internals
*********
=== modified file 'bzrlib/pack.py'
--- a/bzrlib/pack.py 2009-04-04 02:50:01 +0000
+++ b/bzrlib/pack.py 2009-06-20 01:17:38 +0000
@@ -406,8 +406,11 @@
# the buffer.
last_buffer_length = None
cur_buffer_length = len(self._buffer)
- while cur_buffer_length != last_buffer_length:
+ last_state_handler = None
+ while (cur_buffer_length != last_buffer_length
+ or last_state_handler != self._state_handler):
last_buffer_length = cur_buffer_length
+ last_state_handler = self._state_handler
self._state_handler()
cur_buffer_length = len(self._buffer)
=== modified file 'bzrlib/tests/test_pack.py'
--- a/bzrlib/tests/test_pack.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_pack.py 2009-06-20 01:17:38 +0000
@@ -610,6 +610,19 @@
[([('name1',)], 'body1'), ([('name2',)], 'body2')],
parser.read_pending_records())
+ def test_multiple_empty_records_at_once(self):
+ """If multiple empty records worth of data are fed to the parser in one
+ string, the parser will correctly parse all the records.
+
+ (A naive implementation might stop after parsing the first empty
+ record, because the buffer size had not changed.)
+ """
+ parser = self.make_parser_expecting_record_type()
+ parser.accept_bytes("B0\nname1\n\nB0\nname2\n\n")
+ self.assertEqual(
+ [([('name1',)], ''), ([('name2',)], '')],
+ parser.read_pending_records())
+
class TestContainerPushParserBytesParsing(PushParserTestCase):
"""Tests for reading Bytes records with ContainerPushParser.
More information about the bazaar-commits
mailing list