tests/test-share.t
author Martin Geisler <martin@geisler.net>
Sat, 19 Apr 2014 19:53:46 +0200
branchstable
changeset 21165 fde46c534935
parent 17539 bc7377160fa7
child 22046 7a9cbb315d84
permissions -rw-r--r--
obsolete: let N denote number of obsoleted changestes in a marker The number of obsoleted changesets is referred to as N later in the docstring.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17539
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
     1
  $ "$TESTDIR/hghave" killdaemons || exit 80
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     2
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     3
  $ echo "[extensions]"      >> $HGRCPATH
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     4
  $ echo "share = "          >> $HGRCPATH
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     5
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     6
prepare repo1
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     7
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     8
  $ hg init repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     9
  $ cd repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    10
  $ echo a > a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    11
  $ hg commit -A -m'init'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    12
  adding a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    13
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    14
share it
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    15
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    16
  $ cd ..
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    17
  $ hg share repo1 repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    18
  updating working directory
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    19
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    20
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    21
share shouldn't have a store dir
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    22
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    23
  $ cd repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    24
  $ test -d .hg/store
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    25
  [1]
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    26
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    27
Some sed versions appends newline, some don't, and some just fails
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    28
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    29
  $ cat .hg/sharedpath; echo
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 15446
diff changeset
    30
  $TESTTMP/repo1/.hg (glob)
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    31
15101
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    32
trailing newline on .hg/sharedpath is ok
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    33
  $ hg tip -q
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    34
  0:d3873e73d99e
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    35
  $ echo '' >> .hg/sharedpath
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    36
  $ cat .hg/sharedpath
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 15446
diff changeset
    37
  $TESTTMP/repo1/.hg (glob)
15101
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    38
  $ hg tip -q
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    39
  0:d3873e73d99e
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    40
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    41
commit in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    42
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    43
  $ echo a >> a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    44
  $ hg commit -m'change in shared clone'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    45
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    46
check original
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    47
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    48
  $ cd ../repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    49
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    50
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    51
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    52
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    53
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    54
  summary:     change in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    55
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    56
  changeset:   0:d3873e73d99e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    57
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    58
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    59
  summary:     init
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    60
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    61
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    62
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    63
  $ cat a             # should be two lines of "a"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    64
  a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    65
  a
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    66
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    67
commit in original
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    68
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    69
  $ echo b > b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    70
  $ hg commit -A -m'another file'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    71
  adding b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    72
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    73
check in shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    74
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    75
  $ cd ../repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    76
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    77
  changeset:   2:c2e0ac586386
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    78
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    79
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    80
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    81
  summary:     another file
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    82
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    83
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    84
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    85
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    86
  summary:     change in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    87
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    88
  changeset:   0:d3873e73d99e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    89
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    90
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    91
  summary:     init
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    92
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    93
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    94
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    95
  $ cat b             # should exist with one "b"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    96
  b
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    97
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    98
hg serve shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    99
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   100
  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   101
  $ cat hg.pid >> $DAEMON_PIDS
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
   102
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'raw-file/'
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   103
  200 Script output follows
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   104
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   105
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   106
  -rw-r--r-- 4 a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   107
  -rw-r--r-- 2 b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   108
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   109
  
15080
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   110
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   111
test unshare command
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   112
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   113
  $ hg unshare
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   114
  $ test -d .hg/store
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   115
  $ test -f .hg/sharedpath
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   116
  [1]
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   117
  $ hg unshare
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   118
  abort: this is not a shared repo
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   119
  [255]
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   120
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   121
check that a change does not propagate
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   122
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   123
  $ echo b >> b
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   124
  $ hg commit -m'change in unshared'
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   125
  $ cd ../repo1
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   126
  $ hg id -r tip
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   127
  c2e0ac586386 tip
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15447
diff changeset
   128
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15447
diff changeset
   129
  $ cd ..
17539
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
   130
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
   131
Explicitly kill daemons to let the test exit on Windows
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
   132
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
   133
  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
bc7377160fa7 tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
   134