serve: fix port config
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Wed, 10 Mar 2010 22:27:42 +0100
changeset 10635 27027bee318e
parent 10634 768c76f0b4c8
child 10636 23ab3b05bd66
serve: fix port config
mercurial/commands.py
--- a/mercurial/commands.py	Wed Mar 10 22:07:38 2010 +0100
+++ b/mercurial/commands.py	Wed Mar 10 22:27:42 2010 +0100
@@ -2881,6 +2881,10 @@
         s = sshserver.sshserver(ui, repo)
         s.serve_forever()
 
+    # this way we can check if something was given in the command-line
+    if opts.get('port'):
+        opts['port'] = int(opts.get('port'))
+
     baseui = repo and repo.baseui or ui
     optlist = ("name templates style address port prefix ipv6"
                " accesslog errorlog webdir_conf certificate encoding")
@@ -3781,7 +3785,8 @@
           ('d', 'daemon', None, _('run server in background')),
           ('', 'daemon-pipefds', '', _('used internally by daemon mode')),
           ('E', 'errorlog', '', _('name of error log file to write to')),
-          ('p', 'port', 8000, _('port to listen on')),
+          # use string type, then we can check if something was passed
+          ('p', 'port', '', _('port to listen on (default: 8000')),
           ('a', 'address', '',
            _('address to listen on (default: all interfaces)')),
           ('', 'prefix', '',