changeset 13914:27573f2ddfb9

revset: abort when tag or bookmark doesn't exist
author Idan Kamara <idankk86@gmail.com>
date Thu, 07 Apr 2011 19:24:16 +0300
parents d3f90ff904b8
children 8f81d6f4047f
files mercurial/revset.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Apr 07 15:08:15 2011 -0500
+++ b/mercurial/revset.py	Thu Apr 07 19:24:16 2011 +0300
@@ -664,6 +664,8 @@
         tn = getstring(args[0],
                        # i18n: "tag" is a keyword
                        _('the argument to tag must be a string'))
+        if not repo.tags().get(tn, None):
+            raise util.Abort(_("tag '%s' does not exist") % tn)
         s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn])
     else:
         s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
@@ -683,8 +685,9 @@
                        # i18n: "bookmark" is a keyword
                        _('the argument to bookmark must be a string'))
         bmrev = bookmarksmod.listbookmarks(repo).get(bm, None)
-        if bmrev:
-            bmrev = repo[bmrev].rev()
+        if not bmrev:
+            raise util.Abort(_("bookmark '%s' does not exist") % bm)
+        bmrev = repo[bmrev].rev()
         return [r for r in subset if r == bmrev]
     bms = set([repo[r].rev()
                for r in bookmarksmod.listbookmarks(repo).values()])