changeset 2845:addd03c7fbfa

Disallow commit over an applied mq patch.
author Brendan Cully <brendan@kublai.com>
date Thu, 10 Aug 2006 11:18:48 -0700
parents 582cbc4392cb
children b8d587cfa3bb
files hgext/mq.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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