mq: warn about finalizing patches without cset message
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Fri, 19 Jun 2009 12:37:29 +0200
changeset 8832 6e6f5b80e056
parent 8831 91e26fb24fb1
child 8833 14639c050251
mq: warn about finalizing patches without cset message
hgext/mq.py
tests/test-mq-qdelete.out
tests/test-mq-qimport.out
--- a/hgext/mq.py	Thu Jun 18 16:56:03 2009 -0500
+++ b/hgext/mq.py	Fri Jun 19 12:37:29 2009 +0200
@@ -627,13 +627,23 @@
         appliedbase = 0
         patches = []
         for rev in sorted(revs):
+
             if rev < firstrev:
                 raise util.Abort(_('revision %d is not managed') % rev)
             base = bin(self.applied[appliedbase].rev)
-            node = repo.changelog.node(rev)
-            if node != base:
-                raise util.Abort(_('cannot delete revision %d above '
-                                   'applied patches') % rev)
+
+            ctx = repo[rev]
+            if ctx.node() != base:
+                msg = _('cannot delete revision %d above applied patches')
+                raise util.Abort(msg % rev)
+
+            patch = self.applied[appliedbase].name
+            for fmt in ('[mq]: %s', 'imported patch %s'):
+                if ctx.description() == fmt % patch:
+                    msg = _('patch %s finalized without changeset message\n')
+                    repo.ui.status(msg % patch)
+                    break
+
             patches.append(self.applied[appliedbase].name)
             appliedbase += 1
 
--- a/tests/test-mq-qdelete.out	Thu Jun 18 16:56:03 2009 -0500
+++ b/tests/test-mq-qdelete.out	Fri Jun 19 12:37:29 2009 +0200
@@ -32,11 +32,14 @@
 applying c
 patch c is empty
 now at: c
+patch a finalized without changeset message
+patch b finalized without changeset message
 c
 3 imported patch c
 2 [mq]: b
 1 [mq]: a
 0 base
+patch c finalized without changeset message
 3 imported patch c
 2 [mq]: b
 1 [mq]: a
--- a/tests/test-mq-qimport.out	Thu Jun 18 16:56:03 2009 -0500
+++ b/tests/test-mq-qimport.out	Fri Jun 19 12:37:29 2009 +0200
@@ -27,3 +27,5 @@
 adding another.diff to series file
 applying another.diff
 now at: another.diff
+patch b.diff finalized without changeset message
+patch another.diff finalized without changeset message