changeset 249:e97f6f6ed7c5

Implement a "nouser" option for the path-filter: like no-pwd but without user information also
author Franz Glasner <hg@dom66.de>
date Sun, 06 Jan 2019 17:27:17 +0100
parents 436b2db75a34
children 9a3dacfc3be6
files extensions/kwarchive.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/kwarchive.py	Thu Jan 03 23:17:13 2019 +0100
+++ b/extensions/kwarchive.py	Sun Jan 06 17:27:17 2019 +0100
@@ -214,6 +214,7 @@
 
     :``full``:    the path will be printed as is (including passwords et al.)
     :``nopwd``:   like ``full`` but without passwords
+    :``nouser``:  like ``full`` but without user and password information
     :``short``:   shorten the path somehow: no user/password information and
                   only a short server name
     :``last``:    shorten the path to the last component
@@ -313,6 +314,7 @@
 
     :``full``:    the path will be printed as is (including passwords et al.)
     :``nopwd``:   like ``full`` but without passwords
+    :``nouser``:  like ``full`` but without user and password information
     :``short``:   shorten the path somehow: no user/password information and
                   only a short server name
     :``last``:    shorten the path to the last component
@@ -535,6 +537,11 @@
                 path_uri = bytes(util.url(ui.paths[hgpath].loc))
             elif path_filter == "nopwd":
                 path_uri = util.hidepassword(ui.paths[hgpath].loc)
+            elif path_filter == "nouser":
+                path_url = util.url(ui.paths[hgpath].loc)
+                path_url.user = None
+                path_url.passwd = None
+                path_uri = bytes(path_url)
             elif path_filter == "short":
                 path_url = util.url(ui.paths[hgpath].loc)
                 path_url.scheme = SHORTENED_HG_SCHEMES.get(path_url.scheme,
@@ -636,9 +643,9 @@
 
 def get_checked_path_filter_option(opts):
     pf = opts.get("path_filter")
-    if pf not in ("full", "nopwd", "short", "last"):
+    if pf not in ("full", "nopwd", "nouser", "short", "last"):
         raise error.Abort(
-            _("path filter must be any of `full', `nopwd', `short' or `last'"))
+            _("path filter must be any of `full', `nopwd', `nouser`, `short' or `last'"))
     return pf