Patchwork [1,of,2,STABLE] eol: import 'error' as 'errormod'

login
register
mail settings
Submitter Pierre-Yves David
Date June 23, 2017, 11:28 a.m.
Message ID <c5e43ff544782b1bbd13.1498217311@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21629/
State Accepted
Headers show

Comments

Pierre-Yves David - June 23, 2017, 11:28 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498217085 -7200
#      Fri Jun 23 13:24:45 2017 +0200
# Branch stable
# Node ID c5e43ff544782b1bbd1337ffa1b1802e6144df81
# Parent  d3ab31bf9c0e9cecef77f18d9648716be5fcfdb8
# EXP-Topic eolfix
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c5e43ff54478
eol: import 'error' as 'errormod'

We need the 'error' name available to fix another bug, so we rename the imported
module.
Yuya Nishihara - June 23, 2017, 2:27 p.m.
On Fri, 23 Jun 2017 13:28:31 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1498217085 -7200
> #      Fri Jun 23 13:24:45 2017 +0200
> # Branch stable
> # Node ID c5e43ff544782b1bbd1337ffa1b1802e6144df81
> # Parent  d3ab31bf9c0e9cecef77f18d9648716be5fcfdb8
> # EXP-Topic eolfix
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c5e43ff54478
> eol: import 'error' as 'errormod'

Queued, thanks.

Patch

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -98,7 +98,7 @@  import re
 from mercurial.i18n import _
 from mercurial import (
     config,
-    error,
+    error as errormod,
     extensions,
     match,
     pycompat,
@@ -225,7 +225,7 @@  def parseeol(ui, repo, nodes):
                 return eolfile(ui, repo.root, data)
             except (IOError, LookupError):
                 pass
-    except error.ParseError as inst:
+    except errormod.ParseError as inst:
         ui.warn(_("warning: ignoring .hgeol file due to parse error "
                   "at %s: %s\n") % (inst.args[1], inst.args[0]))
     return None
@@ -254,7 +254,7 @@  def _checkhook(ui, repo, node, headsonly
         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))
+        raise errormod.Abort(_("end-of-line check failed:\n") + "\n".join(msgs))
 
 def checkallhook(ui, repo, node, hooktype, **kwargs):
     """verify that files have expected EOLs"""
@@ -356,7 +356,7 @@  def reposetup(ui, repo):
                     # Write the cache to update mtime and cache .hgeol
                     with self.vfs("eol.cache", "w") as f:
                         f.write(hgeoldata)
-                except error.LockUnavailable:
+                except errormod.LockUnavailable:
                     # If we cannot lock the repository and clear the
                     # dirstate, then a commit might not see all files
                     # as modified. But if we cannot lock the
@@ -381,7 +381,7 @@  def reposetup(ui, repo):
                     # have all non-binary files taken care of.
                     continue
                 if inconsistenteol(data):
-                    raise error.Abort(_("inconsistent newline style "
+                    raise errormod.Abort(_("inconsistent newline style "
                                        "in %s\n") % f)
             return super(eolrepo, self).commitctx(ctx, haserror)
     repo.__class__ = eolrepo