diff tests/test-commandserver.t @ 26405:c15d8f84343e stable

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 8f88f768e24c
children 19d946cf2a1b
line wrap: on
line diff
--- a/tests/test-commandserver.t	Fri Sep 25 13:30:49 2015 -0700
+++ b/tests/test-commandserver.t	Tue Sep 29 21:57:08 2015 +0900
@@ -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