[RFC] [PATCH] rewrite host.name:path as ssh://host.name/path
Peter Arrenbrecht
peter.arrenbrecht at gmail.com
Tue Mar 18 09:47:21 UTC 2008
On Tue, Mar 18, 2008 at 10:14 AM, Alexis S. L. Carvalho
<alexis at cecm.usp.br> wrote:
> Thus spake Peter Arrenbrecht:
>
> > On Tue, Mar 18, 2008 at 8:40 AM, Alexis S. L. Carvalho
> > <alexis at cecm.usp.br> wrote:
> > > People often ask why "hg push user at example.com:path/to/repo"
> > > doesn't work. Here's a patch that makes it work.
> > >
> > > Basic heuristic: if we couldn't find the scheme (http/file/ssh/...),
> > > there's a colon after the second character (to avoid problems with drive
> > > letters on windows), there's no os.sep before the colon and the path
> > > doesn't exist, assume it's a "hostname:path" ssh repo and translate it
> > > into ssh://hostname/path .
> > >
> > > To specify the port, you'll have to use the current URL syntax.
> >
> > Hmm. Wouldn't it be better in the long run if instead you encouraged
> > people to use proper URLs? This will become part of the public API.
>
> The goal of the patch is to make things easier for users. The
> "hostname:path" syntax is much more common than ssh://... and people
> still trip over the double slash thingie (and I'm not even sure that the
> RFC(?) that recommended it is still valid).
>
> And I have some vague memories that an "ssh://" URL was supposed to mean
> "open a shell in that machine" without specifying what should happen
> when there's a path.
>
> So it's not like ssh:// is a standard.
I'm not saying it's a standard. I'm saying it's defined in the context
of hg without any guesswork.
> > So
> > your detection logic could be used to guess they meant ssh:// and give
> > them a hint. Could also give them a hint for .hgrc [paths] at the same
> > time in case they're bothered by the long URLs.
>
> I always find it "funny" when a program tells me "Hi! You said 'foo',
> but I'm pretty sure you meant 'bar'. If you really wanted 'bar', say
> 'bar', OK?" and then fails with some kind of "invalid use of 'foo'"
> error. I.e. it's confident enough that I meant 'bar' to go through the
> trouble of showing me that message, but not enough to actually use
> 'bar'. That's fine when there could be catastrophic consequences, but I
> don't think that's the case here.
Sure, that bugs me too. But I really think guessing is ok when facing
a user, but less desirable when it ends up in scripts and whatnot,
meaning it's going to be very hard to change. Can we distinguish this
here? I doubt it.
Anyway, just my 2 cents.
-peo
More information about the Mercurial-devel
mailing list