Patchwork [1,of,2] serve: inline checkrepo() that is used only when --stdio is specified

login
register
mail settings
Submitter Yuya Nishihara
Date June 28, 2014, 5:21 a.m.
Message ID <6731d8fb2833b07c8551.1403932889@mimosa>
Download mbox | patch
Permalink /patch/5074/
State Accepted
Commit 448714b79d9af242e592d9d2d6736a1bf84c9460
Headers show

Comments

Yuya Nishihara - June 28, 2014, 5:21 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1398941683 -32400
#      Thu May 01 19:54:43 2014 +0900
# Node ID 6731d8fb2833b07c8551fb1334d343898dccac19
# Parent  212955411633acbe7ace88f22565ce17d85ec8c5
serve: inline checkrepo() that is used only when --stdio is specified

Since e811b93f2cb1, --cmdserver is allowed to start without repository, so
checkrepo() function is meaningless.
Pierre-Yves David - June 28, 2014, 10:16 a.m.
On 06/28/2014 07:21 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1398941683 -32400
> #      Thu May 01 19:54:43 2014 +0900
> # Node ID 6731d8fb2833b07c8551fb1334d343898dccac19
> # Parent  212955411633acbe7ace88f22565ce17d85ec8c5
> serve: inline checkrepo() that is used only when --stdio is specified

Those two are pushed to clowcopter, thanks.

(queued)

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5245,13 +5245,10 @@  def serve(ui, repo, **opts):
     if opts["stdio"] and opts["cmdserver"]:
         raise util.Abort(_("cannot use --stdio with --cmdserver"))
 
-    def checkrepo():
+    if opts["stdio"]:
         if repo is None:
             raise error.RepoError(_("there is no Mercurial repository here"
                               " (.hg not found)"))
-
-    if opts["stdio"]:
-        checkrepo()
         s = sshserver.sshserver(ui, repo)
         s.serve_forever()