diff -r b9ebe0bfed4e -r 9ee791f3278f mercurial/scmutil.py --- 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))",