Пример #1
0
 def test_write_shelf(self):
     tree = self.make_branch_and_tree('tree')
     self.build_tree(['tree/foo'])
     tree.add('foo', 'foo-id')
     tree.lock_tree_write()
     self.addCleanup(tree.unlock)
     creator = shelf.ShelfCreator(tree, tree.basis_tree())
     self.addCleanup(creator.finalize)
     list(creator.iter_shelvable())
     creator.shelve_creation('foo-id')
     shelf_file = open('shelf', 'wb')
     try:
         creator.write_shelf(shelf_file)
     finally:
         shelf_file.close()
     parser = pack.ContainerPushParser()
     shelf_file = open('shelf', 'rb')
     try:
         parser.accept_bytes(shelf_file.read())
     finally:
         shelf_file.close()
     tt = transform.TransformPreview(tree)
     self.addCleanup(tt.finalize)
     records = iter(parser.read_pending_records())
     #skip revision-id
     records.next()
     tt.deserialize(records)
Пример #2
0
 def __init__(self, byte_stream, record_counter):
     """Create a _ByteStreamDecoder."""
     self.stream_decoder = pack.ContainerPushParser()
     self.current_type = None
     self.first_bytes = None
     self.byte_stream = byte_stream
     self._record_counter = record_counter
     self.key_count = 0
Пример #3
0
 def test_construct(self):
     """ContainerPushParser can be constructed."""
     pack.ContainerPushParser()
Пример #4
0
 def make_parser_expecting_bytes_record(self):
     parser = pack.ContainerPushParser()
     parser.accept_bytes("Bazaar pack format 1 (introduced in 0.18)\nB")
     return parser