Mercurial > hg
comparison hgext/rebase.py @ 44348:8082a77cc3a2
rebase: remove some redundant setting of dirstate parents
Since we're now setting the dirstate parents to its correct values
from the beginning (right after `merge.update()`), we usually don't
need to set them again before committing. The only case we need to
care about is when committing collapsed commits. So we can remove the
`setparents()` calls just before committing and add one only for the
collapse case.
Differential Revision: https://phab.mercurial-scm.org/D7828
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 10 Jan 2020 21:40:01 -0800 |
parents | 9c9cfecd4600 |
children | cd43cae79f25 |
comparison
equal
deleted
inserted
replaced
44347:9c9cfecd4600 | 44348:8082a77cc3a2 |
---|---|
695 commitmsg += b'\n* %s' % repo[rebased].description() | 695 commitmsg += b'\n* %s' % repo[rebased].description() |
696 editopt = True | 696 editopt = True |
697 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | 697 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) |
698 revtoreuse = max(self.state) | 698 revtoreuse = max(self.state) |
699 | 699 |
700 self.wctx.setparents(repo[p1].node(), repo[self.external].node()) | |
700 newnode = self._concludenode( | 701 newnode = self._concludenode( |
701 revtoreuse, p1, self.external, editor, commitmsg=commitmsg | 702 revtoreuse, p1, self.external, editor, commitmsg=commitmsg |
702 ) | 703 ) |
703 | 704 |
704 if newnode is not None: | 705 if newnode is not None: |
1431 # ``branch`` (used when passing ``--keepbranches``). | 1432 # ``branch`` (used when passing ``--keepbranches``). |
1432 branch = None | 1433 branch = None |
1433 if b'branch' in extra: | 1434 if b'branch' in extra: |
1434 branch = extra[b'branch'] | 1435 branch = extra[b'branch'] |
1435 | 1436 |
1436 wctx.setparents(repo[p1].node(), repo[p2].node()) | |
1437 memctx = wctx.tomemctx( | 1437 memctx = wctx.tomemctx( |
1438 commitmsg, | 1438 commitmsg, |
1439 date=date, | 1439 date=date, |
1440 extra=extra, | 1440 extra=extra, |
1441 user=user, | 1441 user=user, |
1452 Return node of committed revision.''' | 1452 Return node of committed revision.''' |
1453 dsguard = util.nullcontextmanager() | 1453 dsguard = util.nullcontextmanager() |
1454 if not repo.ui.configbool(b'rebase', b'singletransaction'): | 1454 if not repo.ui.configbool(b'rebase', b'singletransaction'): |
1455 dsguard = dirstateguard.dirstateguard(repo, b'rebase') | 1455 dsguard = dirstateguard.dirstateguard(repo, b'rebase') |
1456 with dsguard: | 1456 with dsguard: |
1457 repo.setparents(repo[p1].node(), repo[p2].node()) | |
1458 | |
1459 # Commit might fail if unresolved files exist | 1457 # Commit might fail if unresolved files exist |
1460 newnode = repo.commit( | 1458 newnode = repo.commit( |
1461 text=commitmsg, user=user, date=date, extra=extra, editor=editor | 1459 text=commitmsg, user=user, date=date, extra=extra, editor=editor |
1462 ) | 1460 ) |
1463 | 1461 |