[RFC] [PATCH] rewrite host.name:path as ssh://host.name/path

Alexis S. L. Carvalho alexis at cecm.usp.br
Tue Mar 18 04:14:51 CDT 2008


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.

>                                                                     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.

Alexis


More information about the Mercurial-devel mailing list