changeset 961:3e11d5038649

Add --ssh and --remotecmd to push This uses the new setconfig options passing mechanism
author mpm@selenic.com
date Fri, 19 Aug 2005 21:36:57 -0800
parents abfb5cc97fcd
children 5730e90c025b
files mercurial/commands.py mercurial/hg.py
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Aug 19 21:25:25 2005 -0800
+++ b/mercurial/commands.py	Fri Aug 19 21:36:57 2005 -0800
@@ -926,11 +926,16 @@
 
     return r
 
-def push(ui, repo, dest="default-push", force=False):
+def push(ui, repo, dest="default-push", force=False, ssh=None, remotecmd=None):
     """push changes to the specified destination"""
     dest = ui.expandpath(dest)
     ui.status('pushing to %s\n' % (dest))
 
+    if ssh:
+        ui.setconfig("ui", "ssh", ssh)
+    if remotecmd:
+        ui.setconfig("ui", "remotecmd", remotecmd)
+
     other = hg.repository(ui, dest)
     r = repo.push(other, force)
     return r
@@ -1339,7 +1344,9 @@
          'hg pull [-u] [SOURCE]'),
     "^push":
         (push,
-         [('f', 'force', None, 'force push')],
+         [('f', 'force', None, 'force push'),
+          ('e', 'ssh', "", 'ssh command'),
+          ('', 'remotecmd', "", 'remote hg command')],
          'hg push [-f] [DEST]'),
     "rawcommit":
         (rawcommit,
--- a/mercurial/hg.py	Fri Aug 19 21:25:25 2005 -0800
+++ b/mercurial/hg.py	Fri Aug 19 21:36:57 2005 -0800
@@ -2106,8 +2106,10 @@
         if not path:
             raise RepoError("no remote repository path specified")
 
-        cmd = "ssh %s 'hg -R %s serve --stdio'"
-        cmd = cmd % (args, path)
+        sshcmd = self.ui.config("ui", "ssh", "ssh")
+        remotecmd = self.ui.config("ui", "remotecmd", "hg")
+        cmd = "%s %s '%s -R %s serve --stdio'"
+        cmd = cmd % (sshcmd, args, remotecmd, path)
 
         self.pipeo, self.pipei, self.pipee = os.popen3(cmd)