diff mercurial/revset.py @ 14851:f96c354493d7 stable

revsets: actually catch type error on tip^p1(tip) (issue2884) The previous commit was empty.
author Matt Mackall <mpm@selenic.com>
date Tue, 12 Jul 2011 12:35:03 -0500
parents 805651777188
children fc3d6f300d7d
line wrap: on
line diff
--- 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]