##// END OF EJS Templates
urlutil: drop the deprecated `getpath()`...
Matt Harbison -
r50739:a9602a84 default
parent child Browse files
Show More
@@ -656,43 +656,6 b' class paths(dict):'
656 new_paths.extend(_chain_path(p, ui, self))
656 new_paths.extend(_chain_path(p, ui, self))
657 self[name] = new_paths
657 self[name] = new_paths
658
658
659 def getpath(self, ui, name, default=None):
660 """Return a ``path`` from a string, falling back to default.
661
662 ``name`` can be a named path or locations. Locations are filesystem
663 paths or URIs.
664
665 Returns None if ``name`` is not a registered path, a URI, or a local
666 path to a repo.
667 """
668 msg = b'getpath is deprecated, use `get_*` functions from urlutil'
669 ui.deprecwarn(msg, b'6.0')
670 # Only fall back to default if no path was requested.
671 if name is None:
672 if not default:
673 default = ()
674 elif not isinstance(default, (tuple, list)):
675 default = (default,)
676 for k in default:
677 try:
678 return self[k][0]
679 except KeyError:
680 continue
681 return None
682
683 # Most likely empty string.
684 # This may need to raise in the future.
685 if not name:
686 return None
687 if name in self:
688 return self[name][0]
689 else:
690 # Try to resolve as a local path or URI.
691 path = try_path(ui, name)
692 if path is None:
693 raise error.RepoError(_(b'repository %s does not exist') % name)
694 return path.rawloc
695
696
659
697 _pathsuboptions = {}
660 _pathsuboptions = {}
698
661
General Comments 0
You need to be logged in to leave comments. Login now