revsets: make bookmark/named('re:nonexistent') not abort (issue6018) (BC)
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 05 Nov 2018 09:09:48 -0800
changeset 40534 7ed611c60168
parent 40533 2ecf5c24d0cd
child 40535 473510bf0575
revsets: make bookmark/named('re:nonexistent') not abort (issue6018) (BC) Foozy documented the differences between revsets branch(), tag(), bookmark(), and named() in eeb5d5ab14a6 (revset: raise RepoLookupError to make present() predicate continue the query, 2015-01-31). He seemed to want tag() to change behavior to not error out on non-matching regular expressions. I think it's instead bookmark() and named() that should not error out. So that's what this patch does. Differential Revision: https://phab.mercurial-scm.org/D5220
mercurial/revset.py
tests/test-bookmarks.t
tests/test-revset2.t
--- a/mercurial/revset.py	Mon Nov 05 16:05:45 2018 -0800
+++ b/mercurial/revset.py	Mon Nov 05 09:09:48 2018 -0800
@@ -466,9 +466,6 @@
             for name, bmrev in repo._bookmarks.iteritems():
                 if matcher(name):
                     matchrevs.add(bmrev)
-            if not matchrevs:
-                raise error.RepoLookupError(_("no bookmarks exist"
-                                              " that match '%s'") % pattern)
             for bmrev in matchrevs:
                 bms.add(repo[bmrev].rev())
     else:
@@ -1330,9 +1327,6 @@
         for name, ns in repo.names.iteritems():
             if matcher(name):
                 namespaces.add(ns)
-        if not namespaces:
-            raise error.RepoLookupError(_("no namespace exists"
-                                          " that match '%s'") % pattern)
 
     names = set()
     for ns in namespaces:
--- a/tests/test-bookmarks.t	Mon Nov 05 16:05:45 2018 -0800
+++ b/tests/test-bookmarks.t	Mon Nov 05 09:09:48 2018 -0800
@@ -202,8 +202,6 @@
   abort: bookmark 'unknown' does not exist!
   [255]
   $ hg log -r 'bookmark("re:unknown")'
-  abort: no bookmarks exist that match 'unknown'!
-  [255]
   $ hg log -r 'present(bookmark("literal:unknown"))'
   $ hg log -r 'present(bookmark("re:unknown"))'
 
--- a/tests/test-revset2.t	Mon Nov 05 16:05:45 2018 -0800
+++ b/tests/test-revset2.t	Mon Nov 05 09:09:48 2018 -0800
@@ -669,8 +669,6 @@
   abort: namespace 'unknown' does not exist!
   [255]
   $ log 'named("re:unknown")'
-  abort: no namespace exists that match 'unknown'!
-  [255]
   $ log 'present(named("unknown"))'
   $ log 'present(named("re:unknown"))'