Mercurial > hg
changeset 20628:e3d1df48fcc6
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 03 Mar 2014 19:41:26 +0900 |
parents | a42ea6d209e6 |
children | 277dc5f27310 |
files | hgext/mq.py tests/test-commandserver.py tests/test-commandserver.py.out |
diffstat | 3 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)