--- a/tests/wireprotosimplecache.py Wed Sep 26 18:02:06 2018 -0700
+++ b/tests/wireprotosimplecache.py Wed Sep 26 17:46:48 2018 -0700
@@ -17,6 +17,7 @@
)
from mercurial.utils import (
interfaceutil,
+ stringutil,
)
CACHE = None
@@ -26,6 +27,8 @@
configitem('simplecache', 'cacheobjects',
default=False)
+configitem('simplecache', 'redirectsfile',
+ default=None)
@interfaceutil.implementer(repository.iwireprotocolcommandcacher)
class memorycacher(object):
@@ -91,6 +94,19 @@
def makeresponsecacher(orig, repo, proto, command, args, objencoderfn):
return memorycacher(repo.ui, command, objencoderfn)
+def loadredirecttargets(ui):
+ path = ui.config('simplecache', 'redirectsfile')
+ if not path:
+ return []
+
+ with open(path, 'rb') as fh:
+ s = fh.read()
+
+ return stringutil.evalpythonliteral(s)
+
+def getadvertisedredirecttargets(orig, repo, proto):
+ return loadredirecttargets(repo.ui)
+
def extsetup(ui):
global CACHE
@@ -98,3 +114,5 @@
extensions.wrapfunction(wireprotov2server, 'makeresponsecacher',
makeresponsecacher)
+ extensions.wrapfunction(wireprotov2server, 'getadvertisedredirecttargets',
+ getadvertisedredirecttargets)