tests/test-share.t
author Adrian Buehlmann <adrian@cadifra.com>
Thu, 02 Jun 2011 00:33:33 +0200
changeset 14518 a67e866f46f9
parent 12640 6cc4b14fb76b
child 15080 574dc5d74f9b
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:
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
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    31
commit in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    32
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    33
  $ echo a >> a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    34
  $ hg commit -m'change in shared clone'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    35
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    36
check original
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    37
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    38
  $ cd ../repo1
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    39
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    40
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    41
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    42
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    43
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    44
  summary:     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
  changeset:   0:d3873e73d99e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    47
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    48
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    49
  summary:     init
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    50
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    51
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    52
  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
    53
  $ cat a             # should be two lines of "a"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    54
  a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    55
  a
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    56
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    57
commit in original
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    58
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    59
  $ echo b > b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    60
  $ hg commit -A -m'another file'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    61
  adding b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    62
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    63
check in shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    64
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    65
  $ cd ../repo2
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    66
  $ hg log
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    67
  changeset:   2:c2e0ac586386
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    68
  tag:         tip
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    69
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    70
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    71
  summary:     another file
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
  changeset:   1:8af4dc49db9e
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    74
  user:        test
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    75
  date:        Thu Jan 01 00:00:00 1970 +0000
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    76
  summary:     change in shared clone
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    77
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    78
  changeset:   0:d3873e73d99e
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:     init
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
  $ hg update
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    84
  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
    85
  $ cat b             # should exist with one "b"
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    86
  b
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    87
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    88
hg serve shared clone
9990
c1d940d31aea share: add a test script.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    89
12487
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    90
  $ 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
    91
  $ cat hg.pid >> $DAEMON_PIDS
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    92
  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    93
  200 Script output follows
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    94
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    95
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    96
  -rw-r--r-- 4 a
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    97
  -rw-r--r-- 2 b
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    98
  
9792013e2f53 tests: unify test-share
Matt Mackall <mpm@selenic.com>
parents: 10468
diff changeset
    99