comparison tests/test-commandserver.py @ 18757:1c8e0d6ac3b0 stable

localrepo: always write the filtered phasecache when nodes are destroyed (issue3827) When the strip command is run, it calls repo.destroyed, which in turn checks if we read _phasecache, and if we did calls filterunknown on it and flushes the changes immediately. But in some cases, nothing causes _phasecache to be read, so we miss out on this and the file remains the same on-disk. Then a call to invalidate comes, which should refresh _phasecache if it changed, but it didn't, so it keeps using the old one with the stripped revision which causes an IndexError. Test written by Yuya Nishihara.
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Mar 2013 13:34:50 +0200
parents e34106fa0dc3
children 605deb776abf e958b17696fe
comparison
equal deleted inserted replaced
18756:76d49dab6a00 18757:1c8e0d6ac3b0
234 f = open('.hgignore', 'ab') 234 f = open('.hgignore', 'ab')
235 f.write('ignored-file') 235 f.write('ignored-file')
236 f.close() 236 f.close()
237 runcommand(server, ['status', '-i', '-u']) 237 runcommand(server, ['status', '-i', '-u'])
238 238
239 def phasecacheafterstrip(server):
240 readchannel(server)
241
242 # create new head, 5:731265503d86
243 runcommand(server, ['update', '-C', '0'])
244 f = open('a', 'ab')
245 f.write('a\n')
246 f.close()
247 runcommand(server, ['commit', '-Am.', 'a'])
248 runcommand(server, ['log', '-Gq'])
249
250 # make it public; draft marker moves to 4:7966c8e3734d
251 runcommand(server, ['phase', '-p', '.'])
252 runcommand(server, ['phase', '.']) # load _phasecache.phaseroots
253
254 # strip 1::4 outside server
255 os.system('hg --config extensions.mq= strip 1')
256
257 # shouldn't raise "7966c8e3734d: no node!"
258 runcommand(server, ['branches'])
259
239 if __name__ == '__main__': 260 if __name__ == '__main__':
240 os.system('hg init') 261 os.system('hg init')
241 262
242 check(hellomessage) 263 check(hellomessage)
243 check(unknowncommand) 264 check(unknowncommand)
256 check(tagscache) 277 check(tagscache)
257 check(setphase) 278 check(setphase)
258 check(rollback) 279 check(rollback)
259 check(branch) 280 check(branch)
260 check(hgignore) 281 check(hgignore)
282 check(phasecacheafterstrip)