changeset 20629:277dc5f27310

cmdserver: recreate mq object on runcommand in case queue path was changed repo.mq needs to be recreated after queue path change. Since there is little benefit to keep invalidated mq object, it always delete repo.mq.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 03 Mar 2014 19:41:30 +0900
parents e3d1df48fcc6
children 0b04ee8e789d
files hgext/mq.py tests/test-commandserver.py tests/test-commandserver.py.out
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Mar 03 19:41:26 2014 +0900
+++ b/hgext/mq.py	Mon Mar 03 19:41:30 2014 +0900
@@ -3272,7 +3272,8 @@
         def invalidateall(self):
             super(mqrepo, self).invalidateall()
             if localrepo.hasunfilteredcache(self, 'mq'):
-                self.mq.invalidate()
+                # recreate mq in case queue path was changed
+                delattr(self.unfiltered(), 'mq')
 
         def abortifwdirpatched(self, errmsg, force=False):
             if self.mq.applied and self.mq.checkapplied and not force:
--- a/tests/test-commandserver.py	Mon Mar 03 19:41:26 2014 +0900
+++ b/tests/test-commandserver.py	Mon Mar 03 19:41:30 2014 +0900
@@ -283,6 +283,11 @@
     # repo.mq should be invalidated
     runcommand(server, ['qapplied'])
 
+    runcommand(server, ['qpop', '--all'])
+    os.system('hg qqueue --create foo')
+    # repo.mq should be recreated to point to new queue
+    runcommand(server, ['qqueue', '--active'])
+
 if __name__ == '__main__':
     os.system('hg init')
 
--- a/tests/test-commandserver.py.out	Mon Mar 03 19:41:26 2014 +0900
+++ b/tests/test-commandserver.py.out	Mon Mar 03 19:41:30 2014 +0900
@@ -228,3 +228,8 @@
  runcommand qapplied
  runcommand qapplied
 0.diff
+ runcommand qpop --all
+popping 0.diff
+patch queue now empty
+ runcommand qqueue --active
+foo