##// 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 command.
105 command.
106 '''
106 '''
107
107
108 from mercurial import commands, localrepo
108 from mercurial import commands, hg, localrepo
109
109
110 import lfcommands
110 import lfcommands
111 import proto
111 import reposetup
112 import reposetup
112 import uisetup as uisetupmod
113 import uisetup as uisetupmod
113
114
@@ -121,6 +122,7 b' def featuresetup(ui, supported):'
121
122
122 def uisetup(ui):
123 def uisetup(ui):
123 localrepo.localrepository.featuresetupfuncs.add(featuresetup)
124 localrepo.localrepository.featuresetupfuncs.add(featuresetup)
125 hg.wirepeersetupfuncs.append(proto.wirereposetup)
124 uisetupmod.uisetup(ui)
126 uisetupmod.uisetup(ui)
125
127
126 commands.norepo += " lfconvert"
128 commands.norepo += " lfconvert"
@@ -16,14 +16,13 b' from mercurial.i18n import _'
16 from mercurial import localrepo
16 from mercurial import localrepo
17
17
18 import lfcommands
18 import lfcommands
19 import proto
20 import lfutil
19 import lfutil
21
20
22 def reposetup(ui, repo):
21 def reposetup(ui, repo):
23 # wire repositories should be given new wireproto functions but not the
22 # wire repositories should be given new wireproto functions
24 # other largefiles modifications
23 # by "proto.wirereposetup()" via "hg.wirepeersetupfuncs"
25 if not repo.local():
24 if not repo.local():
26 return proto.wirereposetup(ui, repo)
25 return
27
26
28 class lfilesrepo(repo.__class__):
27 class lfilesrepo(repo.__class__):
29 lfstatus = False
28 lfstatus = False
@@ -98,6 +98,9 b' def openpath(ui, path):'
98 else:
98 else:
99 return url.open(ui, path)
99 return url.open(ui, path)
100
100
101 # a list of (ui, repo) functions called for wire peer initialization
102 wirepeersetupfuncs = []
103
101 def _peerorrepo(ui, path, create=False):
104 def _peerorrepo(ui, path, create=False):
102 """return a repository object for the specified path"""
105 """return a repository object for the specified path"""
103 obj = _peerlookup(path).instance(ui, path, create)
106 obj = _peerlookup(path).instance(ui, path, create)
@@ -106,6 +109,9 b' def _peerorrepo(ui, path, create=False):'
106 hook = getattr(module, 'reposetup', None)
109 hook = getattr(module, 'reposetup', None)
107 if hook:
110 if hook:
108 hook(ui, obj)
111 hook(ui, obj)
112 if not obj.local():
113 for f in wirepeersetupfuncs:
114 f(ui, obj)
109 return obj
115 return obj
110
116
111 def repository(ui, path='', create=False):
117 def repository(ui, path='', create=False):
@@ -2285,4 +2285,30 b' enabling largefiles extension.'
2285 $ test -d clone-pull-dst
2285 $ test -d clone-pull-dst
2286 [1]
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 $ cd ..
2314 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now