[issue2660] eol hook doesn't stop at first matching rule

Antoine Pitrou bugs at mercurial.selenic.com
Sat Feb 26 19:08:28 UTC 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

The eol hook applies all matching rules for a given file, meaning that if
you have e.g.:

  **.bat = CRLF
  **     = LF

then you can never push any .bat file at all (either the hook complains that
it contains LFs (first rule), or that it contains CRLFs (second rule) :-)).

Here is a simple patch:


--- eol.py.orig	2011-02-26 20:01:10.000000000 +0100
+++ eol.py	2011-02-26 20:03:05.000000000 +0100
@@ -136,6 +136,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):

----------
messages: 15409
nosy: pitrou
priority: bug
status: unread
title: eol hook doesn't stop at first matching rule
topic: eol

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2660>
____________________________________________________


More information about the Mercurial-devel mailing list