[Request] [+- ] D9317: log: use scmutil.bookmarkrevs to get the revisions of a bookmark
sebhtml (Sébastien Boisvert)
phabricator at mercurial-scm.org
Fri Nov 13 01:12:17 UTC 2020
sebhtml created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9317
AFFECTED FILES
mercurial/commands.py
mercurial/logcmdutil.py
CHANGE DETAILS
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -1021,6 +1021,24 @@
differ._makefilematcher = filematcher
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,
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4740,14 +4740,21 @@
)
repo = scmutil.unhidehashlikerevs(repo, opts.get(b'rev'), b'nowarn')
+ walk_opts = logcmdutil.parseopts(ui, pats, opts)
revs, differ = logcmdutil.getrevs(
- repo, logcmdutil.parseopts(ui, pats, opts)
+ repo, walk_opts
)
if linerange:
# TODO: should follow file history from logcmdutil._initialrevs(),
# then filter the result by logcmdutil._makerevset() and --limit
revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
+ if opts.get(b'bookmark'):
+ cmdutil.check_at_most_one_arg(opts, b'rev', b'bookmark')
+ bookmarks = opts.get(b'bookmark')
+ bookmark = bookmarks[0]
+ revs, differ = logcmdutil.get_bookmark_revs(repo, bookmark, walk_opts)
+
getcopies = None
if opts.get(b'copies'):
endrev = None
To: sebhtml, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201113/cf57d268/attachment-0001.html>
More information about the Mercurial-patches
mailing list