Source

hgopenurl / tests / test-showurl.t

Full commit
Setup infrastructure:

  $ export HGRCPATH=$PWD/hgrc
  $ cat > $HGRCPATH <<EOF
  > [extensions]
  > hgopenurl = $TESTDIR/../hgopenurl
  > EOF

  $ setdefault() {
  >   echo "[paths]\ndefault = $1\n" > .hg/hgrc
  > }
  $ testurl() {
  >   setdefault $1
  >   hg showurl
  > }
  $ testrev() {
  >   setdefault $1
  >   hg showurl -r deadbeef
  > }

  $ hg init testrepo
  $ cd testrepo
  $ setdefault http://bitbucket.org/xxx/yyy

BitBucket URLs

  $ testurl http://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl https://bitbucket.org/xxx/yyy
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl https://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://bitbucket.org/xxx/yyy
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://hg@bitbucket.org/xxx/yyy
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://hg@bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changesets

Ditto, with revision

  $ testrev ssh://hg@bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changeset/deadbeef
  $ testrev http://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/changeset/deadbeef

Ditto, with filename

  $ hg showurl kaflaflibob ssh://hg@bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/src/default/kaflaflibob
  $ hg showurl kaflaflibob http://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/src/default/kaflaflibob

Ditto, with filename & revision

  $ hg showurl -r 42 kaflaflibob ssh://hg@bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/src/42/kaflaflibob?rev=42
  $ hg showurl -r 42 kaflaflibob http://bitbucket.org/xxx/yyy/
  https://bitbucket.org/xxx/yyy/src/42/kaflaflibob?rev=42

BitBucket MQ URLs

  $ testurl http://bitbucket.org/xxx/yyy/.hg/patches/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl https://bitbucket.org/xxx/yyy/.hg/patches
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl https://bitbucket.org/xxx/yyy/.hg/patches/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://bitbucket.org/xxx/yyy/.hg/patches
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://bitbucket.org/xxx/yyy/.hg/patches/
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://hg@bitbucket.org/xxx/yyy/.hg/patches
  https://bitbucket.org/xxx/yyy/changesets
  $ testurl ssh://hg@bitbucket.org/xxx/yyy/.hg/patches/
  https://bitbucket.org/xxx/yyy/changesets

Google Code URLs

  $ testurl http://xxx.googlecode.com/hg
  https://code.google.com/p/xxx/source/list
  $ testurl http://xxx.googlecode.com/hg/
  https://code.google.com/p/xxx/source/list
  $ testurl https://xxx.googlecode.com/hg
  https://code.google.com/p/xxx/source/list
  $ testurl https://xxx.googlecode.com/hg/
  https://code.google.com/p/xxx/source/list

Ditto, with revision

  $ testrev http://xxx.googlecode.com/hg
  https://code.google.com/p/xxx/source/detail?r=deadbeef

Ditto, with filename

  $ hg showurl kaflaflibob http://xxx.googlecode.com/hg
  https://code.google.com/p/xxx/source/browse/kaflaflibob

Ditto, with filename & revision

  $ hg showurl -r 42 kaflaflibob http://xxx.googlecode.com/hg
  https://code.google.com/p/xxx/source/browse/kaflaflibob?rev=42

Pseudo-hgweb URLs

  $ testurl http://xxx
  http://xxx
  $ testurl http://xxx/
  http://xxx
  $ testurl https://xxx
  https://xxx
  $ testurl https://xxx/
  https://xxx

Ditto, with revision

  $ testrev http://xxx
  http://xxx/rev/deadbeef
  $ testrev https://xxx/
  https://xxx/rev/deadbeef

Ditto, with revision

  $ hg openurl -r 42 http://xxx
  $ hg openurl -r 42  https://xxx/

We can't do these

  $ testurl ssh://xxx/
  abort: don't know how to convert regular SSH repositories into an web address
  [255]
  $ testurl ssh://xxx/
  abort: don't know how to convert regular SSH repositories into an web address
  [255]
  $ testurl file:///xxx/
  abort: unsupported URL schema for path 'file:///xxx/'
  [255]
  $ testurl /xxx
  abort: unsupported URL schema for path '/xxx'
  [255]