635 """ |
635 """ |
636 |
636 |
637 def __init__(self, ui): |
637 def __init__(self, ui): |
638 dict.__init__(self) |
638 dict.__init__(self) |
639 |
639 |
|
640 home_path = os.path.expanduser(b'~') |
|
641 |
640 for name, loc in ui.configitems(b'paths', ignoresub=True): |
642 for name, loc in ui.configitems(b'paths', ignoresub=True): |
641 # No location is the same as not existing. |
643 # No location is the same as not existing. |
642 if not loc: |
644 if not loc: |
643 continue |
645 continue |
644 loc, sub_opts = ui.configsuboptions(b'paths', name) |
646 _value, sub_opts = ui.configsuboptions(b'paths', name) |
|
647 s = ui.configsource(b'paths', name) |
|
648 root_key = (name, loc, s) |
|
649 root = ui._path_to_root.get(root_key, home_path) |
|
650 loc = os.path.expandvars(loc) |
|
651 loc = os.path.expanduser(loc) |
|
652 if not hasscheme(loc) and not os.path.isabs(loc): |
|
653 loc = os.path.normpath(os.path.join(root, loc)) |
645 self[name] = [path(ui, name, rawloc=loc, suboptions=sub_opts)] |
654 self[name] = [path(ui, name, rawloc=loc, suboptions=sub_opts)] |
646 |
655 |
647 for name, old_paths in sorted(self.items()): |
656 for name, old_paths in sorted(self.items()): |
648 new_paths = [] |
657 new_paths = [] |
649 for p in old_paths: |
658 for p in old_paths: |