Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 35195:bc775b8cc020
scmutil: extra utility to display a reasonable amount of nodes
Push have some logic to display a reasonable amount nodes. We extract it to an
utility function to make it reusable.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 16 Nov 2017 03:52:38 +0100 |
parents | 9700cb9df140 |
children | 66ecde8a704d |
line wrap: on
line diff
--- a/mercurial/scmutil.py Fri Oct 06 04:17:36 2017 +0530 +++ b/mercurial/scmutil.py Thu Nov 16 03:52:38 2017 +0100 @@ -1280,6 +1280,12 @@ revrange = '%s:%s' % (minrev, maxrev) repo.ui.status(_('new changesets %s\n') % revrange) +def nodesummaries(repo, nodes, maxnumnodes=4): + if len(nodes) <= maxnumnodes or repo.ui.verbose: + return ' '.join(short(h) for h in nodes) + first = ' '.join(short(h) for h in nodes[:maxnumnodes]) + return _("%s and %s others") % (first, len(nodes) - maxnumnodes) + def wrapconvertsink(sink): """Allow extensions to wrap the sink returned by convcmd.convertsink() before it is used, whether or not the convert extension was formally loaded.