This is an archive of the discontinued Mercurial Phabricator instance.

show: use consistent node lengths
AbandonedPublic

Authored by indygreg on Aug 28 2017, 11:55 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

hg show makes heavy use of shortest() to limit the length of the node
hash.

For the "stack" and "work" views, you are often looking at multiple
lines of similar output for "lines" of work. It is visually appeasing
for things to vertically align. A naive use of {shortest(node, N)}
could result in variable length nodes and for the first character of
the description to vary by a column or two.

We implement a function to determine the longest shortest prefix for
a set of revisions. The new function is used to determine the printed
node length for all hg show views.

Testing this will be deferred to a subsequent commit.

.. feature::

show: use consistent node length in views

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Aug 28 2017, 11:55 PM
quark added a subscriber: quark.Aug 29 2017, 12:06 AM
quark added inline comments.
hgext/show.py
428

How about minlen=4? It could be useful in small repos.

440

I'd call low level function without template and maintain a current minlen to reduce calculation.

yuja added a subscriber: yuja.Aug 29 2017, 10:15 AM
yuja added inline comments.
hgext/show.py
428

minlen=4 seems better than 3. _partialmatch() falls through to
slow path if nodelen < 4.

indygreg added inline comments.Sep 14 2017, 12:14 AM
hgext/show.py
440

The current minlen code is semi-tightly integrated with the templating layer.

I agree with you that a generic function should be established. But I considered that scope bloat and figured it was territory for a follow-up.

indygreg abandoned this revision.Sep 14 2017, 12:20 AM

This got rolled into D558. hg phabsend didn't appear smart enough to discard it from Phabricator when I pushed the new stack.