diff hgext/eol.py @ 13501:50b825c1adb1 stable

eol: stop after first matched rule in hook (issue2660) When matching a file against the rules in .hgeol, the eol extension's hook should stop after the first matching rule is encountered. Otherwise, if this rule is contradicted by other more general rule (for example a catch-all at the end of .hgeol), some files are simply impossible to push. Trivial example: **.bat = CRLF ** = LF If all matching rules were applied, a .bat file would be rejected either because it has LFs (first rule) or because it has CRLFs (second rule).
author Antoine Pitrou <solipsis@pitrou.net>
date Sun, 27 Feb 2011 19:50:28 +0100
parents c7bef25ca393
children c0f252757b41
line wrap: on
line diff
--- a/hgext/eol.py	Sun Feb 27 15:58:29 2011 -0600
+++ b/hgext/eol.py	Sun Feb 27 19:50:28 2011 +0100
@@ -144,6 +144,8 @@
                 elif target == "to-crlf" and singlelf.search(data):
                     raise util.Abort(_("%s should not have LF line endings")
                                      % f)
+                # Ignore other rules for this file
+                break
 
 
 def preupdate(ui, repo, hooktype, parent1, parent2):