revset: abort when tag or bookmark doesn't exist
authorIdan Kamara <idankk86@gmail.com>
Thu, 07 Apr 2011 19:24:16 +0300
changeset 13914 27573f2ddfb9
parent 13913 d3f90ff904b8
child 13915 8f81d6f4047f
revset: abort when tag or bookmark doesn't exist
mercurial/revset.py
--- 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()])