simplecache: ensure pathcopies doesn't cache special nodes

Summary:
Same fix as D6788335, though not blocking anything. Use the public `node()` function
on contexts and exclude None, nullid, and wdirid from caching.

Reviewed By: DurhamG

Differential Revision: D6790845

fbshipit-source-id: 4ccdc6889c993bb1a8379d50ecc92cb2aa03513d
This commit is contained in:
Phil Cohen 2018-01-23 15:48:16 -08:00 committed by Saurabh Singh
parent 34aebc68ca
commit 511a0a046f

View File

@ -117,9 +117,10 @@ class pathcopiesserializer(object):
def pathcopiesui(ui):
def pathcopies(orig, x, y, match=None):
func = lambda: orig(x, y, match=match)
if x._node is not None and y._node is not None and not match:
if (x.node() not in UNCACHEABLE_NODES and y.node()
not in UNCACHEABLE_NODES and not match):
key = 'pathcopies:%s:%s' % (
node.hex(x._node), node.hex(y._node))
node.hex(x.node()), node.hex(y.node()))
return memoize(func, key, pathcopiesserializer, ui)
return func()
return pathcopies