##// END OF EJS Templates
test-context: add a case demonstrating manifest caching problem...
Jun Wu -
r32518:bb628fc8 default
parent child Browse files
Show More
@@ -1,9 +1,11 b''
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2 import os
2 import os
3 from mercurial.node import hex
3 from mercurial import (
4 from mercurial import (
4 context,
5 context,
5 encoding,
6 encoding,
6 hg,
7 hg,
8 scmutil,
7 ui as uimod,
9 ui as uimod,
8 )
10 )
9
11
@@ -146,3 +148,34 b' print(actx2.status(other=wcctx,'
146 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
148 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
147 listclean=True))
149 listclean=True))
148 print('wcctx._status=%s' % (str(wcctx._status)))
150 print('wcctx._status=%s' % (str(wcctx._status)))
151
152 os.chdir('..')
153
154 # test manifestlog being changed
155 print('== commit with manifestlog invalidated')
156
157 repo = hg.repository(u, 'test2', create=1)
158 os.chdir('test2')
159
160 # make some commits
161 for i in [b'1', b'2', b'3']:
162 with open(i, 'wb') as f:
163 f.write(i)
164 status = scmutil.status([], [i], [], [], [], [], [])
165 ctx = context.workingcommitctx(repo, status, text=i, user=b'test@test.com',
166 date=(0, 0))
167 ctx.p1().manifest() # side effect: cache manifestctx
168 n = repo.commitctx(ctx)
169 print('commit %s: %s' % (i, hex(n)))
170
171 # touch 00manifest.i mtime so storecache could expire.
172 # repo.__dict__['manifestlog'] is deleted by transaction releasefn.
173 st = repo.svfs.stat('00manifest.i')
174 repo.svfs.utime('00manifest.i', (st.st_mtime + 1, st.st_mtime + 1))
175
176 # read the file just committed
177 try:
178 if repo[n][i].data() != i:
179 print('data mismatch')
180 except Exception as ex:
181 print('cannot read data: %r' % ex)
@@ -44,3 +44,9 b" wcctx._status=<status modified=['bar-m']"
44 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
44 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
45 <status modified=[], added=['bar-r'], removed=[], deleted=[], unknown=[], ignored=[], clean=['foo']>
45 <status modified=[], added=['bar-r'], removed=[], deleted=[], unknown=[], ignored=[], clean=['foo']>
46 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
46 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
47 == commit with manifestlog invalidated
48 commit 1: 2efe531a913fa648867ab8824360371679d05a65
49 commit 2: 2caca91f6362020334384ebe27bae67315298abf
50 cannot read data: LookupError('Q\xa3L\xa5Ou\x8f\xce8\xda<Q\x7f\x9f(\xc9;Li/', '00manifest.i', 'no node')
51 commit 3: abd6b0f49f338be22b094ef2b7425e8048f8337b
52 cannot read data: LookupError("\x82\x15\xb8\xd3\x85\xf6H'\x9cP'D\x97\x1e\xab\x98O\xbb\x05\x9d", '00manifest.i', 'no node')
General Comments 0
You need to be logged in to leave comments. Login now