[PATCH 3 of 4] test-manifest.py: separate out test for byte 22 of nodeid
Augie Fackler
augie at google.com
Thu Mar 26 12:34:58 CDT 2015
On Thu, Mar 26, 2015 at 1:31 PM, Martin von Zweigbergk <
martinvonz at google.com> wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1427388141 25200
> # Thu Mar 26 09:42:21 2015 -0700
> # Node ID 4dd5ebf2778b1ec0f967d28e1f752906360602ae
> # Parent c99862a283585e40e907b9116a7736de6a3f4369
> test-manifest.py: separate out test for byte 22 of nodeid
>
How much of a perf lose is it for treemanifest to trim the nodeid to no
more than 21 bytes? I think I'd rather see the behavior be consistent...
>
> When assigning a 22-byte hash to a nodeid in a manifest, manifestdict
> drops the 22nd byte, while treemanifest keeps it. Let's keep this test
> separate and make it pass whether the 22nd byte gets stored or
> dropped.
>
> diff -r c99862a28358 -r 4dd5ebf2778b tests/test-manifest.py
> --- a/tests/test-manifest.py Wed Mar 25 14:13:46 2015 -0700
> +++ b/tests/test-manifest.py Thu Mar 26 09:42:21 2015 -0700
> @@ -127,10 +127,6 @@
> self.assertEqual([('bar/baz/qux.py', binascii.unhexlify(HASH_2)),
> ('foo', binascii.unhexlify(HASH_1) + 'a')],
> list(m.iteritems()))
> - # Sometimes it even tries a 22-byte fake hash, but we can
> - # return 21 and it'll work out
> - m['foo'] = want + '+'
> - self.assertEqual(want, m['foo'])
> # make sure the suffix survives a copy
> match = matchmod.match('', '', ['re:foo'])
> m2 = m.matches(match)
> @@ -148,6 +144,14 @@
> self.assertEqual({'foo': ((want, f), (h, ''))}, m.diff(clean))
> self.assertEqual({'foo': ((h, ''), (want, f))}, clean.diff(m))
>
> + def test22ByteNode(self):
> + m = parsemanifest(A_SHORT_MANIFEST)
> + h = binascii.unhexlify(HASH_3)
> + # Sometimes it even tries a 22-byte fake hash, but we can
> + # keep 21 and it'll work out
> + m['foo'] = h + 'a+'
> + self.assertIn(m['foo'], [h + 'a', h + 'a+'])
> +
> def testMatchException(self):
> m = parsemanifest(A_SHORT_MANIFEST)
> match = matchmod.match('', '', ['re:.*'])
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150326/bb3ad852/attachment.html>
More information about the Mercurial-devel
mailing list