[MERGE] Introduced .eoltype and non-(CR, CRLF, LF) check.
Alexander Belchenko
bialix at ukr.net
Sat Mar 8 08:41:28 GMT 2008
Eugene Wee пишет:
> Hi Alexander,
>
> In my previous "feature request" email I suggested configuring checkeol
> to check for line endings other than a specified type. I decided to try
> and work a solution out myself.
>
> Basically, I introduced a .eoltype file that takes just one word: either
> CR, LF, or CRLF. If CR (or LF or CRLF) is the word, then files checked
> and found to have non-CR (or non-LF or non-CRLF) line endings will cause
> the commit to abort. The default is LF.
Thank you for your patch.
But I actually prefer to not introduce new additional files in working tree,
but change format of .checkeol instead. For now I'm leaning towards sections
in this file and groups file masks together in sections. Something like this:
--------------- .checkeol ----------------------
[CRLF]
*.txt
[LF]
*.py
------------------------------------------------
I forward this message to bazaar ML so maybe other people will comment
as well.
> Note that this is a change in behaviour from your revision 6 which
> allowed files to have mixed CR and LF line endings.
>
> Unfortunately, I was not able to figure out how to set the _fmt
> exception message. As such, I had to resort to a "File %(path)s has
> invalid line-endings. Commit aborted." I originally attempted to pass
> 'CR', 'LF' and 'CRLF' via an eoltype parameter, then set self.eoltype =
> eoltype, and finally set _fmt to "File %(path)s has non-%(eoltype)
> line-endings. Commit aborted.", but that failed at runtime.
It should be:
_fmt = "File %(path)s has non-%(eoltype)s line-endings. Commit aborted."
Note little s in formatting construct.
> Hope this helps,
> Eugene Wee
>
> P.S.: I do not normally program in Python, so bear with me if I made
> poor design choices, improper naming and formatting :)
>
More information about the bazaar
mailing list