eol: fix crash when handling removed files stable
authorMads Kiilerich <madski@unity3d.com>
Wed, 22 Oct 2014 16:10:23 +0200
branchstable
changeset 23068 fb3e63c603e8
parent 23067 420a051616ce
child 23069 22db405536be
eol: fix crash when handling removed files ci --amend would in some cases fail after 650b5b6e75ed failed to refactor the eol extension too.
hgext/eol.py
tests/test-eol.t
--- a/hgext/eol.py	Wed Oct 15 03:52:20 2014 -0700
+++ b/hgext/eol.py	Wed Oct 22 16:10:23 2014 +0200
@@ -333,10 +333,10 @@
             for f in sorted(ctx.added() + ctx.modified()):
                 if not self._eolfile(f):
                     continue
-                try:
-                    data = ctx[f].data()
-                except IOError:
+                fctx = ctx[f]
+                if fctx is None:
                     continue
+                data = fctx.data()
                 if util.binary(data):
                     # We should not abort here, since the user should
                     # be able to say "** = native" to automatically
--- a/tests/test-eol.t	Wed Oct 15 03:52:20 2014 -0700
+++ b/tests/test-eol.t	Wed Oct 22 16:10:23 2014 +0200
@@ -525,4 +525,19 @@
   fourth
   fifth
 
+amend of changesets with renamed/deleted files expose new code paths
+
+  $ hg mv a.txt b.txt
+  $ hg ci --amend -q
+  $ hg diff -c.
+  diff --git a/a.txt b/b.txt
+  rename from a.txt
+  rename to b.txt
+  --- a/a.txt
+  +++ b/b.txt
+  @@ -1,2 +1,3 @@
+   third
+   fourth
+  +fifth
+
   $ cd ..