##// END OF EJS Templates
path: extract sub-option logic into its own method...
marmoute -
r47581:4821cb41 default
parent child Browse files
Show More
@@ -2323,19 +2323,13 b' class path(object):'
2323 2323 self._validate_path()
2324 2324
2325 2325 _path, sub_opts = ui.configsuboptions(b'paths', b'*')
2326 self._own_sub_opts = {}
2326 2327 if suboptions is not None:
2328 self._own_sub_opts = suboptions.copy()
2327 2329 sub_opts.update(suboptions)
2330 self._all_sub_opts = sub_opts.copy()
2328 2331
2329 # Now process the sub-options. If a sub-option is registered, its
2330 # attribute will always be present. The value will be None if there
2331 # was no valid sub-option.
2332 for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions):
2333 if suboption not in sub_opts:
2334 setattr(self, attr, None)
2335 continue
2336
2337 value = func(ui, self, sub_opts[suboption])
2338 setattr(self, attr, value)
2332 self._apply_suboptions(ui, sub_opts)
2339 2333
2340 2334 def _validate_path(self):
2341 2335 # When given a raw location but not a symbolic name, validate the
@@ -2350,6 +2344,18 b' class path(object):'
2350 2344 b'repo: %s' % self.rawloc
2351 2345 )
2352 2346
2347 def _apply_suboptions(self, ui, sub_options):
2348 # Now process the sub-options. If a sub-option is registered, its
2349 # attribute will always be present. The value will be None if there
2350 # was no valid sub-option.
2351 for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions):
2352 if suboption not in sub_options:
2353 setattr(self, attr, None)
2354 continue
2355
2356 value = func(ui, self, sub_options[suboption])
2357 setattr(self, attr, value)
2358
2353 2359 def _isvalidlocalpath(self, path):
2354 2360 """Returns True if the given path is a potentially valid repository.
2355 2361 This is its own function so that extensions can change the definition of
General Comments 0
You need to be logged in to leave comments. Login now