comparison mercurial/commands.py @ 42435:9803323048b6

root: add support for -Tformatter option It's useless right now, but it should just work and I want to add a few more fields.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 04 Jun 2019 20:58:39 +0900
parents fa4b13e81f60
children 69883775b27d
comparison
equal deleted inserted replaced
42434:a97b12f726e4 42435:9803323048b6
5223 hint=('see `hg help -v rollback` for information')) 5223 hint=('see `hg help -v rollback` for information'))
5224 return repo.rollback(dryrun=opts.get(r'dry_run'), 5224 return repo.rollback(dryrun=opts.get(r'dry_run'),
5225 force=opts.get(r'force')) 5225 force=opts.get(r'force'))
5226 5226
5227 @command( 5227 @command(
5228 'root', [], intents={INTENT_READONLY}, 5228 'root', [] + formatteropts, intents={INTENT_READONLY},
5229 helpcategory=command.CATEGORY_WORKING_DIRECTORY) 5229 helpcategory=command.CATEGORY_WORKING_DIRECTORY)
5230 def root(ui, repo): 5230 def root(ui, repo, **opts):
5231 """print the root (top) of the current working directory 5231 """print the root (top) of the current working directory
5232 5232
5233 Print the root directory of the current repository. 5233 Print the root directory of the current repository.
5234 5234
5235 Returns 0 on success. 5235 Returns 0 on success.
5236 """ 5236 """
5237 ui.write(repo.root + "\n") 5237 opts = pycompat.byteskwargs(opts)
5238 with ui.formatter('root', opts) as fm:
5239 fm.startitem()
5240 fm.write('reporoot', '%s\n', repo.root)
5238 5241
5239 @command('serve', 5242 @command('serve',
5240 [('A', 'accesslog', '', _('name of access log file to write to'), 5243 [('A', 'accesslog', '', _('name of access log file to write to'),
5241 _('FILE')), 5244 _('FILE')),
5242 ('d', 'daemon', None, _('run server in background')), 5245 ('d', 'daemon', None, _('run server in background')),