[PATCH] eol: ignore IOError from deleted files in commitctx

Nicholas Riley njriley at illinois.edu
Tue Jul 12 11:11:57 CDT 2011


# HG changeset patch
# User Nicholas Riley <njriley at illinois.edu>
# Date 1310486771 14400
# Node ID 6bd3eb5e29eb5c54ada2cb17423fe2cbaed35e75
# Parent  09c9c120a817eae47152ab527ac0dad24016b268
eol: ignore IOError from deleted files in commitctx

A Mercurial repo signals a file is deleted by raising IOError when the
file's data is requested.  This IOError is normally caught by
localrepository.commitctx.  With the eol extension enabled and EOL
mappings in place, the eolrepo subclass should ignore IOError because
a deleted file has no line endings to process.

This issue exhibited itself when performing an incremental hg convert
of a revision with deleted files to a repo with an existing .hgeol
file.

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -318,7 +318,10 @@
             for f in sorted(ctx.added() + ctx.modified()):
                 if not self._eolfile(f):
                     continue
-                data = ctx[f].data()
+                try:
+                    data = ctx[f].data()
+                except IOError:
+                    continue
                 if util.binary(data):
                     # We should not abort here, since the user should
                     # be able to say "** = native" to automatically


More information about the Mercurial-devel mailing list