##// END OF EJS Templates
paths: use single loop for both search=None|pattern cases...
Yuya Nishihara -
r27726:7e9dc8bb default
parent child Browse files
Show More
@@ -5398,18 +5398,16 b' def paths(ui, repo, search=None):'
5398 5398 Returns 0 on success.
5399 5399 """
5400 5400 if search:
5401 for name, path in sorted(ui.paths.iteritems()):
5402 if name == search:
5403 if not ui.quiet:
5404 ui.write("%s\n" % util.hidepassword(path.rawloc))
5405 return
5406 if not ui.quiet:
5407 ui.warn(_("not found!\n"))
5408 return 1
5401 pathitems = [(name, path) for name, path in ui.paths.iteritems()
5402 if name == search]
5409 5403 else:
5410 5404 pathitems = sorted(ui.paths.iteritems())
5411 5405
5412 5406 for name, path in pathitems:
5407 if search and not ui.quiet:
5408 ui.write("%s\n" % util.hidepassword(path.rawloc))
5409 if search:
5410 continue
5413 5411 if ui.quiet:
5414 5412 ui.write("%s\n" % name)
5415 5413 else:
@@ -5417,6 +5415,13 b' def paths(ui, repo, search=None):'
5417 5415 for subopt, value in sorted(path.suboptions.items()):
5418 5416 ui.write('%s:%s = %s\n' % (name, subopt, value))
5419 5417
5418 if search and not pathitems:
5419 if not ui.quiet:
5420 ui.warn(_("not found!\n"))
5421 return 1
5422 else:
5423 return 0
5424
5420 5425 @command('phase',
5421 5426 [('p', 'public', False, _('set changeset phase to public')),
5422 5427 ('d', 'draft', False, _('set changeset phase to draft')),
@@ -3,6 +3,16 b''
3 3 updating to branch default
4 4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 5 $ cd a
6
7 with no paths:
8
9 $ hg paths
10 $ hg paths unknown
11 not found!
12 [1]
13
14 with paths:
15
6 16 $ echo '[paths]' >> .hg/hgrc
7 17 $ echo 'dupe = ../b#tip' >> .hg/hgrc
8 18 $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
General Comments 0
You need to be logged in to leave comments. Login now