Patchwork [3,of,3] serve: unify cmdutil.service() calls of commandserver and hgweb

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 24, 2015, 1:53 p.m.
Message ID <3cda2a60ab931e628db0.1448373188@mimosa>
Download mbox | patch
Permalink /patch/11603/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 24, 2015, 1:53 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1446297425 -32400
#      Sat Oct 31 22:17:05 2015 +0900
# Node ID 3cda2a60ab931e628db00ea1995f3ef98db80ac0
# Parent  5b13304492f867291e0c8e09f6117e9e69b7d6af
serve: unify cmdutil.service() calls of commandserver and hgweb
Pierre-Yves David - Dec. 1, 2015, 8:09 a.m.
On 11/24/2015 05:53 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1446297425 -32400
> #      Sat Oct 31 22:17:05 2015 +0900
> # Node ID 3cda2a60ab931e628db00ea1995f3ef98db80ac0
> # Parent  5b13304492f867291e0c8e09f6117e9e69b7d6af
> serve: unify cmdutil.service() calls of commandserver and hgweb

Nice cleanup. pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5940,10 +5940,9 @@  def serve(ui, repo, **opts):
     if opts["cmdserver"]:
         import commandserver
         service = commandserver.createservice(ui, repo, opts)
-        return cmdutil.service(opts, initfn=service.init, runfn=service.run)
-
-    service = hgweb.createservice(ui, repo, opts)
-    cmdutil.service(opts, initfn=service.init, runfn=service.run)
+    else:
+        service = hgweb.createservice(ui, repo, opts)
+    return cmdutil.service(opts, initfn=service.init, runfn=service.run)
 
 @command('^status|st',
     [('A', 'all', None, _('show status of all files')),