# HG changeset patch
# User Henrik Stuart <h...@hstuart.dk>
# Date 1254566131 -7200
# Node ID f396663a7c57d5cb0e40431c0528e5b638cedf05
# Parent  79e07253b8223e18bf694c48956c92a816f4d13c
history: disable strip and qimport on mq and mq ancestor changesets

Previously repositories with mq changesets applied could have them stripped
causing mq to go into a "bad" state that would require manual update of the mq
state file to reflect the modified layout of the repository. This fix makes it
impossible to strip or qimport an ancestor to an applied mq changeset.

diff -r 79e07253b822 -r f396663a7c57 tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py        Sat Oct 03 20:31:23 2009 -0500
+++ b/tortoisehg/hgtk/history.py        Sat Oct 03 12:35:31 2009 +0200
@@ -609,8 +609,23 @@
         
         # need mq extension for strip command
         if 'mq' in self.exs:
-            m.append(create_menu(_('qimport'), self.qimport_rev))
-            m.append(create_menu(_('strip revision'), self.strip_rev))
+            cmenu_qimport = create_menu(_('qimport'), self.qimport_rev)
+            cmenu_strip = create_menu(_('strip revision'), self.strip_rev)
+
+            try:
+                ctx = self.repo[self.currevid]
+                qbase = self.repo['qbase']
+                actx = ctx.ancestor(qbase)
+                if actx == qbase or actx == ctx:
+                    # we're in the mq revision range or the mq
+                    # is a descendant of us
+                    cmenu_qimport.set_sensitive(False)
+                    cmenu_strip.set_sensitive(False)
+            except:
+                pass
+
+            m.append(cmenu_qimport)
+            m.append(cmenu_strip)
 
         m.show_all()
         return m

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to