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

Yuya Nishihara yuya at tcha.org
Sat Jun 28 00:21:29 CDT 2014


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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()
 


More information about the Mercurial-devel mailing list