From a195867192e0e80c858a6712d2a4bfb19ea9b760 Mon Sep 17 00:00:00 2001 From: Mads Kiilerich Date: Wed, 22 Oct 2014 16:10:23 +0200 Subject: [PATCH] eol: fix crash when handling removed files ci --amend would in some cases fail after 2eef89bfd70d failed to refactor the eol extension too. --- hgext/eol.py | 6 +++--- tests/test-eol.t | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hgext/eol.py b/hgext/eol.py index fa6dfa7d5c..e9b34fca1b 100644 --- a/hgext/eol.py +++ b/hgext/eol.py @@ -333,10 +333,10 @@ def reposetup(ui, repo): 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 diff --git a/tests/test-eol.t b/tests/test-eol.t index 2b8f58536b..4c6fc140c0 100644 --- a/tests/test-eol.t +++ b/tests/test-eol.t @@ -525,4 +525,19 @@ append a line without trailing newline 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 ..