mercurial/utils/urlutil.py
changeset 48913 f254fc73d956
parent 48743 a1538c05d855
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
   451 
   451 
   452 def list_paths(ui, target_path=None):
   452 def list_paths(ui, target_path=None):
   453     """list all the (name, paths) in the passed ui"""
   453     """list all the (name, paths) in the passed ui"""
   454     result = []
   454     result = []
   455     if target_path is None:
   455     if target_path is None:
   456         for name, paths in sorted(pycompat.iteritems(ui.paths)):
   456         for name, paths in sorted(ui.paths.items()):
   457             for p in paths:
   457             for p in paths:
   458                 result.append((name, p))
   458                 result.append((name, p))
   459 
   459 
   460     else:
   460     else:
   461         for path in ui.paths.get(target_path, []):
   461         for path in ui.paths.get(target_path, []):
   917 
   917 
   918     def _apply_suboptions(self, ui, sub_options):
   918     def _apply_suboptions(self, ui, sub_options):
   919         # Now process the sub-options. If a sub-option is registered, its
   919         # Now process the sub-options. If a sub-option is registered, its
   920         # attribute will always be present. The value will be None if there
   920         # attribute will always be present. The value will be None if there
   921         # was no valid sub-option.
   921         # was no valid sub-option.
   922         for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions):
   922         for suboption, (attr, func) in _pathsuboptions.items():
   923             if suboption not in sub_options:
   923             if suboption not in sub_options:
   924                 setattr(self, attr, None)
   924                 setattr(self, attr, None)
   925                 continue
   925                 continue
   926 
   926 
   927             value = func(ui, self, sub_options[suboption])
   927             value = func(ui, self, sub_options[suboption])
   943         """Return sub-options and their values for this path.
   943         """Return sub-options and their values for this path.
   944 
   944 
   945         This is intended to be used for presentation purposes.
   945         This is intended to be used for presentation purposes.
   946         """
   946         """
   947         d = {}
   947         d = {}
   948         for subopt, (attr, _func) in pycompat.iteritems(_pathsuboptions):
   948         for subopt, (attr, _func) in _pathsuboptions.items():
   949             value = getattr(self, attr)
   949             value = getattr(self, attr)
   950             if value is not None:
   950             if value is not None:
   951                 d[subopt] = value
   951                 d[subopt] = value
   952         return d
   952         return d