tests/test-hardlinks-safety.t
changeset 12306 fb10e46c1679
parent 6920 7e5e13bee8f4
child 12328 b63f6422d2a7
equal deleted inserted replaced
12305:fd78997d1e6b 12306:fb10e46c1679
       
     1 
       
     2 # some implementations of cp can't create hardlinks
       
     3   $ cat > cp.py <<EOF
       
     4   > from mercurial import util
       
     5   > import sys
       
     6   > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
       
     7   > EOF
       
     8 
       
     9 Test hardlinking outside hg:
       
    10 
       
    11   $ mkdir x
       
    12   $ echo foo > x/a
       
    13 
       
    14   $ python cp.py x y
       
    15   $ echo bar >> y/a
       
    16 
       
    17 No diff if hardlink:
       
    18 
       
    19   $ diff x/a y/a
       
    20 
       
    21 Test mq hardlinking:
       
    22 
       
    23   $ echo "[extensions]" >> $HGRCPATH
       
    24   $ echo "mq=" >> $HGRCPATH
       
    25 
       
    26   $ hg init a
       
    27   $ cd a
       
    28 
       
    29   $ hg qimport -n foo - << EOF
       
    30   > # HG changeset patch
       
    31   > # Date 1 0
       
    32   > diff -r 2588a8b53d66 a
       
    33   > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
    34   > +++ b/a	Wed Jul 23 15:54:29 2008 +0200
       
    35   > @@ -0,0 +1,1 @@
       
    36   > +a
       
    37   > EOF
       
    38   adding foo to series file
       
    39 
       
    40   $ hg qpush
       
    41   applying foo
       
    42   now at: foo
       
    43 
       
    44   $ cd ..
       
    45   $ python cp.py a b
       
    46   $ cd b
       
    47 
       
    48   $ hg qimport -n bar - << EOF
       
    49   > # HG changeset patch
       
    50   > # Date 2 0
       
    51   > diff -r 2588a8b53d66 a
       
    52   > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
    53   > +++ b/b	Wed Jul 23 15:54:29 2008 +0200
       
    54   > @@ -0,0 +1,1 @@
       
    55   > +b
       
    56   > EOF
       
    57   adding bar to series file
       
    58 
       
    59   $ hg qpush
       
    60   applying bar
       
    61   now at: bar
       
    62 
       
    63   $ cat .hg/patches/status
       
    64   430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
       
    65   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
       
    66 
       
    67   $ cat .hg/patches/series
       
    68   foo
       
    69   bar
       
    70 
       
    71   $ cat ../a/.hg/patches/status
       
    72   430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
       
    73 
       
    74   $ cat ../a/.hg/patches/series
       
    75   foo
       
    76 
       
    77 Test tags hardlinking:
       
    78 
       
    79   $ hg qdel -r qbase:qtip
       
    80   patch foo finalized without changeset message
       
    81   patch bar finalized without changeset message
       
    82 
       
    83   $ hg tag -l lfoo
       
    84   $ hg tag foo
       
    85 
       
    86   $ cd ..
       
    87   $ python cp.py b c
       
    88   $ cd c
       
    89 
       
    90   $ hg tag -l -r 0 lbar
       
    91   $ hg tag -r 0 bar
       
    92 
       
    93   $ cat .hgtags
       
    94   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
       
    95   430ed4828a74fa4047bc816a25500f7472ab4bfe bar
       
    96 
       
    97   $ cat .hg/localtags
       
    98   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
       
    99   430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
       
   100 
       
   101   $ cat ../b/.hgtags
       
   102   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
       
   103 
       
   104   $ cat ../b/.hg/localtags
       
   105   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
       
   106