mq: add function to check if a header exists in a patch
authorYann E. MORIN <yann.morin.1998@anciens.enib.fr>
Wed, 12 Aug 2009 10:46:16 +0200
changeset 9335 6eaadd777bc4
parent 9334 08f59f7916f9
child 9336 dd6f605b15c0
mq: add function to check if a header exists in a patch
hgext/mq.py
--- a/hgext/mq.py	Wed Aug 12 10:46:03 2009 +0200
+++ b/hgext/mq.py	Wed Aug 12 10:46:16 2009 +0200
@@ -170,6 +170,14 @@
                     break
         return res
 
+    def _hasheader(self, prefixes):
+        '''Check if a header starts with any of the given prefixes.'''
+        for prefix in prefixes:
+            for comment in self.comments:
+                if comment.startswith(prefix):
+                    return True
+        return False
+
     def __str__(self):
         if not self.comments:
             return ''