diff tests/test-paths.t @ 27728:294037159c64

paths: port to generic templater Embedded passwords are masked only in plain output because we'll want raw values in machine-readable format such as JSON. For custom template, we can add a filter to mask passwords (e.g. "{url|hidepassword}"). path.rawloc field is called as "url" than "path" because we have "pushurl" sub-option. Also, "name" and "url" are not allowed as sub-options as they conflict with the field names.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Dec 2015 22:09:57 +0900
parents 7e9dc8bbebf6
children 72f2a19c5f88 1ff28873830e
line wrap: on
line diff
--- a/tests/test-paths.t	Sun Dec 13 23:01:19 2015 +0900
+++ b/tests/test-paths.t	Sun Dec 13 22:09:57 2015 +0900
@@ -10,6 +10,9 @@
   $ hg paths unknown
   not found!
   [1]
+  $ hg paths -Tjson
+  [
+  ]
 
 with paths:
 
@@ -52,6 +55,48 @@
   [1]
   $ hg paths -q unknown
   [1]
+
+formatter output with paths:
+
+  $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc
+  $ hg paths -Tjson
+  [
+   {
+    "name": "dupe",
+    "pushurl": "https://example.com/dupe",
+    "url": "$TESTTMP/b#tip"
+   },
+   {
+    "name": "expand",
+    "url": "$TESTTMP/a/$SOMETHING/bar"
+   }
+  ]
+  $ hg paths -Tjson dupe
+  [
+   {
+    "name": "dupe",
+    "pushurl": "https://example.com/dupe",
+    "url": "$TESTTMP/b#tip"
+   }
+  ]
+  $ hg paths -Tjson -q unknown
+  [
+  ]
+  [1]
+
+password should be masked in plain output, but not in machine-readable output:
+
+  $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc
+  $ hg paths insecure
+  http://foo:***@example.com/
+  $ hg paths -Tjson insecure
+  [
+   {
+    "name": "insecure",
+    "url": "http://foo:insecure@example.com/"
+   }
+  ]
+
   $ cd ..
 
 sub-options for an undeclared path are ignored