[PATCH 1 of 1] url: added support for scp/rsync style URLs for ssh

Martin Geisler mg at aragost.com
Thu Apr 7 02:54:24 CDT 2011


Brodie Rao <brodie at bitheap.org> writes:

> On Apr 6, 2011, at 6:36 AM, Thomas Arendsen Hein wrote:
>
>> +                not ('/' in parts[0] or '\\' in parts[0]) and
>> +                (not parts[1] or parts[1].startswith('//'))):
>
> Would it be simpler to do some or all of this in a regular expression?

Personally, I prefer 'x in s' and 's.startswith(x)' style tests over a
clever regular expression. Here I would probably push the 'not' into the
parenthesis so that the full expression becomes:

  if (parts[0] != 'file' and
      '/' not in parts[0] and
      '\\' not in parts[0] and
      (not parts[1] or parts[1].startswith('//'))):

(if I got it right)

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list