I want to be able to change how we disambiguate and I think having
revlog.shortest() worry only about finding a prefix that's unambiguous
among nodeids makes more sense.
This slows down hg log -T '{shortest(node,1)}\n' from 4.0s to 4.1s.
indygreg |
hg-reviewers |
I want to be able to change how we disambiguate and I think having
revlog.shortest() worry only about finding a prefix that's unambiguous
among nodeids makes more sense.
This slows down hg log -T '{shortest(node,1)}\n' from 4.0s to 4.1s.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
+ def disambiguate(prefix):
+ """Disambiguate against revnums."""
+ hexnode = hex(node)
+ for length in range(len(prefix), 41):
Nit: range(len(prefix), len(hexnode) + 1) seems slightly better than
using a magic number outside the revlog module.
+ prefix = hexnode[:length]
+ if not isrev(prefix):
+ return prefix