# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1606818203 -32400
#      Tue Dec 01 19:23:23 2020 +0900
# Node ID 3b3f53b5b57f32b10c6e5c8aacffab002fd793ea
# Parent  4439db4d98bc5d5d05b709d0886cb81b1347516e
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.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -2304,7 +2304,13 @@ def bookmarkrevs(repo, mark):
 
     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))",

_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to