Mercurial > hg-stable
changeset 33927:84f72072bde6
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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 03 Jul 2017 00:53:55 +0200 |
parents | 4074de97b512 |
children | dba493981284 |
files | mercurial/obsutil.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsutil.py Thu Aug 24 21:30:51 2017 -0700 +++ b/mercurial/obsutil.py Mon Jul 03 00:53:55 2017 +0200 @@ -327,6 +327,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 @@ -445,7 +448,7 @@ # 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 @@ -521,13 +524,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.