diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py index f31ddc9bfa5f8f28cd899e907a0a9edb072b3e9a_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..c15d8f84343e83c03ee11523ee1f00359ae94477_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644 --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -429,7 +429,10 @@ heads.append(n) return heads - @storecache('phaseroots') + # _phaserevs and _phasesets depend on changelog. what we need is to + # call _phasecache.invalidate() if '00changelog.i' was changed, but it + # can't be easily expressed in filecache mechanism. + @storecache('phaseroots', '00changelog.i') def _phasecache(self): return phases.phasecache(self, self._phasedefaults) diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t index f31ddc9bfa5f8f28cd899e907a0a9edb072b3e9a_dGVzdHMvdGVzdC1jb21tYW5kc2VydmVyLnQ=..c15d8f84343e83c03ee11523ee1f00359ae94477_dGVzdHMvdGVzdC1jb21tYW5kc2VydmVyLnQ= 100644 --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -367,6 +367,49 @@ *** runcommand status -i -u I ignored-file +cache of non-public revisions should be invalidated on repository change +(issue4855): + + >>> import os + >>> from hgclient import readchannel, runcommand, check + >>> @check + ... def phasesetscacheaftercommit(server): + ... readchannel(server) + ... # load _phasecache._phaserevs and _phasesets + ... runcommand(server, ['log', '-qr', 'draft()']) + ... # create draft commits by another process + ... for i in xrange(5, 7): + ... os.system('echo a >> a') + ... os.system('hg commit -Aqm%d' % i) + ... # new commits should be listed as draft revisions + ... runcommand(server, ['log', '-qr', 'draft()']) + *** runcommand log -qr draft() + 4:7966c8e3734d + *** runcommand log -qr draft() + 4:7966c8e3734d + 5:41f6602d1c4f + 6:10501e202c35 + + >>> import os + >>> from hgclient import readchannel, runcommand, check + >>> @check + ... def phasesetscacheafterstrip(server): + ... readchannel(server) + ... # load _phasecache._phaserevs and _phasesets + ... runcommand(server, ['log', '-qr', 'draft()']) + ... # strip cached revisions by another process + ... os.system('hg --config extensions.strip= strip -q 5') + ... # shouldn't abort by "unknown revision '6'" + ... runcommand(server, ['log', '-qr', 'draft()']) + *** runcommand log -qr draft() + 4:7966c8e3734d + 5:41f6602d1c4f + 6:10501e202c35 + *** runcommand log -qr draft() + 4:7966c8e3734d + +cache of phase roots should be invalidated on strip (issue3827): + >>> import os >>> from hgclient import readchannel, sep, runcommand, check >>> @check