comparison tests/test-context.py @ 33706:01a1c4e66816

repo: skip invalidation of changelog if it has 'delayed' changes (API) The changelog object can store recently added revisions in memory until the transaction is committed. We don't want to lose those changes even if repo.invalidate(clearfilecache=True), so let's skip the changelog when it has such 'delayed' changes. Differential Revision: https://phab.mercurial-scm.org/D152
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 19 Jul 2017 13:34:06 -0700
parents bb628fc85b0e
children af20468eb0a4
comparison
equal deleted inserted replaced
33705:73fd395ee29e 33706:01a1c4e66816
177 try: 177 try:
178 if repo[n][i].data() != i: 178 if repo[n][i].data() != i:
179 print('data mismatch') 179 print('data mismatch')
180 except Exception as ex: 180 except Exception as ex:
181 print('cannot read data: %r' % ex) 181 print('cannot read data: %r' % ex)
182
183 with repo.wlock(), repo.lock(), repo.transaction('test'):
184 with open(b'4', 'wb') as f:
185 f.write(b'4')
186 repo.dirstate.normal('4')
187 repo.commit('4')
188 revsbefore = len(repo.changelog)
189 repo.invalidate(clearfilecache=True)
190 revsafter = len(repo.changelog)
191 if revsbefore != revsafter:
192 print('changeset lost by repo.invalidate()')