tests/test-hgwebdirsym.t
author Brodie Rao <brodie@bitheap.org>
Thu, 31 Mar 2011 17:37:33 -0700
changeset 13848 b2798c1defff
parent 13066 86888ae9ce90
child 15446 c5c9ca3719f9
permissions -rw-r--r--
url: be stricter about detecting schemes While the URL parser is very forgiving about what characters are allowed in each component, it's useful to be strict about the scheme so we don't accidentally interpret local paths with colons as URLs. This restricts schemes to containing alphanumeric characters, dashes, pluses, and dots (as specified in RFC 2396).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     1
Tests whether or not hgwebdir properly handles various symlink topologies.
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     3
  $ "$TESTDIR/hghave" symlink || exit 80
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     4
  $ hg init a
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     5
  $ echo a > a/a
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     6
  $ hg --cwd a ci -Ama -d'1 0'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     7
  adding a
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     8
  $ mkdir webdir
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
     9
  $ cd webdir
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    10
  $ hg init b
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    11
  $ echo b > b/b
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    12
  $ hg --cwd b ci -Amb -d'2 0'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    13
  adding b
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    14
  $ hg init c
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    15
  $ echo c > c/c
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    16
  $ hg --cwd c ci -Amc -d'3 0'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    17
  adding c
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    18
  $ ln -s ../a al
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    19
  $ ln -s ../webdir circle
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    20
  $ root=`pwd`
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    21
  $ cd ..
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    22
  $ cat > collections.conf <<EOF
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    23
  > [collections]
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    24
  > $root=$root
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    25
  > EOF
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    26
  $ hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf collections.conf \
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    27
  >     -A access-collections.log -E error-collections.log
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    28
  $ cat hg.pid >> $DAEMON_PIDS
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    29
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    30
should succeed
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    31
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    32
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    33
  200 Script output follows
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    34
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    35
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    36
  /al/
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    37
  /b/
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    38
  /c/
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    39
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    40
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/al/file/tip/a?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    41
  200 Script output follows
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    42
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    43
  a
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    44
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    45
  200 Script output follows
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    46
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    47
  b
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    48
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    49
  200 Script output follows
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    50
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    51
  c
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    52
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    53
should fail
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    54
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    55
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/al/file/tip/a?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    56
  404 Not Found
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    57
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    58
  
13066
86888ae9ce90 hgwebdir: fix incorrect index generation for invalid paths (issue2023)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12444
diff changeset
    59
  error: repository circle/al/file/tip/a not found
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    60
  [1]
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    61
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    62
  404 Not Found
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    63
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    64
  
13066
86888ae9ce90 hgwebdir: fix incorrect index generation for invalid paths (issue2023)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12444
diff changeset
    65
  error: repository circle/b/file/tip/a not found
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    66
  [1]
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    67
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    68
  404 Not Found
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    69
  
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    70
  
13066
86888ae9ce90 hgwebdir: fix incorrect index generation for invalid paths (issue2023)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12444
diff changeset
    71
  error: repository circle/c/file/tip/a not found
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    72
  [1]
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    73
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    74
collections errors
6341
63bdfcc3eaaf test: Add tests for webdir symlinks and walkrepos.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    75
12444
a4c19a900794 tests: unify test-hgwebdirsym
Matt Mackall <mpm@selenic.com>
parents: 6341
diff changeset
    76
  $ cat error-collections.log