revsets: actually catch type error on tip^p1(tip) (issue2884) stable
authorMatt Mackall <mpm@selenic.com>
Tue, 12 Jul 2011 12:35:03 -0500
branchstable
changeset 14851 f96c354493d7
parent 14850 a95242af945c
child 14858 1a52f04ac51b
child 14861 6ed2a449cb5b
revsets: actually catch type error on tip^p1(tip) (issue2884) The previous commit was empty.
mercurial/revset.py
--- a/mercurial/revset.py	Sat Jul 09 09:44:15 2011 +0200
+++ b/mercurial/revset.py	Tue Jul 12 12:35:03 2011 -0500
@@ -217,7 +217,7 @@
     """
     try:
         n = int(n[1])
-    except ValueError:
+    except (TypeError, ValueError):
         raise error.ParseError(_("~ expects a number"))
     ps = set()
     cl = repo.changelog
@@ -521,7 +521,7 @@
     try:
         # i18n: "limit" is a keyword
         lim = int(getstring(l[1], _("limit requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "limit" is a keyword
         raise error.ParseError(_("limit expects a number"))
     ss = set(subset)
@@ -537,7 +537,7 @@
     try:
         # i18n: "last" is a keyword
         lim = int(getstring(l[1], _("last requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "last" is a keyword
         raise error.ParseError(_("last expects a number"))
     ss = set(subset)
@@ -676,7 +676,7 @@
         n = int(n[1])
         if n not in (0, 1, 2):
             raise ValueError
-    except ValueError:
+    except (TypeError, ValueError):
         raise error.ParseError(_("^ expects a number 0, 1, or 2"))
     ps = set()
     cl = repo.changelog
@@ -718,7 +718,7 @@
     try:
         # i18n: "rev" is a keyword
         l = int(getstring(l[0], _("rev requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "rev" is a keyword
         raise error.ParseError(_("rev expects a number"))
     return [r for r in subset if r == l]