tests/test-narrow-commit.t
changeset 36079 a2a6e724d61a
child 36084 dc01484606da
equal deleted inserted replaced
36078:7f68235f23ff 36079:a2a6e724d61a
       
     1   $ . "$TESTDIR/narrow-library.sh"
       
     2 
       
     3 create full repo
       
     4 
       
     5   $ hg init master
       
     6   $ cd master
       
     7 
       
     8   $ mkdir inside
       
     9   $ echo inside > inside/f1
       
    10   $ mkdir outside
       
    11   $ echo outside > outside/f1
       
    12   $ hg ci -Aqm 'initial'
       
    13 
       
    14   $ echo modified > inside/f1
       
    15   $ hg ci -qm 'modify inside'
       
    16 
       
    17   $ echo modified > outside/f1
       
    18   $ hg ci -qm 'modify outside'
       
    19 
       
    20   $ cd ..
       
    21 
       
    22   $ hg clone --narrow ssh://user@dummy/master narrow --include inside
       
    23   requesting all changes
       
    24   adding changesets
       
    25   adding manifests
       
    26   adding file changes
       
    27   added 3 changesets with 2 changes to 1 files
       
    28   new changesets *:* (glob)
       
    29   updating to branch default
       
    30   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    31   $ cd narrow
       
    32 
       
    33   $ hg update -q 0
       
    34 
       
    35 Can not modify dirstate outside
       
    36 
       
    37   $ mkdir outside
       
    38   $ touch outside/f1
       
    39   $ hg debugwalk -I 'relglob:f1'
       
    40   matcher: <includematcher includes='(?:(?:|.*/)f1(?:/|$))'>
       
    41   f  inside/f1  inside/f1
       
    42   $ hg add outside/f1
       
    43   abort: cannot track 'outside/f1' - it is outside the narrow clone
       
    44   [255]
       
    45   $ touch outside/f3
       
    46   $ hg add outside/f3
       
    47   abort: cannot track 'outside/f3' - it is outside the narrow clone
       
    48   [255]
       
    49   $ rm -r outside
       
    50 
       
    51 Can modify dirstate inside
       
    52 
       
    53   $ echo modified > inside/f1
       
    54   $ touch inside/f3
       
    55   $ hg add inside/f3
       
    56   $ hg status
       
    57   M inside/f1
       
    58   A inside/f3
       
    59   $ hg revert -qC .
       
    60   $ rm inside/f3
       
    61 
       
    62 Can commit changes inside. Leaves outside unchanged.
       
    63 
       
    64   $ hg update -q 'desc("initial")'
       
    65   $ echo modified2 > inside/f1
       
    66   $ hg commit -m 'modify inside/f1'
       
    67   created new head
       
    68   $ hg files -r .
       
    69   inside/f1
       
    70   outside/f1
       
    71 Some filesystems (notably FAT/exFAT only store timestamps with 2
       
    72 seconds of precision, so by sleeping for 3 seconds, we can ensure that
       
    73 the timestamps of files stored by dirstate will appear older than the
       
    74 dirstate file, and therefore we'll be able to get stable output from
       
    75 debugdirstate. If we don't do this, the test can be slightly flaky.
       
    76   $ sleep 3
       
    77   $ hg status
       
    78   $ hg debugdirstate --nodates
       
    79   n 644         10 set                 inside/f1