Mercurial > hg-stable
comparison hgext/eol.py @ 27524:f5b6b4e574c1
eol: make output stable
This eliminates a divergence in behaviour between PyPy and Python.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Sun, 27 Dec 2015 23:55:54 +0900 |
parents | 56b2bcea2529 |
children | cca011fd1ea7 |
comparison
equal
deleted
inserted
replaced
27523:68b9abf1cb82 | 27524:f5b6b4e574c1 |
---|---|
199 continue | 199 continue |
200 target = self._encode[style.upper()] | 200 target = self._encode[style.upper()] |
201 data = ctx[f].data() | 201 data = ctx[f].data() |
202 if (target == "to-lf" and "\r\n" in data | 202 if (target == "to-lf" and "\r\n" in data |
203 or target == "to-crlf" and singlelf.search(data)): | 203 or target == "to-crlf" and singlelf.search(data)): |
204 failed.append((str(ctx), target, f)) | 204 failed.append((f, target, str(ctx))) |
205 break | 205 break |
206 return failed | 206 return failed |
207 | 207 |
208 def parseeol(ui, repo, nodes): | 208 def parseeol(ui, repo, nodes): |
209 try: | 209 try: |
242 failed.extend(eol.checkrev(repo, ctx, files)) | 242 failed.extend(eol.checkrev(repo, ctx, files)) |
243 | 243 |
244 if failed: | 244 if failed: |
245 eols = {'to-lf': 'CRLF', 'to-crlf': 'LF'} | 245 eols = {'to-lf': 'CRLF', 'to-crlf': 'LF'} |
246 msgs = [] | 246 msgs = [] |
247 for node, target, f in failed: | 247 for f, target, node in sorted(failed): |
248 msgs.append(_(" %s in %s should not have %s line endings") % | 248 msgs.append(_(" %s in %s should not have %s line endings") % |
249 (f, node, eols[target])) | 249 (f, node, eols[target])) |
250 raise error.Abort(_("end-of-line check failed:\n") + "\n".join(msgs)) | 250 raise error.Abort(_("end-of-line check failed:\n") + "\n".join(msgs)) |
251 | 251 |
252 def checkallhook(ui, repo, node, hooktype, **kwargs): | 252 def checkallhook(ui, repo, node, hooktype, **kwargs): |