Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 50121:927da152800c
dirstate-guard: remove its usage in `backout`
We can simply replace it with a transaction.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Feb 2023 00:40:27 +0100 |
parents | b54801fec664 |
children |
comparison
equal
deleted
inserted
replaced
50120:b54801fec664 | 50121:927da152800c |
---|---|
26 changegroup, | 26 changegroup, |
27 cmdutil, | 27 cmdutil, |
28 copies, | 28 copies, |
29 debugcommands as debugcommandsmod, | 29 debugcommands as debugcommandsmod, |
30 destutil, | 30 destutil, |
31 dirstateguard, | |
32 discovery, | 31 discovery, |
33 encoding, | 32 encoding, |
34 error, | 33 error, |
35 exchange, | 34 exchange, |
36 extensions, | 35 extensions, |
822 # the backout should appear on the same branch | 821 # the backout should appear on the same branch |
823 branch = repo.dirstate.branch() | 822 branch = repo.dirstate.branch() |
824 bheads = repo.branchheads(branch) | 823 bheads = repo.branchheads(branch) |
825 rctx = scmutil.revsingle(repo, hex(parent)) | 824 rctx = scmutil.revsingle(repo, hex(parent)) |
826 if not opts.get(b'merge') and op1 != node: | 825 if not opts.get(b'merge') and op1 != node: |
827 with dirstateguard.dirstateguard(repo, b'backout'): | 826 with repo.transaction(b"backout"): |
828 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} | 827 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} |
829 with ui.configoverride(overrides, b'backout'): | 828 with ui.configoverride(overrides, b'backout'): |
830 stats = mergemod.back_out(ctx, parent=repo[parent]) | 829 stats = mergemod.back_out(ctx, parent=repo[parent]) |
831 repo.setparents(op1, op2) | 830 repo.setparents(op1, op2) |
832 hg._showstats(repo, stats) | 831 hg._showstats(repo, stats) |