Mercurial > evolve
changeset 5260:1e2f3fa129f2
obshistory: prepare data for displaymarkers() in a separate function
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 16 Mar 2020 19:13:33 +0700 |
parents | 292de4cca111 |
children | 66a913cc53af |
files | hgext3rd/evolve/obshistory.py |
diffstat | 1 files changed, 17 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py Mon Jan 13 16:32:25 2020 +0700 +++ b/hgext3rd/evolve/obshistory.py Mon Mar 16 19:13:33 2020 +0700 @@ -136,6 +136,19 @@ b"patch": TEMPLATE_PATCH, } +def _nodesandmarkers(repo, ctx, filternonlocal): + if filternonlocal: + r = obsutil.successorsandmarkers(repo, ctx) + if r is None: + r = [] + for succset in sorted(r): + if succset[b'markers']: + yield (succset[b'successors'], succset[b'markers']) + else: + markers = repo.obsstore.successors.get(ctx.node(), ()) + for marker in sorted(markers): + yield (marker[1], [marker]) + class obsmarker_printer(logcmdutil.changesetprinter): """show (available) information about a node @@ -173,28 +186,10 @@ markerfm = fm.nested(b"markers") - # Succs markers - if self.filter is False: - succs = self.repo.obsstore.successors.get(changenode, ()) - succs = sorted(succs) - - for successor in succs: - displaymarkers(self.ui, markerfm, successor[1], - [successor], ctx.node(), self.repo, - self._includediff) - - else: - r = obsutil.successorsandmarkers(self.repo, ctx) - if r is None: - r = [] - - for succset in sorted(r): - markers = succset[b"markers"] - if not markers: - continue - successors = succset[b"successors"] - displaymarkers(self.ui, markerfm, successors, markers, - ctx.node(), self.repo, self._includediff) + data = _nodesandmarkers(self.repo, ctx, self.filter) + for nodes, markers in data: + displaymarkers(self.ui, markerfm, nodes, markers, ctx.node(), + self.repo, self._includediff) markerfm.end()