##// END OF EJS Templates
localrepo: move featuresetupfuncs out of localrepository class (API)...
Gregory Szorc -
r37153:ecac0006 default
parent child Browse files
Show More
@@ -146,7 +146,7 b' def featuresetup(ui, supported):'
146 supported |= {'largefiles'}
146 supported |= {'largefiles'}
147
147
148 def uisetup(ui):
148 def uisetup(ui):
149 localrepo.localrepository.featuresetupfuncs.add(featuresetup)
149 localrepo.featuresetupfuncs.add(featuresetup)
150 hg.wirepeersetupfuncs.append(proto.wirereposetup)
150 hg.wirepeersetupfuncs.append(proto.wirereposetup)
151 uisetupmod.uisetup(ui)
151 uisetupmod.uisetup(ui)
152
152
@@ -199,7 +199,7 b' def featuresetup(ui, supported):'
199 supported |= {'lfs'}
199 supported |= {'lfs'}
200
200
201 def uisetup(ui):
201 def uisetup(ui):
202 localrepo.localrepository.featuresetupfuncs.add(featuresetup)
202 localrepo.featuresetupfuncs.add(featuresetup)
203
203
204 def reposetup(ui, repo):
204 def reposetup(ui, repo):
205 # Nothing to do with a remote repo
205 # Nothing to do with a remote repo
@@ -309,6 +309,15 b' class locallegacypeer(repository.legacyp'
309 # clients.
309 # clients.
310 REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'
310 REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'
311
311
312 # Functions receiving (ui, features) that extensions can register to impact
313 # the ability to load repositories with custom requirements. Only
314 # functions defined in loaded extensions are called.
315 #
316 # The function receives a set of requirement strings that the repository
317 # is capable of opening. Functions will typically add elements to the
318 # set to reflect that the extension knows how to handle that requirements.
319 featuresetupfuncs = set()
320
312 class localrepository(object):
321 class localrepository(object):
313
322
314 # obsolete experimental requirements:
323 # obsolete experimental requirements:
@@ -336,10 +345,6 b' class localrepository(object):'
336 'treemanifest',
345 'treemanifest',
337 }
346 }
338
347
339 # a list of (ui, featureset) functions.
340 # only functions defined in module of enabled extensions are invoked
341 featuresetupfuncs = set()
342
343 # list of prefix for file which can be written without 'wlock'
348 # list of prefix for file which can be written without 'wlock'
344 # Extensions should extend this list when needed
349 # Extensions should extend this list when needed
345 _wlockfreeprefix = {
350 _wlockfreeprefix = {
@@ -399,11 +404,11 b' class localrepository(object):'
399 except IOError:
404 except IOError:
400 pass
405 pass
401
406
402 if self.featuresetupfuncs:
407 if featuresetupfuncs:
403 self.supported = set(self._basesupported) # use private copy
408 self.supported = set(self._basesupported) # use private copy
404 extmods = set(m.__name__ for n, m
409 extmods = set(m.__name__ for n, m
405 in extensions.extensions(self.ui))
410 in extensions.extensions(self.ui))
406 for setupfunc in self.featuresetupfuncs:
411 for setupfunc in featuresetupfuncs:
407 if setupfunc.__module__ in extmods:
412 if setupfunc.__module__ in extmods:
408 setupfunc(self.ui, self.supported)
413 setupfunc(self.ui, self.supported)
409 else:
414 else:
@@ -41,7 +41,7 b' another repository of push/pull/clone on'
41 > supported |= {'featuresetup-test'}
41 > supported |= {'featuresetup-test'}
42 > return
42 > return
43 > def uisetup(ui):
43 > def uisetup(ui):
44 > localrepo.localrepository.featuresetupfuncs.add(featuresetup)
44 > localrepo.featuresetupfuncs.add(featuresetup)
45 > EOF
45 > EOF
46 $ cat > supported/.hg/hgrc <<EOF
46 $ cat > supported/.hg/hgrc <<EOF
47 > [extensions]
47 > [extensions]
General Comments 0
You need to be logged in to leave comments. Login now