tests/test-hardlinks.t
author Adrian Buehlmann <adrian@cadifra.com>
Wed, 17 Nov 2010 16:54:30 +0100
changeset 13019 42ac864ed394
parent 12967 70b043405400
child 13034 8cb33163b391
permissions -rw-r--r--
test-hardlinks: add testcase for repo copied with 'cp -al' This patch adds a case to test-hardlinks.t which demonstrates that hardlinks in the working directory are broken up (using 'hg update'). Motivation for this patch: 'hg help clone' shows copying repositories *and* the working directory using 'cp -al', creating hardlinks in the *working directory* too (not just in the store). Note that we can't use 'cp -al' since for example MacOS X doesn't support these options on cp. I'm thus using the same trick as in test-hardlinks-safety.t for creating hardlinks in the working dir.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12967
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     1
  $ cat > nlinks.py <<EOF
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     2
  > import os, sys
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     3
  > for f in sorted(sys.stdin.readlines()):
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     4
  >     f = f[:-1]
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     5
  >     print os.lstat(f).st_nlink, f
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     6
  > EOF
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     7
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     8
  $ nlinksdir()
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     9
  > {
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    10
  >     find $1 -type f | python $TESTTMP/nlinks.py
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    11
  > }
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    12
13019
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    13
Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    14
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    15
  $ cat > linkcp.py <<EOF
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    16
  > from mercurial import util
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    17
  > import sys
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    18
  > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    19
  > EOF
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    20
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    21
  $ linkcp()
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    22
  > {
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    23
  >     python $TESTTMP/linkcp.py $1 $2
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    24
  > }
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
    25
12967
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    26
Prepare repo r1:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    27
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    28
  $ mkdir r1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    29
  $ cd r1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    30
  $ hg init
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    31
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    32
  $ echo c1 > f1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    33
  $ hg add f1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    34
  $ hg ci -m0
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    35
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    36
  $ mkdir d1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    37
  $ cd d1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    38
  $ echo c2 > f2
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    39
  $ hg add f2
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    40
  $ hg ci -m1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    41
  $ cd ../..
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    42
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    43
  $ nlinksdir r1/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    44
  1 r1/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    45
  1 r1/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    46
  1 r1/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    47
  1 r1/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    48
  1 r1/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    49
  1 r1/.hg/store/undo
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    50
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    51
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    52
Create hardlinked clone r2:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    53
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    54
  $ hg clone -U --debug r1 r2
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    55
  linked 7 files
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    56
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    57
Create non-hardlinked clone r3:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    58
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    59
  $ hg clone --pull r1 r3
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    60
  requesting all changes
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    61
  adding changesets
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    62
  adding manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    63
  adding file changes
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    64
  added 2 changesets with 2 changes to 2 files
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    65
  updating to branch default
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    66
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    67
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    68
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    69
Repos r1 and r2 should now contain hardlinked files:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    70
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    71
  $ nlinksdir r1/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    72
  2 r1/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    73
  2 r1/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    74
  2 r1/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    75
  2 r1/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    76
  2 r1/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    77
  1 r1/.hg/store/undo
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    78
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    79
  $ nlinksdir r2/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    80
  2 r2/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    81
  2 r2/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    82
  2 r2/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    83
  2 r2/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    84
  2 r2/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    85
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    86
Repo r3 should not be hardlinked:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    87
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    88
  $ nlinksdir r3/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    89
  1 r3/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    90
  1 r3/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    91
  1 r3/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    92
  1 r3/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    93
  1 r3/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    94
  1 r3/.hg/store/undo
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    95
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    96
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    97
Create a non-inlined filelog in r3:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    98
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    99
  $ cd r3/d1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   100
  $ python -c 'for x in range(10000): print x' >> data1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   101
  $ for j in 0 1 2 3 4 5 6 7 8 9; do
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   102
  >   cat data1 >> f2
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   103
  >   hg commit -m$j
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   104
  > done
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   105
  $ cd ../..
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   106
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   107
  $ nlinksdir r3/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   108
  1 r3/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   109
  1 r3/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   110
  1 r3/.hg/store/data/d1/f2.d
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   111
  1 r3/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   112
  1 r3/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   113
  1 r3/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   114
  1 r3/.hg/store/undo
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   115
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   116
Push to repo r1 should break up most hardlinks in r2:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   117
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   118
  $ hg -R r2 verify
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   119
  checking changesets
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   120
  checking manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   121
  crosschecking files in changesets and manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   122
  checking files
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   123
  2 files, 2 changesets, 2 total revisions
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   124
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   125
  $ cd r3
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   126
  $ hg push
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   127
  pushing to $TESTTMP/r1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   128
  searching for changes
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   129
  adding changesets
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   130
  adding manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   131
  adding file changes
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   132
  added 10 changesets with 10 changes to 1 files
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   133
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   134
  $ cd ..
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   135
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   136
  $ nlinksdir r2/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   137
  1 r2/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   138
  1 r2/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   139
  1 r2/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   140
  2 r2/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   141
  1 r2/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   142
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   143
  $ hg -R r2 verify
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   144
  checking changesets
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   145
  checking manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   146
  crosschecking files in changesets and manifests
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   147
  checking files
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   148
  2 files, 2 changesets, 2 total revisions
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   149
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   150
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   151
  $ cd r1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   152
  $ hg up
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   153
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   154
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   155
Committing a change to f1 in r1 must break up hardlink f1.i in r2:
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   156
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   157
  $ echo c1c1 >> f1
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   158
  $ hg ci -m00
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   159
  $ cd ..
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   160
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   161
  $ nlinksdir r2/.hg/store
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   162
  1 r2/.hg/store/00changelog.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   163
  1 r2/.hg/store/00manifest.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   164
  1 r2/.hg/store/data/d1/f2.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   165
  1 r2/.hg/store/data/f1.i
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   166
  1 r2/.hg/store/fncache
