Mercurial > hg
changeset 26408:2b31d8636f25
localrepo: recreate phasecache if changelog was modified (issue4855)
Because _phaserevs and _phasesets cache revision numbers, they must be
invalidated if there are new commits or stripped revisions. We could do
that by calling _phasecache.invalidate(), but it wasn't simple to be
integrated with the filecache mechanism.
So for now, phasecache will be recreated after repo.invalidate() if
00changelog.i was modified before.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 29 Sep 2015 21:57:08 +0900 |
parents | 72bccc1f26b1 |
children | 19d946cf2a1b |
files | mercurial/localrepo.py tests/test-commandserver.t |
diffstat | 2 files changed, 47 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Sep 26 00:10:48 2015 -0400 +++ b/mercurial/localrepo.py Tue Sep 29 21:57:08 2015 +0900 @@ -434,7 +434,10 @@ heads.append(n) return heads - @storecache('phaseroots') + # _phaserevs and _phasesets depend on changelog. what wee 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)
--- a/tests/test-commandserver.t Sat Sep 26 00:10:48 2015 -0400 +++ b/tests/test-commandserver.t Tue Sep 29 21:57:08 2015 +0900 @@ -366,6 +366,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