Debian Codegraph @

tests/test-remotefilelog-linknodes.t

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