Patchwork serve: No 'listening at' line when port specified (issue 3976)

login
register
mail settings
Submitter Anurag Goel
Date Feb. 19, 2014, 7:27 p.m.
Message ID <fdb4852286de396687f9.1392838040@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/3698/
State Superseded
Headers show

Comments

Anurag Goel - Feb. 19, 2014, 7:27 p.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1392837899 -19800
#      Thu Feb 20 00:54:59 2014 +0530
# Node ID fdb4852286de396687f9fdbbb5ffadb376ca8394
# Parent  76c749d59a82462328f194708c63259d61fc32f1
serve: No 'listening at' line when port specified (issue 3976)

When port is specified in "hg serve" command,then there is no listening.
This problem arise when ui.verbose is not configured which simply return the function value in mid-way.
By the writing this "ui.verbose condition" at the end of function lets function callee to go through whole function.
Now it gives message to the user "listening at port some number".
I run the test suite.Its working fine except that new line when port is specified.
We need to add one line in test suite wherever port is specified.
David Soria Parra - Feb. 19, 2014, 7:41 p.m.
On 2/19/14, 11:27 AM, "Anurag Goel" <anurag.dsps@gmail.com> wrote:

>diff -r 76c749d59a82 -r fdb4852286de mercurial/commands.py
>--- a/mercurial/commands.py	Sat Feb 15 23:58:54 2014 +0530
>+++ b/mercurial/commands.py	Thu Feb 20 00:54:59 2014 +0530
>@@ -5232,9 +5232,6 @@
>         util.setsignalhandler()
>         self.httpd = hgweb_server.create_server(self.ui, self.app)
> 
>-        if self.opts['port'] and not self.ui.verbose:
>-            return
>-
>         if self.httpd.prefix:
>             prefix = self.httpd.prefix.strip('/') + '/'
>         else:
>@@ -5260,6 +5257,9 @@
>         write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
>               (fqaddr, port, prefix, bindaddr, self.httpd.port))
> 
>+        if self.opts['port'] and not self.ui.verbose:
>+            return
>+

you are making this a no-op. Remove the last part of the patch, there is
no use to adding a bogus return statement at the end.

I am not sure if we want to remove the condition at all, but for
consistency I would say we should always display
the listening at, even when we specified a port.
Anurag Goel - Feb. 19, 2014, 8:08 p.m.
Yes, you are right. There is no of use last statement.
Don't know how did I miss this thing.
I will erase the last statement and send the revision version of this
again.


On Thu, Feb 20, 2014 at 1:11 AM, David Soria Parra <davidsp@fb.com> wrote:

>
>
> On 2/19/14, 11:27 AM, "Anurag Goel" <anurag.dsps@gmail.com> wrote:
>
> >diff -r 76c749d59a82 -r fdb4852286de mercurial/commands.py
> >--- a/mercurial/commands.py    Sat Feb 15 23:58:54 2014 +0530
> >+++ b/mercurial/commands.py    Thu Feb 20 00:54:59 2014 +0530
> >@@ -5232,9 +5232,6 @@
> >         util.setsignalhandler()
> >         self.httpd = hgweb_server.create_server(self.ui, self.app)
> >
> >-        if self.opts['port'] and not self.ui.verbose:
> >-            return
> >-
> >         if self.httpd.prefix:
> >             prefix = self.httpd.prefix.strip('/') + '/'
> >         else:
> >@@ -5260,6 +5257,9 @@
> >         write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
> >               (fqaddr, port, prefix, bindaddr, self.httpd.port))
> >
> >+        if self.opts['port'] and not self.ui.verbose:
> >+            return
> >+
>
> you are making this a no-op. Remove the last part of the patch, there is
> no use to adding a bogus return statement at the end.
>
> I am not sure if we want to remove the condition at all, but for
> consistency I would say we should always display
> the listening at, even when we specified a port.
>
>

Patch

diff -r 76c749d59a82 -r fdb4852286de mercurial/commands.py
--- a/mercurial/commands.py	Sat Feb 15 23:58:54 2014 +0530
+++ b/mercurial/commands.py	Thu Feb 20 00:54:59 2014 +0530
@@ -5232,9 +5232,6 @@ 
         util.setsignalhandler()
         self.httpd = hgweb_server.create_server(self.ui, self.app)
 
-        if self.opts['port'] and not self.ui.verbose:
-            return
-
         if self.httpd.prefix:
             prefix = self.httpd.prefix.strip('/') + '/'
         else:
@@ -5260,6 +5257,9 @@ 
         write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
               (fqaddr, port, prefix, bindaddr, self.httpd.port))
 
+        if self.opts['port'] and not self.ui.verbose:
+            return
+
     def run(self):
         self.httpd.serve_forever()