9 from lock import release |
9 from lock import release |
10 from i18n import _, gettext |
10 from i18n import _, gettext |
11 import os, re, difflib, time, tempfile, errno |
11 import os, re, difflib, time, tempfile, errno |
12 import hg, scmutil, util, revlog, extensions, copies, error, bookmarks |
12 import hg, scmutil, util, revlog, extensions, copies, error, bookmarks |
13 import patch, help, url, encoding, templatekw, discovery |
13 import patch, help, url, encoding, templatekw, discovery |
14 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server |
14 import archival, changegroup, cmdutil, hbisect |
|
15 import sshserver, hgweb, hgweb.server, commandserver |
15 import merge as mergemod |
16 import merge as mergemod |
16 import minirst, revset, fileset |
17 import minirst, revset, fileset |
17 import dagparser, context, simplemerge |
18 import dagparser, context, simplemerge |
18 import random, setdiscovery, treediscovery, dagutil |
19 import random, setdiscovery, treediscovery, dagutil |
19 |
20 |
4416 _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), |
4417 _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), |
4417 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), |
4418 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), |
4418 _('FILE')), |
4419 _('FILE')), |
4419 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), |
4420 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), |
4420 ('', 'stdio', None, _('for remote clients')), |
4421 ('', 'stdio', None, _('for remote clients')), |
|
4422 ('', 'cmdserver', '', _('for remote clients'), _('MODE')), |
4421 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
4423 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
4422 ('', 'style', '', _('template style to use'), _('STYLE')), |
4424 ('', 'style', '', _('template style to use'), _('STYLE')), |
4423 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
4425 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
4424 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], |
4426 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], |
4425 _('[OPTION]...')) |
4427 _('[OPTION]...')) |
4446 number it uses. |
4448 number it uses. |
4447 |
4449 |
4448 Returns 0 on success. |
4450 Returns 0 on success. |
4449 """ |
4451 """ |
4450 |
4452 |
4451 if opts["stdio"]: |
4453 if opts["stdio"] and opts["cmdserver"]: |
|
4454 raise util.Abort(_("cannot use --stdio with --cmdserver")) |
|
4455 |
|
4456 def checkrepo(): |
4452 if repo is None: |
4457 if repo is None: |
4453 raise error.RepoError(_("There is no Mercurial repository here" |
4458 raise error.RepoError(_("There is no Mercurial repository here" |
4454 " (.hg not found)")) |
4459 " (.hg not found)")) |
|
4460 |
|
4461 if opts["stdio"]: |
|
4462 checkrepo() |
4455 s = sshserver.sshserver(ui, repo) |
4463 s = sshserver.sshserver(ui, repo) |
4456 s.serve_forever() |
4464 s.serve_forever() |
|
4465 |
|
4466 if opts["cmdserver"]: |
|
4467 checkrepo() |
|
4468 s = commandserver.server(ui, repo, opts["cmdserver"]) |
|
4469 return s.serve() |
4457 |
4470 |
4458 # this way we can check if something was given in the command-line |
4471 # this way we can check if something was given in the command-line |
4459 if opts.get('port'): |
4472 if opts.get('port'): |
4460 opts['port'] = util.getport(opts.get('port')) |
4473 opts['port'] = util.getport(opts.get('port')) |
4461 |
4474 |