# HG changeset patch # User Anton Shestakov # Date 1616594827 -28800 # Node ID 5056fb0c919e18651938d2008daac6d37b9db16b # Parent bf8a61f1c616222c60511b00e5b495c35320d09f evolve: use nullrev for an empty cache key Pairing nullid with nullrev (-1) seems more logical than pairing it with 0. This also means we don't false-detect strips out of nowhere. That used to happen because newkey (-1, nullid) != self._cachekey (0, nullid). diff -r bf8a61f1c616 -r 5056fb0c919e hgext3rd/evolve/genericcaches.py --- a/hgext3rd/evolve/genericcaches.py Wed Mar 17 20:19:41 2021 +0800 +++ b/hgext3rd/evolve/genericcaches.py Wed Mar 24 22:07:07 2021 +0800 @@ -143,7 +143,7 @@ __metaclass__ = abc.ABCMeta # default key used for an empty cache - emptykey = (0, node.nullid) + emptykey = (node.nullrev, node.nullid) _cachekeyspec = b'i20s' _cachename = None # used for debug message diff -r bf8a61f1c616 -r 5056fb0c919e tests/test-discovery-obshashrange.t --- a/tests/test-discovery-obshashrange.t Wed Mar 17 20:19:41 2021 +0800 +++ b/tests/test-discovery-obshashrange.t Wed Mar 24 22:07:07 2021 +0800 @@ -134,14 +134,10 @@ (run 'hg update' to get a working copy) $ hg -R ../server blackbox * @0000000000000000000000000000000000000000 (*)> debugobshashrange --subranges --rev tip (glob) - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob) - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-depthcache cache reset (glob) * @0000000000000000000000000000000000000000 (*)> updated evo-ext-depthcache in *.???? seconds (8r) (glob) * @0000000000000000000000000000000000000000 (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (8r) (glob) 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (8r, 5o) (glob) - 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-stablesort cache reset (glob) 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> updated evo-ext-stablesort in *.???? seconds (8r) (glob) - 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-firstmerge cache reset (glob) 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> updated evo-ext-firstmerge in *.???? seconds (8r) (glob) * @0000000000000000000000000000000000000000 (*)> debugobshashrange --subranges --rev tip exited 0 after *.?? seconds (glob) * @0000000000000000000000000000000000000000 (*)> -R server serve --stdio (glob) @@ -154,14 +150,6 @@ cccccccccccccccccccccccccccccccccccccccc bebd167eb94d257ace0e814aeb98e6972ed2970d 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} $ rm ../server/.hg/blackbox.log $ hg blackbox - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-firstmerge cache reset (glob) - * @0000000000000000000000000000000000000000 (*)> updated evo-ext-firstmerge in *.???? seconds (0r) (glob) - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-depthcache cache reset (glob) - * @0000000000000000000000000000000000000000 (*)> updated evo-ext-depthcache in *.???? seconds (0r) (glob) - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-stablesort cache reset (glob) - * @0000000000000000000000000000000000000000 (*)> updated evo-ext-stablesort in *.???? seconds (0r) (glob) - * @0000000000000000000000000000000000000000 (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob) - * @0000000000000000000000000000000000000000 (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (0r) (glob) * @0000000000000000000000000000000000000000 (*)> 0/0 cache hits/lookups in *.???? seconds (glob) * @0000000000000000000000000000000000000000 (*)> clone *ssh://user@dummy/server* client exited 0 after *.?? seconds (glob) * @0000000000000000000000000000000000000000 (*)> pull --rev 4 (glob) @@ -334,7 +322,6 @@ * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> preparing listkeys for "namespaces" (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending listkeys command (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> received listkey for "namespaces": 40 bytes (glob) - * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-depthcache in *.???? seconds (6r) (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (6r) (glob) 1970/01/01 00:00:00 * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-obshashrange in *.???? seconds (6r, 4o) (glob) @@ -1068,7 +1055,6 @@ * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> writing .hg/cache/tags2-visible with 0 tags (glob) * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> log -G exited 0 after *.?? seconds (glob) * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> pull (glob) - * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-stablerange-mergepoint cache reset (glob) * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> strip detected, evo-ext-depthcache cache reset (glob) * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-depthcache in *.???? seconds (8r) (glob) * @bebd167eb94d257ace0e814aeb98e6972ed2970d (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (8r) (glob)