tests/test-share.t
author Matt Mackall <mpm@selenic.com>
Sat, 17 Sep 2011 14:55:55 -0500
changeset 15129 9b904d679850
parent 15101 a21ccf4412d5
child 15446 c5c9ca3719f9
permissions -rw-r--r--
help: make optlist local to subfunctions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     1
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     2
  $ echo "[extensions]"      >> $HGRCPATH
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     3
  $ echo "share = "          >> $HGRCPATH
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     4
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     5
prepare repo1
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     6
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     7
  $ hg init repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     8
  $ cd repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
     9
  $ echo a > a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    10
  $ hg commit -A -m'init'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    11
  adding a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    12
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    13
share it
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    14
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    15
  $ cd ..
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    16
  $ hg share repo1 repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    17
  updating working directory
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    18
  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
    19
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    20
share shouldn't have a store dir
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    21
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    22
  $ cd repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    23
  $ test -d .hg/store
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    24
  [1]
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    25
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    26
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
    27
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    28
  $ cat .hg/sharedpath; echo
12640
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12487
diff changeset
    29
  $TESTTMP/repo1/.hg
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    30
15101
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    31
trailing newline on .hg/sharedpath is ok
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    32
  $ hg tip -q
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    33
  0:d3873e73d99e
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    34
  $ echo '' >> .hg/sharedpath
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    35
  $ cat .hg/sharedpath
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    36
  $TESTTMP/repo1/.hg
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    37
  $ hg tip -q
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    38
  0:d3873e73d99e
a21ccf4412d5 share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents: 15080
diff changeset
    39
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    40
commit in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    41
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    42
  $ echo a >> a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    43
  $ hg commit -m'change in shared clone'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    44
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    45
check original
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    46
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    47
  $ cd ../repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    48
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    49
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    50
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    51
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    52
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    53
  summary:     change in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    54
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    55
  changeset:   0:d3873e73d99e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    56
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    57
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    58
  summary:     init
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    59
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    60
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    61
  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
    62
  $ cat a             # should be two lines of "a"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    63
  a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    64
  a
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    65
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    66
commit in original
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    67
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    68
  $ echo b > b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    69
  $ hg commit -A -m'another file'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    70
  adding b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    71
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    72
check in shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    73
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    74
  $ cd ../repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    75
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    76
  changeset:   2:c2e0ac586386
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    77
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    78
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    79
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    80
  summary:     another file
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    81
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    82
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    83
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    84
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    85
  summary:     change in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    86
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    87
  changeset:   0:d3873e73d99e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    88
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    89
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    90
  summary:     init
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    91
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    92
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    93
  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
    94
  $ cat b             # should exist with one "b"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    95
  b
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    96
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    97
hg serve shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    98
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    99
  $ 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
   100
  $ cat hg.pid >> $DAEMON_PIDS
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   101
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   102
  200 Script output follows
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   103
  
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
  -rw-r--r-- 4 a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   106
  -rw-r--r-- 2 b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   107
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   108
  
15080
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   109
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   110
test unshare command
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   111
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   112
  $ hg unshare
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   113
  $ test -d .hg/store
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   114
  $ test -f .hg/sharedpath
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   115
  [1]
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   116
  $ hg unshare
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   117
  abort: this is not a shared repo
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   118
  [255]
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   119
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   120
check that a change does not propagate
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   121
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   122
  $ echo b >> b
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   123
  $ hg commit -m'change in unshared'
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   124
  $ cd ../repo1
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   125
  $ hg id -r tip
574dc5d74f9b test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents: 12640
diff changeset
   126
  c2e0ac586386 tip