changeset 46040:9ee791f3278f

scmutil: extract function that builds revset expr to select bookmark branch This is needed to process "log -B" option properly. "log" options have to be translated to a revset expression, not to an evaluated set.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 01 Dec 2020 19:23:23 +0900
parents b9ebe0bfed4e
children 9c0db3671008
files mercurial/scmutil.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Dec 01 19:46:01 2020 +0900
+++ b/mercurial/scmutil.py	Tue Dec 01 19:23:23 2020 +0900
@@ -2304,7 +2304,13 @@
 
     If the bookmarked revision isn't a head, an empty set will be returned.
     """
-    return repo.revs(
+    return repo.revs(format_bookmark_revspec(mark))
+
+
+def format_bookmark_revspec(mark):
+    """Build a revset expression to select revisions reachable by a given
+    bookmark"""
+    return revsetlang.formatspec(
         b"ancestors(bookmark(%s)) - "
         b"ancestors(head() and not bookmark(%s)) - "
         b"ancestors(bookmark() and not bookmark(%s))",