##// END OF EJS Templates
paths: port to generic templater...
Yuya Nishihara -
r27728:29403715 default
parent child Browse files
Show More
@@ -5365,8 +5365,8 b' def parents(ui, repo, file_=None, **opts'
5365 5365 displayer.show(repo[n])
5366 5366 displayer.close()
5367 5367
5368 @command('paths', [], _('[NAME]'), optionalrepo=True)
5369 def paths(ui, repo, search=None):
5368 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
5369 def paths(ui, repo, search=None, **opts):
5370 5370 """show aliases for remote repositories
5371 5371
5372 5372 Show definition of symbolic path name NAME. If no name is given,
@@ -5403,6 +5403,11 b' def paths(ui, repo, search=None):'
5403 5403 else:
5404 5404 pathitems = sorted(ui.paths.iteritems())
5405 5405
5406 fm = ui.formatter('paths', opts)
5407 if fm:
5408 hidepassword = str
5409 else:
5410 hidepassword = util.hidepassword
5406 5411 if ui.quiet:
5407 5412 namefmt = '%s\n'
5408 5413 else:
@@ -5410,13 +5415,16 b' def paths(ui, repo, search=None):'
5410 5415 showsubopts = not search and not ui.quiet
5411 5416
5412 5417 for name, path in pathitems:
5413 if not search:
5414 ui.write(namefmt % name)
5415 if not ui.quiet:
5416 ui.write("%s\n" % util.hidepassword(path.rawloc))
5418 fm.startitem()
5419 fm.condwrite(not search, 'name', namefmt, name)
5420 fm.condwrite(not ui.quiet, 'url', '%s\n', hidepassword(path.rawloc))
5417 5421 for subopt, value in sorted(path.suboptions.items()):
5422 assert subopt not in ('name', 'url')
5418 5423 if showsubopts:
5419 ui.write('%s:%s = %s\n' % (name, subopt, value))
5424 fm.plain('%s:%s = ' % (name, subopt))
5425 fm.condwrite(showsubopts, subopt, '%s\n', value)
5426
5427 fm.end()
5420 5428
5421 5429 if search and not pathitems:
5422 5430 if not ui.quiet:
@@ -286,7 +286,7 b' Show all commands + options'
286 286 manifest: rev, all, template
287 287 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
288 288 parents: rev, style, template
289 paths:
289 paths: template
290 290 phase: public, draft, secret, force, rev
291 291 recover:
292 292 rename: after, force, include, exclude, dry-run
@@ -10,6 +10,9 b' with no paths:'
10 10 $ hg paths unknown
11 11 not found!
12 12 [1]
13 $ hg paths -Tjson
14 [
15 ]
13 16
14 17 with paths:
15 18
@@ -52,6 +55,48 b' with paths:'
52 55 [1]
53 56 $ hg paths -q unknown
54 57 [1]
58
59 formatter output with paths:
60
61 $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc
62 $ hg paths -Tjson
63 [
64 {
65 "name": "dupe",
66 "pushurl": "https://example.com/dupe",
67 "url": "$TESTTMP/b#tip"
68 },
69 {
70 "name": "expand",
71 "url": "$TESTTMP/a/$SOMETHING/bar"
72 }
73 ]
74 $ hg paths -Tjson dupe
75 [
76 {
77 "name": "dupe",
78 "pushurl": "https://example.com/dupe",
79 "url": "$TESTTMP/b#tip"
80 }
81 ]
82 $ hg paths -Tjson -q unknown
83 [
84 ]
85 [1]
86
87 password should be masked in plain output, but not in machine-readable output:
88
89 $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc
90 $ hg paths insecure
91 http://foo:***@example.com/
92 $ hg paths -Tjson insecure
93 [
94 {
95 "name": "insecure",
96 "url": "http://foo:insecure@example.com/"
97 }
98 ]
99
55 100 $ cd ..
56 101
57 102 sub-options for an undeclared path are ignored
General Comments 0
You need to be logged in to leave comments. Login now