[PATCH 3 of 3] cmdserver: recreate mq object on runcommand in case queue path was changed
Yuya Nishihara
yuya at tcha.org
Mon Mar 3 06:50:42 CST 2014
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1393843290 -32400
# Mon Mar 03 19:41:30 2014 +0900
# Node ID de7a4b2066c05cb3f6758e76578c3cdc6d796f4f
# Parent 30ea14789423bde5aef83a16118556b288a68e4a
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.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3272,7 +3272,8 @@ def reposetup(ui, repo):
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:
diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -289,6 +289,11 @@ def mqoutsidechanges(server):
# 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')
diff --git a/tests/test-commandserver.py.out b/tests/test-commandserver.py.out
--- a/tests/test-commandserver.py.out
+++ b/tests/test-commandserver.py.out
@@ -232,3 +232,8 @@ testing mqoutsidechanges:
runcommand qapplied
runcommand qapplied
0.diff
+ runcommand qpop --all
+popping 0.diff
+patch queue now empty
+ runcommand qqueue --active
+foo
More information about the Mercurial-devel
mailing list