Mercurial > public > mercurial-scm > hg-stable
diff tests/test-context.py @ 33732: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 |
line wrap: on
line diff
--- a/tests/test-context.py Sun Aug 06 17:47:41 2017 -0700 +++ b/tests/test-context.py Wed Jul 19 13:34:06 2017 -0700 @@ -179,3 +179,14 @@ print('data mismatch') except Exception as ex: print('cannot read data: %r' % ex) + +with repo.wlock(), repo.lock(), repo.transaction('test'): + with open(b'4', 'wb') as f: + f.write(b'4') + repo.dirstate.normal('4') + repo.commit('4') + revsbefore = len(repo.changelog) + repo.invalidate(clearfilecache=True) + revsafter = len(repo.changelog) + if revsbefore != revsafter: + print('changeset lost by repo.invalidate()')