Submitter | Yuya Nishihara |
---|---|
Date | Sept. 29, 2015, 1:51 p.m. |
Message ID | <328782664248045a87f3.1443534692@mimosa> |
Download | mbox | patch |
Permalink | /patch/10681/ |
State | Accepted |
Headers | show |
Comments
Yuya Nishihara <yuya@tcha.org> writes: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1443531428 -32400 > # Tue Sep 29 21:57:08 2015 +0900 > # Branch stable > # Node ID 328782664248045a87f3f99a22cbb5b8834ec9d1 > # Parent f31ddc9bfa5f8f28cd899e907a0a9edb072b3e9a > 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. > > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > --- a/mercurial/localrepo.py > +++ b/mercurial/localrepo.py > @@ -429,7 +429,10 @@ class localrepository(object): > heads.append(n) > return heads > > - @storecache('phaseroots') > + # _phaserevs and _phasesets depend on changelog. what wee need is to Small typo: wee -> we (hopefully the reviewer can fix in flight). Looks good otherwise.
On Tue, 2015-09-29 at 22:51 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1443531428 -32400 > # Tue Sep 29 21:57:08 2015 +0900 > # Branch stable > # Node ID 328782664248045a87f3f99a22cbb5b8834ec9d1 > # Parent f31ddc9bfa5f8f28cd899e907a0a9edb072b3e9a > localrepo: recreate phasecache if changelog was modified (issue4855) Queued for stable, thanks.
On 09/29/2015 11:29 AM, Matt Mackall wrote: > On Tue, 2015-09-29 at 22:51 +0900, Yuya Nishihara wrote: >> # HG changeset patch >> # User Yuya Nishihara <yuya@tcha.org> >> # Date 1443531428 -32400 >> # Tue Sep 29 21:57:08 2015 +0900 >> # Branch stable >> # Node ID 328782664248045a87f3f99a22cbb5b8834ec9d1 >> # Parent f31ddc9bfa5f8f28cd899e907a0a9edb072b3e9a >> localrepo: recreate phasecache if changelog was modified (issue4855) > > Queued for stable, thanks. I've pushed it on clowncopter, (default by mistake). I sugguest the first of us that see the other ones prunes it.
Patch
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -429,7 +429,10 @@ class localrepository(object): 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) diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -367,6 +367,49 @@ check that local configs for the cached *** 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