# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1499036035 -7200 # Mon Jul 03 00:53:55 2017 +0200 # Node ID a3797b722e73a1390d0dc8cb4c4630e4fe177919 # Parent 50c44dee741ab99401bf0b3446fe4ae88ccd0bb2 # EXP-Topic obsfatetemplate obsolete: introduce a _succs class
It will be useful later when we will be adding markers to _succs in order to represent a successorset with the list of markers from the root to each successors sets. This information will be needed for the obsfate template I will introduce. Makes it a subclass of list so all callers will continue to work. diff -r 50c44dee741a -r a3797b722e73 mercurial/obsutil.py --- a/mercurial/obsutil.py Sun Aug 06 01:13:57 2017 +0900 +++ b/mercurial/obsutil.py Mon Jul 03 00:53:55 2017 +0200 @@ -311,6 +311,9 @@ obsoleted.add(rev) return obsoleted +class _succs(list): + """small class to represent a successors with some metadata about it""" + def successorssets(repo, initialnode, closest=False, cache=None): """Return set of all latest successors of initial nodes @@ -429,11 +432,11 @@ # case (2): end of walk. if current in repo: # We have a valid successors. - cache[current] = [(current,)] + cache[current] = [_succs((current,))] else: # Final obsolete version is unknown locally. # Do not count that as a valid successors - cache[current] = [] + cache[current] = _succs() else: # cases (3) and (4) # @@ -471,7 +474,7 @@ if suc not in cache: if suc in stackedset: # cycle breaking - cache[suc] = [] + cache[suc] = _succs() else: # case (3) If we have not computed successors sets # of one of those successors we add it to the @@ -505,13 +508,13 @@ succssets = [] for mark in sorted(succmarkers[current]): # successors sets contributed by this marker - markss = [[]] + markss = [_succs()] for suc in mark[1]: # cardinal product with previous successors productresult = [] for prefix in markss: for suffix in cache[suc]: - newss = list(prefix) + newss = _succs(prefix) for part in suffix: # do not duplicated entry in successors set # first entry wins. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel