This is an archive of the discontinued Mercurial Phabricator instance.

dagop: extract headsetofconnecteds() from dagutil
ClosedPublic

Authored by indygreg on Aug 17 2018, 5:31 PM.

Details

Summary

The functionality for resolving the set of DAG heads from a
subset simply requires a function to resolve parent revisions.

Let's establish a function in the dagop module to do this, which
seems to be where generic DAG functionality goes these days.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Aug 17 2018, 5:31 PM
yuja added a subscriber: yuja.Aug 18 2018, 4:05 AM

+def headrevs(revs, parentsfn):
+ """Resolve the set of heads from a set of revisions.
+
+ Receives an iterable of revision numbers and a callbable that receives a
+ revision number and returns an iterable of parent revision numbers, possibly
+ including nullrev.
+
+ Returns a set of revision numbers that are DAG heads within the passed subset.
+ """
+ headrevs = set()

Absorbed fix from D4328 since this never be non-empty set.

Overall, the series looks really nice. Thanks.

This revision was automatically updated to reflect the committed changes.