Patchwork [01,of,10,PyPy] eol: make output stable

login
register
mail settings
Submitter Bryan O'Sullivan
Date Dec. 24, 2015, 12:22 a.m.
Message ID <5ec40b2c6abd4e3273fe.1450916536@bryano-mbp.local>
Download mbox | patch
Permalink /patch/12335/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Bryan O'Sullivan - Dec. 24, 2015, 12:22 a.m.
This eliminates a divergence in behaviour between PyPy and Python.

Patch

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -201,7 +201,7 @@  class eolfile(object):
                 data = ctx[f].data()
                 if (target == "to-lf" and "\r\n" in data
                     or target == "to-crlf" and singlelf.search(data)):
-                    failed.append((str(ctx), target, f))
+                    failed.append((f, target, str(ctx)))
                 break
         return failed
 
@@ -244,7 +244,7 @@  def _checkhook(ui, repo, node, headsonly
     if failed:
         eols = {'to-lf': 'CRLF', 'to-crlf': 'LF'}
         msgs = []
-        for node, target, f in failed:
+        for f, target, node in sorted(failed):
             msgs.append(_("  %s in %s should not have %s line endings") %
                         (f, node, eols[target]))
         raise error.Abort(_("end-of-line check failed:\n") + "\n".join(msgs))
diff --git a/tests/test-eol-hook.t b/tests/test-eol-hook.t
--- a/tests/test-eol-hook.t
+++ b/tests/test-eol-hook.t
@@ -206,13 +206,13 @@  Test multiple files/revisions output
   adding file changes
   added 3 changesets with 3 changes to 2 files (+1 heads)
   error: pretxnchangegroup hook failed: end-of-line check failed:
+    b.txt in fbcf9b1025f5 should not have CRLF line endings
     d.txt in a7040e68714f should not have CRLF line endings
-    b.txt in fbcf9b1025f5 should not have CRLF line endings
   transaction abort!
   rollback completed
   abort: end-of-line check failed:
+    b.txt in fbcf9b1025f5 should not have CRLF line endings
     d.txt in a7040e68714f should not have CRLF line endings
-    b.txt in fbcf9b1025f5 should not have CRLF line endings
   [255]
 
   $ cd ..