tests/test-hardlinks-safety.t
author Brodie Rao <brodie@bitheap.org>
Sat, 25 Sep 2010 19:38:27 -0500
changeset 12499 596ad02eabe4
parent 12328 b63f6422d2a7
permissions -rw-r--r--
Makefile: remove all .so files during clean This ensures .so files in hgext are cleaned up.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12306
diff changeset
     1
some implementations of cp can't create hardlinks
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     3
  $ cat > cp.py <<EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     4
  > from mercurial import util
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     5
  > import sys
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     6
  > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     7
  > EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     8
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
     9
Test hardlinking outside hg:
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    10
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    11
  $ mkdir x
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    12
  $ echo foo > x/a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    13
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    14
  $ python cp.py x y
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    15
  $ echo bar >> y/a
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    16
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    17
No diff if hardlink:
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    18
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    19
  $ diff x/a y/a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    20
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    21
Test mq hardlinking:
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    22
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    23
  $ echo "[extensions]" >> $HGRCPATH
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    24
  $ echo "mq=" >> $HGRCPATH
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    25
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    26
  $ hg init a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    27
  $ cd a
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    28
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    29
  $ hg qimport -n foo - << EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    30
  > # HG changeset patch
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    31
  > # Date 1 0
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    32
  > diff -r 2588a8b53d66 a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    33
  > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    34
  > +++ b/a	Wed Jul 23 15:54:29 2008 +0200
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    35
  > @@ -0,0 +1,1 @@
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    36
  > +a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    37
  > EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    38
  adding foo to series file
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    39
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    40
  $ hg qpush
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    41
  applying foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    42
  now at: foo
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    43
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    44
  $ cd ..
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    45
  $ python cp.py a b
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    46
  $ cd b
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    47
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    48
  $ hg qimport -n bar - << EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    49
  > # HG changeset patch
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    50
  > # Date 2 0
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    51
  > diff -r 2588a8b53d66 a
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    52
  > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    53
  > +++ b/b	Wed Jul 23 15:54:29 2008 +0200
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    54
  > @@ -0,0 +1,1 @@
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    55
  > +b
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    56
  > EOF
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    57
  adding bar to series file
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    58
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    59
  $ hg qpush
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    60
  applying bar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    61
  now at: bar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    62
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    63
  $ cat .hg/patches/status
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    64
  430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    65
  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    66
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    67
  $ cat .hg/patches/series
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    68
  foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    69
  bar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    70
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    71
  $ cat ../a/.hg/patches/status
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    72
  430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    73
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    74
  $ cat ../a/.hg/patches/series
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    75
  foo
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    76
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    77
Test tags hardlinking:
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    78
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    79
  $ hg qdel -r qbase:qtip
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    80
  patch foo finalized without changeset message
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    81
  patch bar finalized without changeset message
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    82
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    83
  $ hg tag -l lfoo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    84
  $ hg tag foo
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    85
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    86
  $ cd ..
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    87
  $ python cp.py b c
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    88
  $ cd c
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    89
12306
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    90
  $ hg tag -l -r 0 lbar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    91
  $ hg tag -r 0 bar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    92
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    93
  $ cat .hgtags
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    94
  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    95
  430ed4828a74fa4047bc816a25500f7472ab4bfe bar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    96
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    97
  $ cat .hg/localtags
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    98
  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
    99
  430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   100
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   101
  $ cat ../b/.hgtags
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   102
  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   103
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   104
  $ cat ../b/.hg/localtags
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   105
  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
fb10e46c1679 tests: unify test-hardlinks-safety
Adrian Buehlmann <adrian@cadifra.com>
parents: 6920
diff changeset
   106