cmdserver: reload mq on each runcommand request to avoid corruption
If mq was changed by another process, command server should invalidate caches.
Otherwise, mq status would go wrong.
--- a/hgext/mq.py Mon Mar 03 19:41:23 2014 +0900
+++ b/hgext/mq.py Mon Mar 03 19:41:26 2014 +0900
@@ -3269,6 +3269,11 @@
def mq(self):
return queue(self.ui, self.baseui, self.path)
+ def invalidateall(self):
+ super(mqrepo, self).invalidateall()
+ if localrepo.hasunfilteredcache(self, 'mq'):
+ self.mq.invalidate()
+
def abortifwdirpatched(self, errmsg, force=False):
if self.mq.applied and self.mq.checkapplied and not force:
parents = self.dirstate.parents()
--- a/tests/test-commandserver.py Mon Mar 03 19:41:23 2014 +0900
+++ b/tests/test-commandserver.py Mon Mar 03 19:41:26 2014 +0900
@@ -274,6 +274,15 @@
runcommand(server, ['log', '--hidden'])
runcommand(server, ['log'])
+def mqoutsidechanges(server):
+ readchannel(server)
+
+ # load repo.mq
+ runcommand(server, ['qapplied'])
+ os.system('hg qnew 0.diff')
+ # repo.mq should be invalidated
+ runcommand(server, ['qapplied'])
+
if __name__ == '__main__':
os.system('hg init')
@@ -304,3 +313,7 @@
hgrc.write('[extensions]\nobs=obs.py\n')
hgrc.close()
check(obsolete)
+ hgrc = open('.hg/hgrc', 'a')
+ hgrc.write('[extensions]\nmq=\n')
+ hgrc.close()
+ check(mqoutsidechanges)
--- a/tests/test-commandserver.py.out Mon Mar 03 19:41:23 2014 +0900
+++ b/tests/test-commandserver.py.out Mon Mar 03 19:41:26 2014 +0900
@@ -222,3 +222,9 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: 1
+
+testing mqoutsidechanges:
+
+ runcommand qapplied
+ runcommand qapplied
+0.diff