tests/test-share.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 09 Jan 2012 03:47:16 +0100
changeset 15837 cd956049fc14
parent 15447 9910f60a37ee
child 16913 f2719b387380
permissions -rw-r--r--
discovery: introduce outgoing object for result of findcommonoutgoing Simplifies client logic in multiple places since it encapsulates the computation of the common and, more importantly, the missing node lists. This also allows an upcomping patch to communicate precomputed versions of these lists to clients.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 15101
diff changeset
     1
  $ "$TESTDIR/hghave" serve || 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
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
   102
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
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