[PATCH] hg: added --ssh to specify which SSH binary to use

Matt Mackall mpm at selenic.com
Fri Aug 19 14:33:51 CDT 2005


On Fri, Aug 19, 2005 at 10:25:20AM -0700, Perez-Gonzalez, Inaky wrote:
> >From: Matt Mackall [mailto:mpm at selenic.com]
> >
> >I'd rather have this use -e than -S in keeping with rsync and friends.
> 
> ACK, makes a lot of sense.
> 
> >Also, calling repo.ui.config("ui", "ssh", "ssh") to get the default is
> >probably a good idea.
> 
> I'll check on that--where should I hook for it?

In hg.py:sshrepository:__init__.
 
> >> --- a/mercurial/hg.py	Thu Aug 18 02:52:27 2005
> >> +++ b/mercurial/hg.py	Thu Aug 18 20:22:38 2005
> >[...]
> >> +import commands
> >
> >Eep! It'd be better to pass a set of options when creating a repo
> object.
> 
> Links to the the previous.

Make hg.py:repository() take an **opts arg and pass it down to
sshrepository.

Then in commands.py:push(), pass ssh=x to the function that creates
the 'other' object.

Hmmm, there won't be many of these repo options, so that's probably
uglier than it needs to be..

Or we can instead pass it through the ui object, which is probably a
slightly cleaner way of passing random options around. In this
approach, we'd do something like:

class ui:
  def __init__(...)
    ...
    self.overlay = {}

  def setconfig(self, section, key, val):
    self.overlay[(section, key)] = val

  def config(self, section, key, default):
    # is this in the overlay?
    if self.overlay.has_key((section, key)):
        return self.overlay[(section, key)]
    ...


And that would make for a generally useful mechanism all over.

> I won't have time to redo the hack until next week. I'll need more 
> help on getting it right :)

For a first attempt, it was pretty good. You didn't even use
semicolons.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list