Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 158:07e323b8d27d
Refactor: make_node_keywords: path handling
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Mon, 27 Aug 2018 11:14:55 +0200 |
| parents | e12025e46375 |
| children | d313b33c9c06 |
| files | extensions/kwarchive.py |
| diffstat | 1 files changed, 24 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/kwarchive.py Mon Aug 27 11:07:26 2018 +0200 +++ b/extensions/kwarchive.py Mon Aug 27 11:14:55 2018 +0200 @@ -520,33 +520,31 @@ """Make all the node-specific (i.e. file-path independent) keywords """ - if hgpath: - if hgpath == '.': - path_uri = repo.root - else: - try: - if path_filter == "full": - path_uri = bytes(util.url(ui.paths[hgpath].loc)) - elif path_filter == "nopwd": - path_uri = util.hidepassword(ui.paths[hgpath].loc) - elif path_filter == "short": - path_url = util.url(ui.paths[hgpath].loc) - path_url.scheme = SHORTENED_HG_SCHEMES.get(path_url.scheme, - "hg") - path_url.user = None - path_url.passwd = None - path_url.host = stripped_hostname(path_url.host) - path_url.port = None - path_uri = bytes(path_url) - elif path_filter == "last": - path_url = str(util.url(ui.paths[hgpath].loc)).split("/") - path_uri = bytes(b".../"+path_url[-1]) - else: - raise error.Abort("path-filter `%s' not implemented" - % path_filter) - except LookupError: - raise error.Abort(_('repository %s not found') % hgpath) + if hgpath and hgpath != ".": + try: + if path_filter == "full": + path_uri = bytes(util.url(ui.paths[hgpath].loc)) + elif path_filter == "nopwd": + path_uri = util.hidepassword(ui.paths[hgpath].loc) + elif path_filter == "short": + path_url = util.url(ui.paths[hgpath].loc) + path_url.scheme = SHORTENED_HG_SCHEMES.get(path_url.scheme, + "hg") + path_url.user = None + path_url.passwd = None + path_url.host = stripped_hostname(path_url.host) + path_url.port = None + path_uri = bytes(path_url) + elif path_filter == "last": + path_url = str(util.url(ui.paths[hgpath].loc)).split("/") + path_uri = bytes(b".../"+path_url[-1]) + else: + raise error.Abort("path-filter `%s' not implemented" + % path_filter) + except LookupError: + raise error.Abort(_('repository %s not found') % hgpath) else: + assert (hgpath is None) or (hgpath == ".") path_uri = repo.root if path_uri.startswith(b"\\\\"): # Make an URL from a Windows UNC path
