Mercurial > hg
diff mercurial/obsolete.py @ 33145:0a370b93cca2
obsutil: move 'allsuccessors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to bring
'obsolete.py' back to a more reasonable size.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 27 Jun 2017 01:36:20 +0200 |
parents | d0e5bf12f314 |
children | 7017567ebdf2 |
line wrap: on
line diff
--- a/mercurial/obsolete.py Tue Jun 27 01:31:18 2017 +0200 +++ b/mercurial/obsolete.py Tue Jun 27 01:36:20 2017 +0200 @@ -869,27 +869,6 @@ for data in ctx.repo().obsstore.successors.get(ctx.node(), ()): yield marker(ctx.repo(), data) -def allsuccessors(obsstore, nodes, ignoreflags=0): - """Yield node for every successor of <nodes>. - - Some successors may be unknown locally. - - This is a linear yield unsuited to detecting split changesets. It includes - initial nodes too.""" - remaining = set(nodes) - seen = set(remaining) - while remaining: - current = remaining.pop() - yield current - for mark in obsstore.successors.get(current, ()): - # ignore marker flagged with specified flag - if mark[2] & ignoreflags: - continue - for suc in mark[1]: - if suc not in seen: - seen.add(suc) - remaining.add(suc) - def foreground(repo, nodes): """return all nodes in the "foreground" of other node @@ -911,7 +890,7 @@ plen = len(foreground) succs = set(c.node() for c in foreground) mutable = [c.node() for c in foreground if c.mutable()] - succs.update(allsuccessors(repo.obsstore, mutable)) + succs.update(obsutil.allsuccessors(repo.obsstore, mutable)) known = (n for n in succs if n in nm) foreground = set(repo.set('%ln::', known)) return set(c.node() for c in foreground) @@ -922,6 +901,11 @@ util.nouideprecwarn(movemsg, '4.3') return obsutil.allprecursors(obsstore, nodes, ignoreflags) +def allsuccessors(obsstore, nodes, ignoreflags=0): + movemsg = 'obsolete.allsuccessors moved to obsutil.allsuccessors' + util.nouideprecwarn(movemsg, '4.3') + return obsutil.allsuccessors(obsstore, nodes, ignoreflags) + def exclusivemarkers(repo, nodes): movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers' repo.ui.deprecwarn(movemsg, '4.3')