Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 38211:aea29e81753a
serve: add option print-url
It can be used to open hgweb in a web browser. Example :
xdg-open "`hg serve --print-url`".
Differential Revision: https://phab.mercurial-scm.org/D3649
author | Nicola Spanti <nicola.spanti@logilab.fr> |
---|---|
date | Thu, 24 May 2018 09:56:28 +0000 |
parents | dfb888aae17a |
children | 22edd5321489 |
comparison
equal
deleted
inserted
replaced
38210:7fa3408f83ef | 38211:aea29e81753a |
---|---|
4784 ('', 'stdio', None, _('for remote clients (ADVANCED)')), | 4784 ('', 'stdio', None, _('for remote clients (ADVANCED)')), |
4785 ('', 'cmdserver', '', _('for remote clients (ADVANCED)'), _('MODE')), | 4785 ('', 'cmdserver', '', _('for remote clients (ADVANCED)'), _('MODE')), |
4786 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), | 4786 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
4787 ('', 'style', '', _('template style to use'), _('STYLE')), | 4787 ('', 'style', '', _('template style to use'), _('STYLE')), |
4788 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), | 4788 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
4789 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))] | 4789 ('', 'certificate', '', _('SSL certificate file'), _('FILE')), |
4790 ('', 'print-url', None, _('start and print only the URL'))] | |
4790 + subrepoopts, | 4791 + subrepoopts, |
4791 _('[OPTION]...'), | 4792 _('[OPTION]...'), |
4792 optionalrepo=True) | 4793 optionalrepo=True) |
4793 def serve(ui, repo, **opts): | 4794 def serve(ui, repo, **opts): |
4794 """start stand-alone webserver | 4795 """start stand-alone webserver |
4816 """ | 4817 """ |
4817 | 4818 |
4818 opts = pycompat.byteskwargs(opts) | 4819 opts = pycompat.byteskwargs(opts) |
4819 if opts["stdio"] and opts["cmdserver"]: | 4820 if opts["stdio"] and opts["cmdserver"]: |
4820 raise error.Abort(_("cannot use --stdio with --cmdserver")) | 4821 raise error.Abort(_("cannot use --stdio with --cmdserver")) |
4822 if opts["print_url"] and ui.verbose: | |
4823 raise error.Abort(_("cannot use --print-url with --verbose")) | |
4824 if opts["print_url"]: | |
4825 opts['daemon'] = True | |
4821 | 4826 |
4822 if opts["stdio"]: | 4827 if opts["stdio"]: |
4823 if repo is None: | 4828 if repo is None: |
4824 raise error.RepoError(_("there is no Mercurial repository here" | 4829 raise error.RepoError(_("there is no Mercurial repository here" |
4825 " (.hg not found)")) | 4830 " (.hg not found)")) |