tests/test-serve.t
author Adrian Buehlmann <adrian@cadifra.com>
Thu, 02 Jun 2011 00:33:33 +0200
changeset 14518 a67e866f46f9
parent 13540 3ecadce9173d
child 15446 c5c9ca3719f9
permissions -rw-r--r--
workingctx: eliminate remove function Inlining it into it's last remaining call place in cmdutil.copy. Note that cmdutil.copy is called with the wlock already held, so no additional locking is needed to call util.unlinkpath. We do not need to wrap the util.unlinkpath call into a try block, because at that point we already know whether abssrc exists or not -- thanks to the preceding util.copyfile call. Adding a new local 'srcexists' in cmdutil.copy for that purpose.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     1
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     2
  $ hgserve()
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     3
  > {
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     4
  >    hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     5
  >        | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     6
  >              -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     7
  >              -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     8
  >    cat hg.pid >> "$DAEMON_PIDS"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
     9
  >    echo % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    10
  >    cat errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    11
  >    sleep 1
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    12
  >    if [ "$KILLQUIETLY" = "Y" ]; then
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    13
  >        kill `cat hg.pid` 2>/dev/null
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    14
  >    else
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    15
  >        kill `cat hg.pid`
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    16
  >    fi
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    17
  >    sleep 1
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    18
  > }
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    19
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    20
  $ hg init test
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    21
  $ cd test
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    22
  $ echo '[web]' > .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    23
  $ echo 'accesslog = access.log' >> .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    24
  $ echo "port = $HGPORT1" >> .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    25
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    26
Without -v
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    27
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    28
  $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    29
  $ cat hg.pid >> "$DAEMON_PIDS"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    30
  $ if [ -f access.log ]; then
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    31
  $     echo 'access log created - .hg/hgrc respected'
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    32
  access log created - .hg/hgrc respected
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    33
  $ fi
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    34
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    35
errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    36
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    37
  $ cat errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    38
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    39
With -v
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    40
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    41
  $ hgserve
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    42
  listening at http://localhost/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    43
  % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    44
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    45
With -v and -p HGPORT2
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    46
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    47
  $ hgserve -p "$HGPORT2"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    48
  listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    49
  % errors
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    50
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    51
With -v and -p daytime (should fail because low port)
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    52
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    53
  $ KILLQUIETLY=Y
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    54
  $ hgserve -p daytime
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    55
  abort: cannot start server at 'localhost:13': Permission denied
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    56
  abort: child process failed to start
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    57
  % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    58
  $ KILLQUIETLY=N
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    59
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    60
With --prefix foo
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
    61
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    62
  $ hgserve --prefix foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    63
  listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    64
  % errors
12076
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
    65
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    66
With --prefix /foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    67
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    68
  $ hgserve --prefix /foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    69
  listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    70
  % errors
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    71
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    72
With --prefix foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    73
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    74
  $ hgserve --prefix foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    75
  listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    76
  % errors
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    77
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    78
With --prefix /foo/
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    79
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    80
  $ hgserve --prefix /foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    81
  listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
    82
  % errors