Mercurial > hg
comparison hgext/rebase.py @ 44168:1cb7ae9b0071
rebase: move some variables after an error cases where they're not needed
Differential Revision: https://phab.mercurial-scm.org/D7905
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 15 Jan 2020 17:15:45 -0800 |
parents | 4263aaab651d |
children | d4c1501225c4 |
comparison
equal
deleted
inserted
replaced
44167:4263aaab651d | 44168:1cb7ae9b0071 |
---|---|
1791 l, i = min( | 1791 l, i = min( |
1792 (len(revs), i) | 1792 (len(revs), i) |
1793 for i, revs in enumerate(unwanted) | 1793 for i, revs in enumerate(unwanted) |
1794 if revs is not None | 1794 if revs is not None |
1795 ) | 1795 ) |
1796 base = bases[i] | |
1797 | |
1798 # newps[0] should match merge base if possible. Currently, if newps[i] | |
1799 # is nullrev, the only case is newps[i] and newps[j] (j < i), one is | |
1800 # the other's ancestor. In that case, it's fine to not swap newps here. | |
1801 # (see CASE-1 and CASE-2 above) | |
1802 if i != 0 and newps[i] != nullrev: | |
1803 newps[0], newps[i] = newps[i], newps[0] | |
1804 | 1796 |
1805 # The merge will include unwanted revisions. Abort now. Revisit this if | 1797 # The merge will include unwanted revisions. Abort now. Revisit this if |
1806 # we have a more advanced merge algorithm that handles multiple bases. | 1798 # we have a more advanced merge algorithm that handles multiple bases. |
1807 if l > 0: | 1799 if l > 0: |
1808 unwanteddesc = _(b' or ').join( | 1800 unwanteddesc = _(b' or ').join( |
1814 ) | 1806 ) |
1815 raise error.Abort( | 1807 raise error.Abort( |
1816 _(b'rebasing %d:%s will include unwanted changes from %s') | 1808 _(b'rebasing %d:%s will include unwanted changes from %s') |
1817 % (rev, repo[rev], unwanteddesc) | 1809 % (rev, repo[rev], unwanteddesc) |
1818 ) | 1810 ) |
1811 | |
1812 base = bases[i] | |
1813 | |
1814 # newps[0] should match merge base if possible. Currently, if newps[i] | |
1815 # is nullrev, the only case is newps[i] and newps[j] (j < i), one is | |
1816 # the other's ancestor. In that case, it's fine to not swap newps here. | |
1817 # (see CASE-1 and CASE-2 above) | |
1818 if i != 0 and newps[i] != nullrev: | |
1819 newps[0], newps[i] = newps[i], newps[0] | |
1819 | 1820 |
1820 repo.ui.debug(b" future parents are %d and %d\n" % tuple(newps)) | 1821 repo.ui.debug(b" future parents are %d and %d\n" % tuple(newps)) |
1821 | 1822 |
1822 return newps[0], newps[1], base | 1823 return newps[0], newps[1], base |
1823 | 1824 |