[PATCH] Per-host remotecmd option in .hgrc (updated)

Dmitry Samersoff dms at samersoff.net
Sat Oct 1 10:25:04 CDT 2011


Matt,

 > Well I can't think of a better solution short of adding a bunch of
 > per-host sections. Can I get you to send a version that amends
 > mercurial/help/config.txt?

Done. see below. English is not a my native language so I don't mind if 
you find a better way to say it.

-Dmitry

===

dsamersoff: Per-host remotecmd option in .hgrc (issue359)

Patch below allows user to setup per-host remotecmd in the .hgrc file
in the form:

[ui]
  remotecmd = /opt/bin/hg
  remotecmd.mircat.net =/opt/csw/bin/hg


It tested for a year in development process and fully compatible with
default behavior.


# HG changeset patch
# User dsamersoff
# Date 1317482370 -14400
# Node ID 0e5321f4676851e43763242d9781448b59f4dc0a
# Parent  8df4166b6f634b305934fdd49c0e0ae64184d4ed

diff -r 8df4166b6f63 -r 0e5321f46768 mercurial/help/config.txt
--- a/mercurial/help/config.txt	Wed Sep 28 16:11:53 2011 -0500
+++ b/mercurial/help/config.txt	Sat Oct 01 19:19:30 2011 +0400
@@ -1058,6 +1058,7 @@

  ``remotecmd``
      remote command to use for clone/push/pull operations. Default is 
``hg``.
+	It's possible to specify per-host remotecmd as remotecmd.hostname

  ``report_untrusted``
      Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
diff -r 8df4166b6f63 -r 0e5321f46768 mercurial/sshrepo.py
--- a/mercurial/sshrepo.py	Wed Sep 28 16:11:53 2011 -0500
+++ b/mercurial/sshrepo.py	Sat Oct 01 19:19:30 2011 +0400
@@ -35,7 +35,9 @@
          self.path = u.path or "."

          sshcmd = self.ui.config("ui", "ssh", "ssh")
-        remotecmd = self.ui.config("ui", "remotecmd", "hg")
+        remotecmd = self.ui.config("ui", "remotecmd.%s" % self.host, None)
+        if remotecmd == None :
+           remotecmd = self.ui.config("ui", "remotecmd", "hg")

          args = util.sshargs(sshcmd, self.host, self.user, self.port)

-- 
Dmitry Samersoff
dms at samersoff.net, http://devnull.samersoff.net
* There will come soft rains  ...


More information about the Mercurial-devel mailing list