Commits

Gabriel Rodríguez Alberich committed 941decd

Configuration option to disable the strict checking of every revision pushed and only check the correctness of the last revision.

Comments (0)

Files changed (2)

 You can add as many hooks as you need. From version 0.2.0 it supports the
 pretxnchangegroup hook too.
 
+When using the pretxnchangegroup hook, hghooks' default behavior is to check
+only the last revision being pushed. If you want to check every new revision,
+you can activate hghooks' strict mode by adding these lines to your hgrc
+file::
+
+ [hghooks]
+ strict_checking = true
+
+This way you will enforce the correctness of every commit. Offending commits
+would need to be fixed locally using queues.
+
 How to skip the hooks
 ---------------------
 

hghooks/__init__.py

         self.node = node
         self.skip_text = skip_text
         self.extension = extension
+        self.strict_checking = self.ui.configbool('hghooks',
+                                                  'strict_checking')
 
     def skip_file(self, filename, filedata):
         if not filename.endswith(self.extension):
 
     def check(self, checker):
         warnings = 0
-        current_rev = self.repo[self.node].rev()
         total_revs = len(self.repo.changelog)
+        if self.strict_checking:
+            current_rev = self.repo[self.node].rev()
+        else:
+            # check only files from the last revision
+            current_rev = total_revs - 1
         while current_rev < total_revs:
             rev_warnings = 0
             directory = tempfile.mkdtemp(suffix='-r%d' % current_rev,