revlogdag: add linearize function
See the docstring for a detailed explanation. The linearizer was originally
written by Benoit Boissinot.
Ancestors of 54 2 0 Ancestors of 6 and 53 4 2 1 0 Ancestors of 5 and 44 2 0 Descendants of 57 8 Descendants of 5 and 36 7 8 Descendants of 5 and 45 7 8