##// END OF EJS Templates
hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)...
FUJIWARA Katsunori -
r20858:bc56ec9e stable
parent child Browse files
Show More
@@ -105,9 +105,10 b' explicitly do so with the --large flag p'
105 105 command.
106 106 '''
107 107
108 from mercurial import commands, localrepo
108 from mercurial import commands, hg, localrepo
109 109
110 110 import lfcommands
111 import proto
111 112 import reposetup
112 113 import uisetup as uisetupmod
113 114
@@ -121,6 +122,7 b' def featuresetup(ui, supported):'
121 122
122 123 def uisetup(ui):
123 124 localrepo.localrepository.featuresetupfuncs.add(featuresetup)
125 hg.wirepeersetupfuncs.append(proto.wirereposetup)
124 126 uisetupmod.uisetup(ui)
125 127
126 128 commands.norepo += " lfconvert"
@@ -16,14 +16,13 b' from mercurial.i18n import _'
16 16 from mercurial import localrepo
17 17
18 18 import lfcommands
19 import proto
20 19 import lfutil
21 20
22 21 def reposetup(ui, repo):
23 # wire repositories should be given new wireproto functions but not the
24 # other largefiles modifications
22 # wire repositories should be given new wireproto functions
23 # by "proto.wirereposetup()" via "hg.wirepeersetupfuncs"
25 24 if not repo.local():
26 return proto.wirereposetup(ui, repo)
25 return
27 26
28 27 class lfilesrepo(repo.__class__):
29 28 lfstatus = False
@@ -98,6 +98,9 b' def openpath(ui, path):'
98 98 else:
99 99 return url.open(ui, path)
100 100
101 # a list of (ui, repo) functions called for wire peer initialization
102 wirepeersetupfuncs = []
103
101 104 def _peerorrepo(ui, path, create=False):
102 105 """return a repository object for the specified path"""
103 106 obj = _peerlookup(path).instance(ui, path, create)
@@ -106,6 +109,9 b' def _peerorrepo(ui, path, create=False):'
106 109 hook = getattr(module, 'reposetup', None)
107 110 if hook:
108 111 hook(ui, obj)
112 if not obj.local():
113 for f in wirepeersetupfuncs:
114 f(ui, obj)
109 115 return obj
110 116
111 117 def repository(ui, path='', create=False):
@@ -2285,4 +2285,30 b' enabling largefiles extension.'
2285 2285 $ test -d clone-pull-dst
2286 2286 [1]
2287 2287
2288 #if serve
2289
2290 Test largefiles specific peer setup, when largefiles is enabled
2291 locally (issue4109)
2292
2293 $ hg showconfig extensions | grep largefiles
2294 extensions.largefiles=!
2295 $ mkdir -p $TESTTMP/individualenabling/usercache
2296
2297 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
2298 $ cat hg.pid >> $DAEMON_PIDS
2299
2300 $ hg init pull-dst
2301 $ cat > pull-dst/.hg/hgrc <<EOF
2302 > [extensions]
2303 > # enable locally
2304 > largefiles=
2305 > [largefiles]
2306 > # ignore system cache to force largefiles specific wire proto access
2307 > usercache=$TESTTMP/individualenabling/usercache
2308 > EOF
2309 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
2310
2311 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2312 #endif
2313
2288 2314 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now