# HG changeset patch # User Franz Glasner # Date 1535361295 -7200 # Node ID 07e323b8d27dbb0f1ca545667355d162d6c6cd3c # Parent e12025e4637571f90dc1ce7e8ddabd36b75a091d Refactor: make_node_keywords: path handling diff -r e12025e46375 -r 07e323b8d27d extensions/kwarchive.py --- 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