Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/logcmdutil.py @ 45915:0aa118f18d4b
log: add bookmark option to "hg log"
Before pushing a bookmark with "hg push origin -B 'my-topic'", it is useful to inspect
the list of commits that are ancestors of the bookmark.
By relying on scmutil.bookmarkrevs(), "hg log -B topic" has the same bookmark semantics
found in other commands like hg export, hg email, hg strip.
Differential Revision: https://phab.mercurial-scm.org/D9341
author | Sebastien Boisvert <sebhtml@protonmail.com> |
---|---|
date | Tue, 17 Nov 2020 21:30:50 -0500 |
parents | 1f7c077e0640 |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
45914:f96059fa519c | 45915:0aa118f18d4b |
---|---|
1022 differ = changesetdiffer() | 1022 differ = changesetdiffer() |
1023 differ._makefilematcher = filematcher | 1023 differ._makefilematcher = filematcher |
1024 return revs, differ | 1024 return revs, differ |
1025 | 1025 |
1026 | 1026 |
1027 def get_bookmark_revs(repo, bookmark, walk_opts): | |
1028 # type: (Any, bookmark, walk_opts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]] | |
1029 """Return (revs, differ) where revs is a smartset | |
1030 | |
1031 differ is a changesetdiffer with pre-configured file matcher. | |
1032 """ | |
1033 revs, filematcher = makewalker(repo, walk_opts) | |
1034 if not revs: | |
1035 return revs, None | |
1036 differ = changesetdiffer() | |
1037 differ._makefilematcher = filematcher | |
1038 | |
1039 if bookmark: | |
1040 if bookmark not in repo._bookmarks: | |
1041 raise error.Abort(_(b"bookmark '%s' not found") % bookmark) | |
1042 revs = scmutil.bookmarkrevs(repo, bookmark) | |
1043 | |
1044 return revs, differ | |
1045 | |
1046 | |
1027 def _parselinerangeopt(repo, opts): | 1047 def _parselinerangeopt(repo, opts): |
1028 """Parse --line-range log option and return a list of tuples (filename, | 1048 """Parse --line-range log option and return a list of tuples (filename, |
1029 (fromline, toline)). | 1049 (fromline, toline)). |
1030 """ | 1050 """ |
1031 linerangebyfname = [] | 1051 linerangebyfname = [] |