mercurial/logcmdutil.py
changeset 46041 9c0db3671008
parent 45942 89a2afe31e82
child 46042 1bf2b44c4007
--- a/mercurial/logcmdutil.py	Tue Dec 01 19:23:23 2020 +0900
+++ b/mercurial/logcmdutil.py	Tue Dec 01 19:32:36 2020 +0900
@@ -691,6 +691,7 @@
     revspec = attr.ib()  # type: List[bytes]
 
     # miscellaneous queries to filter revisions (see "hg help log" for details)
+    bookmarks = attr.ib(default=attr.Factory(list))  # type: List[bytes]
     branches = attr.ib(default=attr.Factory(list))  # type: List[bytes]
     date = attr.ib(default=None)  # type: Optional[bytes]
     keywords = attr.ib(default=attr.Factory(list))  # type: List[bytes]
@@ -746,6 +747,7 @@
         pats=pats,
         opts=opts,
         revspec=opts.get(b'rev', []),
+        bookmarks=opts.get(b'bookmark', []),
         # branch and only_branch are really aliases and must be handled at
         # the same time
         branches=opts.get(b'branch', []) + opts.get(b'only_branch', []),
@@ -937,6 +939,14 @@
                 val = [revsetlang.formatspec(revop, v) for v in val]
             expr.append(revsetlang.formatspec(listop, val))
 
+    if wopts.bookmarks:
+        expr.append(
+            revsetlang.formatspec(
+                b'%lr',
+                [scmutil.format_bookmark_revspec(v) for v in wopts.bookmarks],
+            )
+        )
+
     if expr:
         expr = b'(' + b' and '.join(expr) + b')'
     else:
@@ -1023,26 +1033,6 @@
     return revs, differ
 
 
-def get_bookmark_revs(repo, bookmark, walk_opts):
-    # type: (Any, bookmark, walk_opts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]
-    """Return (revs, differ) where revs is a smartset
-
-    differ is a changesetdiffer with pre-configured file matcher.
-    """
-    revs, filematcher = makewalker(repo, walk_opts)
-    if not revs:
-        return revs, None
-    differ = changesetdiffer()
-    differ._makefilematcher = filematcher
-
-    if bookmark:
-        if bookmark not in repo._bookmarks:
-            raise error.Abort(_(b"bookmark '%s' not found") % bookmark)
-        revs = scmutil.bookmarkrevs(repo, bookmark)
-
-    return revs, differ
-
-
 def _parselinerangeopt(repo, opts):
     """Parse --line-range log option and return a list of tuples (filename,
     (fromline, toline)).