Patchwork [1,of,6,sethelp,v2] error: add a new UnknownIdentifier error type

login
register
mail settings
Submitter Augie Fackler
Date March 6, 2015, 11:01 p.m.
Message ID <4bfb330ca07cdf5eb79c.1425682902@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7915/
State Accepted
Commit d2b81256db1eb20b4039df6c75e5f1245804f41d
Headers show

Comments

Augie Fackler - March 6, 2015, 11:01 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1422300661 18000
#      Mon Jan 26 14:31:01 2015 -0500
# Node ID 4bfb330ca07cdf5eb79c884007b3bfabe69a70bc
# Parent  4ef4e3c3c00693868ba428e21ac092e559e4fcea
error: add a new UnknownIdentifier error type

This will be used by the revset and fileset code to communicate more
specific errors to higher levels so that we might be able to offer
suggestions about what function might have been similar.

Patch

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -67,6 +67,15 @@  class OutOfBandError(Exception):
 class ParseError(Exception):
     """Raised when parsing config files and {rev,file}sets (msg[, pos])"""
 
+class UnknownIdentifier(ParseError):
+    """Exception raised when a {rev,file}set references an unknown identifier"""
+
+    def __init__(self, function, symbols):
+        from i18n import _
+        ParseError.__init__(self, _("unknown identifier: %s") % function)
+        self.function = function
+        self.symbols = symbols
+
 class RepoError(Exception):
     def __init__(self, *args, **kw):
         Exception.__init__(self, *args)