diff -r e978fb3038e0 -r 3ce3f2b059a1 mercurial/fileset.py --- a/mercurial/fileset.py Fri Mar 29 15:27:33 2013 -0700 +++ b/mercurial/fileset.py Fri Mar 29 16:48:32 2013 -0700 @@ -353,6 +353,29 @@ return s +def eol(mctx, x): + """``eol(style)`` + File contains newlines of the given style (dos, unix, mac). Binary + files are excluded, files with mixed line endings match multiple + styles. + """ + + # i18n: "encoding" is a keyword + enc = getstring(x, _("encoding requires an encoding name")) + + s = [] + for f in mctx.existing(): + d = mctx.ctx[f].data() + if util.binary(d): + continue + if (enc == 'dos' or enc == 'win') and '\r\n' in d: + s.append(f) + elif enc == 'unix' and re.search('(?