[PATCH] Disallow commit over an applied mq patch

Brendan Cully brendan at kublai.com
Thu Aug 10 13:19:35 CDT 2006


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1155233928 25200
# Node ID f49addb4e8599fe464375bac1a04a9743f459991
# Parent  51fabb1ff3e27ba2a7149a478e8aac4df369d702
Disallow commit over an applied mq patch.

diff -r 51fabb1ff3e2 -r f49addb4e859 hgext/mq.py
--- a/hgext/mq.py	Thu Aug 10 10:13:58 2006 -0700
+++ b/hgext/mq.py	Thu Aug 10 11:18:48 2006 -0700
@@ -1795,6 +1795,18 @@ def select(ui, repo, *args, **opts):
 
 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


More information about the Mercurial mailing list