Mercurial > hg
comparison hgext/rebase.py @ 39919:0428feb1f0d7
rebase: explicitly track collapses as fold
A collapse is a large fold. It is now explicitly tracked (at the cleanupnodes
API level).
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 26 Sep 2018 22:45:44 +0200 |
parents | a8318c9cb2ad |
children | c303d65d2e34 |
comparison
equal
deleted
inserted
replaced
39918:a8318c9cb2ad | 39919:0428feb1f0d7 |
---|---|
1762 """ | 1762 """ |
1763 tonode = repo.changelog.node | 1763 tonode = repo.changelog.node |
1764 replacements = {} | 1764 replacements = {} |
1765 moves = {} | 1765 moves = {} |
1766 stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt) | 1766 stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt) |
1767 | |
1768 collapsednodes = [] | |
1767 for rev, newrev in sorted(state.items()): | 1769 for rev, newrev in sorted(state.items()): |
1768 if newrev >= 0 and newrev != rev: | 1770 if newrev >= 0 and newrev != rev: |
1769 oldnode = tonode(rev) | 1771 oldnode = tonode(rev) |
1770 newnode = collapsedas or tonode(newrev) | 1772 newnode = collapsedas or tonode(newrev) |
1771 moves[oldnode] = newnode | 1773 moves[oldnode] = newnode |
1772 if not keepf: | 1774 if not keepf: |
1773 succs = None | 1775 succs = None |
1774 if rev in skipped: | 1776 if rev in skipped: |
1775 if stripcleanup or not repo[rev].obsolete(): | 1777 if stripcleanup or not repo[rev].obsolete(): |
1776 succs = () | 1778 succs = () |
1779 elif collapsedas: | |
1780 collapsednodes.append(oldnode) | |
1777 else: | 1781 else: |
1778 succs = (newnode,) | 1782 succs = (newnode,) |
1779 if succs is not None: | 1783 if succs is not None: |
1780 replacements[(oldnode,)] = succs | 1784 replacements[(oldnode,)] = succs |
1785 if collapsednodes: | |
1786 replacements[tuple(collapsednodes)] = (collapsedas,) | |
1781 scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup) | 1787 scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup) |
1782 if fm: | 1788 if fm: |
1783 hf = fm.hexfunc | 1789 hf = fm.hexfunc |
1784 fl = fm.formatlist | 1790 fl = fm.formatlist |
1785 fd = fm.formatdict | 1791 fd = fm.formatdict |