[PATCH 2 of 2] commands: break import cycle
Augie Fackler
raf at durin42.com
Tue Aug 11 14:41:07 CDT 2015
On Sat, Aug 08, 2015 at 04:32:16PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1439069439 25200
> # Sat Aug 08 14:30:39 2015 -0700
> # Node ID 526f635d185f6dc33579c80ad31ee74f64735d13
> # Parent 9c8e6fd8ca8285cb629e4a9ebd9cfe50b6537472
> commands: break import cycle
queued these, thanks
>
> This was the easiest link in the chain to break as there was only
> one use of commandserver in commands.py. Other files had multiple
> users.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -12,9 +12,9 @@ import os, re, difflib, time, tempfile,
> import sys, socket
> import hg, scmutil, util, revlog, copies, error, bookmarks
> import patch, help, encoding, templatekw, discovery
> import archival, changegroup, cmdutil, hbisect
> -import sshserver, hgweb, commandserver
> +import sshserver, hgweb
> import extensions
> from hgweb import server as hgweb_server
> import merge as mergemod
> import minirst, revset, fileset
> @@ -5712,8 +5712,9 @@ def serve(ui, repo, **opts):
> s = sshserver.sshserver(ui, repo)
> s.serve_forever()
>
> if opts["cmdserver"]:
> + import commandserver
> service = commandserver.createservice(ui, repo, opts)
> return cmdutil.service(opts, initfn=service.init, runfn=service.run)
>
> # this way we can check if something was given in the command-line
> diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
> --- a/tests/test-module-imports.t
> +++ b/tests/test-module-imports.t
> @@ -127,6 +127,5 @@ these may expose other cycles.
> mercurial/ui.py mixed imports
> stdlib: formatter
> relative: config, error, progress, scmutil, util
> Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
> - Import cycle: mercurial.commands -> mercurial.commandserver -> mercurial.dispatch -> mercurial.commands
> [1]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list