diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1192,7 +1192,7 @@ def clone(ui, source, dest=None, **opts) Source patch repository is looked for in /.hg/patches by default. Use -p to change. ''' - ui.setconfig_remoteopts(**opts) + commands.setremoteconfig(**opts) if dest is None: dest = hg.defaultdest(source) sr = hg.repository(ui, ui.expandpath(source)) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -547,6 +547,13 @@ def show_changeset(ui, repo, opts): return t return changeset_printer(ui, repo) +def setremoteconfig(ui, opts): + "copy remote options to ui tree" + if opts.get('ssh'): + ui.setconfig("ui", "ssh", opts['ssh']) + if opts.get('remotecmd'): + ui.setconfig("ui", "remotecmd", opts['remotecmd']) + def show_version(ui): """output version and copyright information""" ui.write(_("Mercurial Distributed SCM (version %s)\n") @@ -981,7 +988,7 @@ def clone(ui, source, dest=None, **opts) .hg/hgrc will be created on the remote side. Look at the help text for the pull command for important details about ssh:// URLs. """ - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) hg.clone(ui, ui.expandpath(source), dest, pull=opts['pull'], stream=opts['uncompressed'], @@ -1826,7 +1833,7 @@ def incoming(ui, repo, source="default", See pull for valid source format details. """ source = ui.expandpath(source) - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) other = hg.repository(ui, source) incoming = repo.findincoming(other, force=opts["force"]) @@ -1882,7 +1889,7 @@ def init(ui, dest=".", **opts): Look at the help text for the pull command for important details about ssh:// URLs. """ - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) hg.repository(ui, dest, create=1) def locate(ui, repo, *pats, **opts): @@ -2060,7 +2067,7 @@ def outgoing(ui, repo, dest=None, **opts See pull for valid destination format details. """ dest = ui.expandpath(dest or 'default-push', dest or 'default') - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) revs = None if opts['rev']: revs = [repo.lookup(rev) for rev in opts['rev']] @@ -2182,7 +2189,7 @@ def pull(ui, repo, source="default", **o with the --ssh command line option. """ source = ui.expandpath(source) - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) other = hg.repository(ui, source) ui.status(_('pulling from %s\n') % (source)) @@ -2220,7 +2227,7 @@ def push(ui, repo, dest=None, **opts): feature is enabled on the remote Mercurial server. """ dest = ui.expandpath(dest or 'default-push', dest or 'default') - ui.setconfig_remoteopts(**opts) + setremoteconfig(ui, opts) other = hg.repository(ui, dest) ui.status('pushing to %s\n' % (dest)) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -217,12 +217,6 @@ class ui(object): path = self.config("paths", default) return path or loc - def setconfig_remoteopts(self, **opts): - if opts.get('ssh'): - self.setconfig("ui", "ssh", opts['ssh']) - if opts.get('remotecmd'): - self.setconfig("ui", "remotecmd", opts['remotecmd']) - def write(self, *args): if self.header: if self.header != self.prev_header: