Mercurial > evolve
comparison hgext3rd/evolve/obscache.py @ 6135:ce7da767c7f6 stable
evolve: make _computeobsoleteset() return a frozenset
Let's make sure that obsolete.getrevs(repo, b'obsolete') returns a frozenset to
be compatible with Mercurial 6.1. This shouldn't produce any issues on older
versions, because I doubt anything tries to modify a set of obsolete revisions
by calling .add() or .remove() directly on it.
See 27fe84a8dd60 and c7e675848027 in core.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 11 Feb 2022 18:10:51 +0300 |
parents | 13b108c3782e |
children | 4ac6ca50bb2e |
comparison
equal
deleted
inserted
replaced
6132:7da0f8128d90 | 6135:ce7da767c7f6 |
---|---|
430 self._setdata(bytearray(data[headersize:])) | 430 self._setdata(bytearray(data[headersize:])) |
431 self._ondiskkey = self._cachekey | 431 self._ondiskkey = self._cachekey |
432 | 432 |
433 def _computeobsoleteset(orig, repo): | 433 def _computeobsoleteset(orig, repo): |
434 """the set of obsolete revisions""" | 434 """the set of obsolete revisions""" |
435 obs = set() | |
436 repo = repo.unfiltered() | 435 repo = repo.unfiltered() |
437 notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) | 436 notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) |
438 if notpublic: | 437 if notpublic: |
439 obscache = repo.obsstore.obscache | 438 obscache = repo.obsstore.obscache |
440 # Since we warm the cache at the end of every transaction, the cache | 439 # Since we warm the cache at the end of every transaction, the cache |
459 # If a transaction is open, it is worthwhile to update and use | 458 # If a transaction is open, it is worthwhile to update and use |
460 # the cache, the lock prevent race and it will be written on | 459 # the cache, the lock prevent race and it will be written on |
461 # disk when the transaction close. | 460 # disk when the transaction close. |
462 obscache.update(repo) | 461 obscache.update(repo) |
463 isobs = obscache.get | 462 isobs = obscache.get |
464 for r in notpublic: | 463 return frozenset(r for r in notpublic if isobs(r)) |
465 if isobs(r): | |
466 obs.add(r) | |
467 return obs | |
468 | 464 |
469 @eh.uisetup | 465 @eh.uisetup |
470 def cachefuncs(ui): | 466 def cachefuncs(ui): |
471 orig = obsolete.cachefuncs[b'obsolete'] | 467 orig = obsolete.cachefuncs[b'obsolete'] |
472 wrapped = lambda repo: _computeobsoleteset(orig, repo) | 468 wrapped = lambda repo: _computeobsoleteset(orig, repo) |