70b043405400 tests: add test-hardlinks.t
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
   167
13019
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   168
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   169
  $ cd r3
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   170
  $ hg tip --template '{rev}:{node|short}\n'
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   171
  11:a6451b6bc41f
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   172
  $ echo bla > f1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   173
  $ hg ci -m1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   174
  $ cd ..
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   175
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   176
Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   177
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   178
  $ linkcp r3 r4
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   179
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   180
r4 has hardlinks in the working dir (not just inside .hg):
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   181
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   182
  $ nlinksdir r4
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   183
  2 r4/.hg/00changelog.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   184
  2 r4/.hg/branch
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   185
  2 r4/.hg/branchheads.cache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   186
  2 r4/.hg/dirstate
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   187
  2 r4/.hg/hgrc
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   188
  2 r4/.hg/last-message.txt
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   189
  2 r4/.hg/requires
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   190
  2 r4/.hg/store/00changelog.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   191
  2 r4/.hg/store/00manifest.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   192
  2 r4/.hg/store/data/d1/f2.d
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   193
  2 r4/.hg/store/data/d1/f2.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   194
  2 r4/.hg/store/data/f1.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   195
  2 r4/.hg/store/fncache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   196
  2 r4/.hg/store/undo
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   197
  2 r4/.hg/tags.cache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   198
  2 r4/.hg/undo.branch
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   199
  2 r4/.hg/undo.desc
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   200
  2 r4/.hg/undo.dirstate
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   201
  2 r4/d1/data1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   202
  2 r4/d1/f2
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   203
  2 r4/f1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   204
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   205
Update back to revision 11 in r4 should break hardlink of file f1:
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   206
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   207
  $ hg -R r4 up 11
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   208
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   209
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   210
  $ nlinksdir r4
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   211
  2 r4/.hg/00changelog.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   212
  1 r4/.hg/branch
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   213
  2 r4/.hg/branchheads.cache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   214
  1 r4/.hg/dirstate
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   215
  2 r4/.hg/hgrc
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   216
  2 r4/.hg/last-message.txt
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   217
  2 r4/.hg/requires
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   218
  2 r4/.hg/store/00changelog.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   219
  2 r4/.hg/store/00manifest.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   220
  2 r4/.hg/store/data/d1/f2.d
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   221
  2 r4/.hg/store/data/d1/f2.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   222
  2 r4/.hg/store/data/f1.i
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   223
  2 r4/.hg/store/fncache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   224
  2 r4/.hg/store/undo
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   225
  2 r4/.hg/tags.cache
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   226
  2 r4/.hg/undo.branch
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   227
  2 r4/.hg/undo.desc
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   228
  2 r4/.hg/undo.dirstate
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   229
  2 r4/d1/data1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   230
  2 r4/d1/f2
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   231
  1 r4/f1
42ac864ed394 test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann <adrian@cadifra.com>
parents: 12967
diff changeset
   232