comparison mercurial/localrepo.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 da3087b8f4a2
children 02a745c20121
comparison
equal deleted inserted replaced
33731:73fd395ee29e 33732:01a1c4e66816
1459 unfiltered = self.unfiltered() # all file caches are stored unfiltered 1459 unfiltered = self.unfiltered() # all file caches are stored unfiltered
1460 for k in list(self._filecache.keys()): 1460 for k in list(self._filecache.keys()):
1461 # dirstate is invalidated separately in invalidatedirstate() 1461 # dirstate is invalidated separately in invalidatedirstate()
1462 if k == 'dirstate': 1462 if k == 'dirstate':
1463 continue 1463 continue
1464 if (k == 'changelog' and
1465 self.currenttransaction() and
1466 self.changelog._delayed):
1467 # The changelog object may store unwritten revisions. We don't
1468 # want to lose them.
1469 # TODO: Solve the problem instead of working around it.
1470 continue
1464 1471
1465 if clearfilecache: 1472 if clearfilecache:
1466 del self._filecache[k] 1473 del self._filecache[k]
1467 try: 1474 try:
1468 delattr(unfiltered, k) 1475 delattr(unfiltered, k)