Mercurial > evolve
changeset 1225:577f5340be6f
inhibit: Add some inhibition clearing mechanism
We do not want to keep inhibition marker around for ever. So we are removing the
one applying on public changeset.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 07 Mar 2015 02:32:43 -0800 |
parents | 859a854cedc3 |
children | 901d2f4b21a9 |
files | hgext/inhibit.py tests/test-inhibit.t |
diffstat | 2 files changed, 56 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/inhibit.py Fri Mar 06 21:25:44 2015 -0800 +++ b/hgext/inhibit.py Sat Mar 07 02:32:43 2015 -0800 @@ -51,6 +51,14 @@ tr.addfilegenerator('obsinhibit', ('obsinhibit',), writer) tr.hookargs['obs_inbihited'] = '1' +def _filterpublic(repo, nodes): + """filter out inhibitor on public changeset + + Public changesets are already immune to obsolescence""" + getrev = repo.changelog.nodemap.get + getphase = repo._phasecache.phase + return (n for n in repo._obsinhibit if getphase(repo, getrev(n))) + def _inhibitmarkers(repo, nodes): """add marker inhibitor for all obsolete revision under <nodes> @@ -62,7 +70,7 @@ tr = repo.transaction('obsinhibit') try: repo._obsinhibit.update(c.node() for c in newinhibit) - _schedulewrite(tr, repo._obsinhibit) + _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) repo.invalidatevolatilesets() tr.close() finally: @@ -79,7 +87,7 @@ tr = repo.transaction('obsinhibit') try: repo._obsinhibit -= deinhibited - _schedulewrite(tr, repo._obsinhibit) + _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) repo.invalidatevolatilesets() tr.close() finally:
--- a/tests/test-inhibit.t Fri Mar 06 21:25:44 2015 -0800 +++ b/tests/test-inhibit.t Sat Mar 07 02:32:43 2015 -0800 @@ -127,3 +127,49 @@ branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) + +check public revision got cleared +(when adding the second inhibitor, the first one is removed because it is public) + + $ wc -m .hg/store/obsinhibit + 20 .hg/store/obsinhibit + $ hg prune 7 + 1 changesets pruned + $ hg debugobsinhibit --hidden 18214586bf78 + $ wc -m .hg/store/obsinhibit + 20 .hg/store/obsinhibit + $ hg log -G + @ 9:55c73a90e4b4 add cJ + | + | o 7:18214586bf78 add cJ + |/ + o 6:cf5c4f4554ce add cH + | + o 5:5419eb264a33 add cG + | + o 4:98065434e5c6 add cE + | + o 0:54ccbc537fc2 add cA + + $ hg phase --public 7 + $ hg prune 9 + 1 changesets pruned + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at cf5c4f4554ce + $ hg debugobsinhibit --hidden 55c73a90e4b4 + $ wc -m .hg/store/obsinhibit + 20 .hg/store/obsinhibit + $ hg log -G + o 9:55c73a90e4b4 add cJ + | + | o 7:18214586bf78 add cJ + |/ + @ 6:cf5c4f4554ce add cH + | + o 5:5419eb264a33 add cG + | + o 4:98065434e5c6 add cE + | + o 0:54ccbc537fc2 add cA + +