darcs-2.18.3: a distributed, interactive, smart revision control system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.Util.URL

Description

Path resolving:

  • An http URL contains the sequence "http(s)://".
  • A local filepath does not contain colons, except as second character (windows drives) when this filepath is meant to be used as repository name
  • A path that is neither an http URL nor a local file is an ssh-path.

Examples:

/usr/repo/foo                 -- local file
c:/src/darcs                  -- local file
http://darcs.net/             -- URL
peter@host:/path              -- ssh
droundy@host:                 -- ssh
host:/path                    -- ssh

This means that single-letter hosts in ssh-paths do not work, unless a username is provided.

Perhaps ssh-paths should use "ssh://user@host/path"-syntax instead?

TODO: This whole module should be re-written using a regex matching library! The way we do this here is error-prone and inefficient.

Synopsis

Documentation

splitSshUrl :: String -> SshFilePath Source #

Given an ssh URL or file path, split it into user@host, repodir, and the file (with any _darcs/ prefix removed)

sshCanonRepo :: SshFilePath -> String Source #

Return a canonical representation of an SSH repo in the format uhost:path Notably, this means the returned string does not contain: - an "ssh://" prefix - any redundant slashes (including all trailing ones)