Mercurial > hg
changeset 27790:2d294dada4f8
rebase: small refactoring to allow better extensibility from extensions
Inhibit, one of evolve's extension, would like to change the way rebase works
with obsolete changesets. During a rebase with inhibit, the inhibition of the
obsolescence markers should be lifted for the rebase.
With this small refactoring, inhibit and can wrap the _filterobsoleterevs
function to lift inhibition cleanly and at the same time this change makes
rebases' code more legible.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 14 Jan 2016 11:50:28 -0800 |
parents | 63116d47cc3f |
children | 0029c2bebc23 |
files | hgext/rebase.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Thu Jan 14 13:33:08 2016 -0800 +++ b/hgext/rebase.py Thu Jan 14 11:50:28 2016 -0800 @@ -343,8 +343,7 @@ obsoletenotrebased = {} if ui.configbool('experimental', 'rebaseskipobsolete'): rebasesetrevs = set(rebaseset) - rebaseobsrevs = set(r for r in rebasesetrevs - if repo[r].obsolete()) + rebaseobsrevs = _filterobsoleterevs(repo, rebasesetrevs) obsoletenotrebased = _computeobsoletenotrebased(repo, rebaseobsrevs, dest) @@ -1188,6 +1187,10 @@ blockers.update(getattr(repo, '_rebaseset', ())) return blockers +def _filterobsoleterevs(repo, revs): + """returns a set of the obsolete revisions in revs""" + return set(r for r in revs if repo[r].obsolete()) + def _computeobsoletenotrebased(repo, rebaseobsrevs, dest): """return a mapping obsolete => successor for all obsolete nodes to be rebased that have a successors in the destination