comparison mercurial/testing/storage.py @ 40323:2c0aa02ecd5a

testing: switch to inserting deltas As the comment in the test specifies, this was relying on storage backend implementation details. We switch to inserting a raw delta, skipping the regular insert path to ensure we have the desired outcome. This required implementing support for handling deltas in the revlog testing code. Differential Revision: https://phab.mercurial-scm.org/D5116
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 16 Oct 2018 16:24:46 +0200
parents ddeb510d6815
children f1a39128da95
comparison
equal deleted inserted replaced
40322:ddeb510d6815 40323:2c0aa02ecd5a
950 rawtext=fulltext1) 950 rawtext=fulltext1)
951 951
952 with self.assertRaises(error.StorageError): 952 with self.assertRaises(error.StorageError):
953 f.read(node1) 953 f.read(node1)
954 954
955 diff = mdiff.textdiff(fulltext1, fulltext2)
956 node2 = storageutil.hashrevisionsha1(fulltext2, node1, nullid) 955 node2 = storageutil.hashrevisionsha1(fulltext2, node1, nullid)
957 deltas = [(node2, node1, nullid, b'\x01' * 20, node1, diff, 0)] 956
958 957 with self._maketransactionfn() as tr:
959 # This /might/ fail on some backends. 958 delta = mdiff.textdiff(fulltext1, fulltext2)
960 with self._maketransactionfn() as tr: 959 self._addrawrevisionfn(f, tr, node2, node1, nullid,
961 f.addgroup(deltas, lambda x: 0, tr) 960 2, delta=(1, delta))
962 961
963 self.assertEqual(len(f), 3) 962 self.assertEqual(len(f), 3)
964 963
965 # Assuming a delta is stored, we shouldn't need to validate node1 in 964 # Assuming a delta is stored, we shouldn't need to validate node1 in
966 # order to retrieve node2. 965 # order to retrieve node2.