Disallow commit over an applied mq patch.
authorBrendan Cully <brendan@kublai.com>
Thu, 10 Aug 2006 11:18:48 -0700
changeset 2845 addd03c7fbfa
parent 2844 582cbc4392cb
child 2846 b8d587cfa3bb
Disallow commit over an applied mq patch.
hgext/mq.py
--- a/hgext/mq.py	Thu Aug 10 14:58:10 2006 -0700
+++ b/hgext/mq.py	Thu Aug 10 11:18:48 2006 -0700
@@ -1832,6 +1832,18 @@
 
 def reposetup(ui, repo):
     class mqrepo(repo.__class__):
+        def commit(self, *args, **opts):
+            if len(args) >= 6:
+                force = args[5]
+            else:
+                force = opts.get('force')
+            if self.mq.applied and not force:
+                parent = revlog.hex(self.dirstate.parents()[0])
+                if parent in [s.rev for s in self.mq.applied]:
+                    raise util.Abort(_('cannot commit over an applied mq patch'))
+
+            return super(mqrepo, self).commit(*args, **opts)
+
         def tags(self):
             if self.tagscache:
                 return self.tagscache