Mercurial > hg
comparison hgext/rebase.py @ 50063:a9562ea222be
dirstate-guard: replace a usage in `rebase` with a transaction
Opening the transaction sooner will provide us with the same benefit.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Feb 2023 00:39:49 +0100 |
parents | 6526c2fb777c |
children | cad3a68c0e0c |
comparison
equal
deleted
inserted
replaced
50062:6526c2fb777c | 50063:a9562ea222be |
---|---|
28 bookmarks, | 28 bookmarks, |
29 cmdutil, | 29 cmdutil, |
30 commands, | 30 commands, |
31 copies, | 31 copies, |
32 destutil, | 32 destutil, |
33 dirstateguard, | |
34 error, | 33 error, |
35 extensions, | 34 extensions, |
36 logcmdutil, | 35 logcmdutil, |
37 merge as mergemod, | 36 merge as mergemod, |
38 mergestate as mergestatemod, | 37 mergestate as mergestatemod, |
1492 | 1491 |
1493 | 1492 |
1494 def commitnode(repo, editor, extra, user, date, commitmsg): | 1493 def commitnode(repo, editor, extra, user, date, commitmsg): |
1495 """Commit the wd changes with parents p1 and p2. | 1494 """Commit the wd changes with parents p1 and p2. |
1496 Return node of committed revision.""" | 1495 Return node of committed revision.""" |
1497 dsguard = util.nullcontextmanager() | 1496 tr = util.nullcontextmanager |
1498 if not repo.ui.configbool(b'rebase', b'singletransaction'): | 1497 if not repo.ui.configbool(b'rebase', b'singletransaction'): |
1499 dsguard = dirstateguard.dirstateguard(repo, b'rebase') | 1498 tr = lambda: repo.transaction(b'rebase') |
1500 with dsguard: | 1499 with tr(): |
1501 # Commit might fail if unresolved files exist | 1500 # Commit might fail if unresolved files exist |
1502 newnode = repo.commit( | 1501 newnode = repo.commit( |
1503 text=commitmsg, user=user, date=date, extra=extra, editor=editor | 1502 text=commitmsg, user=user, date=date, extra=extra, editor=editor |
1504 ) | 1503 ) |
1505 | 1504 |