Mercurial > hg
diff hgext/eol.py @ 13505:9b617c56eb65 stable
eol: do not abort on parse error
Handle parse errors in the .hgeol similarly to how parse errors in the
.hgtags file are handled: by issuing a warning. This allows the user
to revert the file using 'hg revert' or 'hg update -C'.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Mon, 28 Feb 2011 15:46:48 +0100 |
parents | c0f252757b41 |
children | b30a488762e1 |
line wrap: on
line diff
--- a/hgext/eol.py Mon Feb 28 11:34:51 2011 +0100 +++ b/hgext/eol.py Mon Feb 28 15:46:48 2011 +0100 @@ -152,7 +152,11 @@ def preupdate(ui, repo, hooktype, parent1, parent2): #print "preupdate for %s: %s -> %s" % (repo.root, parent1, parent2) - repo.readhgeol(parent1) + try: + repo.readhgeol(parent1) + except error.ParseError, inst: + ui.warn(_("warning: ignoring .hgeol file due to parse error " + "at %s: %s\n") % (inst.args[1], inst.args[0])) return False def uisetup(ui): @@ -233,7 +237,12 @@ return match.match(self.root, '', [], include, exclude) def _hgcleardirstate(self): - self._eolfile = self.readhgeol() or self.readhgeol('tip') + try: + self._eolfile = self.readhgeol() or self.readhgeol('tip') + except error.ParseError, inst: + ui.warn(_("warning: ignoring .hgeol file due to parse error " + "at %s: %s\n") % (inst.args[1], inst.args[0])) + self._eolfile = None if not self._eolfile: self._eolfile = util.never