tests/test-remotefilelog-linknodes.t
changeset 40495 3a333a582d7b
child 40571 95a079ea1e19
equal deleted inserted replaced
40494:9aeb9e2d28a7 40495:3a333a582d7b
       
     1   $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
       
     2   $ export PYTHONPATH
       
     3 
       
     4 # Tests for the complicated linknode logic in remotefilelog.py::ancestormap()
       
     5 
       
     6   $ . "$TESTDIR/remotefilelog-library.sh"
       
     7 
       
     8   $ hginit master
       
     9   $ cd master
       
    10   $ cat >> .hg/hgrc <<EOF
       
    11   > [remotefilelog]
       
    12   > server=True
       
    13   > serverexpiration=-1
       
    14   > EOF
       
    15   $ echo x > x
       
    16   $ hg commit -qAm x
       
    17   $ cd ..
       
    18 
       
    19   $ hgcloneshallow ssh://user@dummy/master shallow -q
       
    20   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
       
    21 
       
    22 # Rebase produces correct log -f linknodes
       
    23 
       
    24   $ cd shallow
       
    25   $ echo y > y
       
    26   $ hg commit -qAm y
       
    27   $ hg up 0
       
    28   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    29   $ echo x >> x
       
    30   $ hg commit -qAm xx
       
    31   $ hg log -f x --template "{node|short}\n"
       
    32   0632994590a8
       
    33   b292c1e3311f
       
    34 
       
    35   $ hg rebase -d 1
       
    36   rebasing 2:0632994590a8 "xx" (tip)
       
    37   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/0632994590a8-0bc786d8-rebase.hg (glob)
       
    38   $ hg log -f x --template "{node|short}\n"
       
    39   81deab2073bc
       
    40   b292c1e3311f
       
    41 
       
    42 # Rebase back, log -f still works
       
    43 
       
    44   $ hg rebase -d 0 -r 2
       
    45   rebasing 2:81deab2073bc "xx" (tip)
       
    46   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/81deab2073bc-80cb4fda-rebase.hg (glob)
       
    47   $ hg log -f x --template "{node|short}\n"
       
    48   b3fca10fb42d
       
    49   b292c1e3311f
       
    50 
       
    51   $ hg rebase -d 1 -r 2
       
    52   rebasing 2:b3fca10fb42d "xx" (tip)
       
    53   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/b3fca10fb42d-da73a0c7-rebase.hg (glob)
       
    54 
       
    55   $ cd ..
       
    56 
       
    57 # Reset repos
       
    58   $ clearcache
       
    59 
       
    60   $ rm -rf master
       
    61   $ rm -rf shallow
       
    62   $ hginit master
       
    63   $ cd master
       
    64   $ cat >> .hg/hgrc <<EOF
       
    65   > [remotefilelog]
       
    66   > server=True
       
    67   > serverexpiration=-1
       
    68   > EOF
       
    69   $ echo x > x
       
    70   $ hg commit -qAm x
       
    71   $ cd ..
       
    72 
       
    73   $ hgcloneshallow ssh://user@dummy/master shallow -q
       
    74   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
       
    75 
       
    76 # Rebase stack onto landed commit
       
    77 
       
    78   $ cd master
       
    79   $ echo x >> x
       
    80   $ hg commit -Aqm xx
       
    81 
       
    82   $ cd ../shallow
       
    83   $ echo x >> x
       
    84   $ hg commit -Aqm xx2
       
    85   $ echo y >> x
       
    86   $ hg commit -Aqm xxy
       
    87 
       
    88   $ hg pull -q
       
    89   $ hg rebase -d tip
       
    90   rebasing 1:4549721d828f "xx2"
       
    91   note: rebase of 1:4549721d828f created no changes to commit
       
    92   rebasing 2:5ef6d97e851c "xxy"
       
    93   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/4549721d828f-b084e33c-rebase.hg (glob)
       
    94   $ hg log -f x --template '{node|short}\n'
       
    95   4ae8e31c85ef
       
    96   0632994590a8
       
    97   b292c1e3311f
       
    98 
       
    99   $ cd ..
       
   100 
       
   101 # system cache has invalid linknode, but .hg/store/data has valid
       
   102 
       
   103   $ cd shallow
       
   104   $ hg strip -r 1 -q
       
   105   $ rm -rf .hg/store/data/*
       
   106   $ echo x >> x
       
   107   $ hg commit -Aqm xx_local
       
   108   $ hg log -f x --template '{rev}:{node|short}\n'
       
   109   1:21847713771d
       
   110   0:b292c1e3311f
       
   111 
       
   112   $ cd ..
       
   113   $ rm -rf shallow
       
   114 
       
   115 /* Local linknode is invalid; remote linknode is valid (formerly slow case) */
       
   116 
       
   117   $ hgcloneshallow ssh://user@dummy/master shallow -q
       
   118   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
       
   119   $ cd shallow
       
   120   $ echo x >> x
       
   121   $ hg commit -Aqm xx2
       
   122   $ cd ../master
       
   123   $ echo y >> y
       
   124   $ hg commit -Aqm yy2
       
   125   $ echo x >> x
       
   126   $ hg commit -Aqm xx2-fake-rebased
       
   127   $ echo y >> y
       
   128   $ hg commit -Aqm yy3
       
   129   $ cd ../shallow
       
   130   $ hg pull --config remotefilelog.debug=True
       
   131   pulling from ssh://user@dummy/master
       
   132   searching for changes
       
   133   adding changesets
       
   134   adding manifests
       
   135   adding file changes
       
   136   added 3 changesets with 0 changes to 0 files (+1 heads)
       
   137   new changesets 01979f9404f8:7200df4e0aca
       
   138   (run 'hg heads' to see heads, 'hg merge' to merge)
       
   139   $ hg update tip -q
       
   140   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
       
   141   $ echo x > x
       
   142   $ hg commit -qAm xx3
       
   143 
       
   144 # At this point, the linknode points to c1254e70bad1 instead of 32e6611f6149
       
   145   $ hg log -G -T '{node|short} {desc} {phase} {files}\n'
       
   146   @  a5957b6bf0bd xx3 draft x
       
   147   |
       
   148   o  7200df4e0aca yy3 public y
       
   149   |
       
   150   o  32e6611f6149 xx2-fake-rebased public x
       
   151   |
       
   152   o  01979f9404f8 yy2 public y
       
   153   |
       
   154   | o  c1254e70bad1 xx2 draft x
       
   155   |/
       
   156   o  0632994590a8 xx public x
       
   157   |
       
   158   o  b292c1e3311f x public x
       
   159   
       
   160 # Check the contents of the local blob for incorrect linknode
       
   161   $ hg debugremotefilelog .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
       
   162   size: 6 bytes
       
   163   path: .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 
       
   164   key: d4a3ed9310e5 
       
   165   
       
   166           node =>           p1            p2      linknode     copyfrom
       
   167   d4a3ed9310e5 => aee31534993a  000000000000  c1254e70bad1  
       
   168   aee31534993a => 1406e7411862  000000000000  0632994590a8  
       
   169   1406e7411862 => 000000000000  000000000000  b292c1e3311f  
       
   170 
       
   171 # Verify that we do a fetch on the first log (remote blob fetch for linkrev fix)
       
   172   $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
       
   173   a5957b6bf0bd xx3 draft x
       
   174   32e6611f6149 xx2-fake-rebased public x
       
   175   0632994590a8 xx public x
       
   176   b292c1e3311f x public x
       
   177   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
       
   178 
       
   179 # But not after that
       
   180   $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
       
   181   a5957b6bf0bd xx3 draft x
       
   182   32e6611f6149 xx2-fake-rebased public x
       
   183   0632994590a8 xx public x
       
   184   b292c1e3311f x public x
       
   185 
       
   186 # Check the contents of the remote blob for correct linknode
       
   187   $ hg debugremotefilelog $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
       
   188   size: 6 bytes
       
   189   path: $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 
       
   190   key: d4a3ed9310e5 
       
   191   
       
   192           node =>           p1            p2      linknode     copyfrom
       
   193   d4a3ed9310e5 => aee31534993a  000000000000  32e6611f6149  
       
   194   aee31534993a => 1406e7411862  000000000000  0632994590a8  
       
   195   1406e7411862 => 000000000000  000000000000  b292c1e3311f