Mercurial > hg
comparison hgext/rebase.py @ 44856:b7808443ed6a
mergestate: split out merge state handling code from main merge module
There's already some pretty reasonable encapsulation here, but I want
to make the mergestate storage a property of the context so memctx
instances can do a reasonable thing. This is the first step in a
reshuffle to make that easier.
Differential Revision: https://phab.mercurial-scm.org/D8550
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 18 May 2020 14:59:59 -0400 |
parents | e7af56a0733e |
children | 78cafd48b9b2 |
comparison
equal
deleted
inserted
replaced
44855:1d2d353e5c4a | 44856:b7808443ed6a |
---|---|
34 dirstateguard, | 34 dirstateguard, |
35 error, | 35 error, |
36 extensions, | 36 extensions, |
37 hg, | 37 hg, |
38 merge as mergemod, | 38 merge as mergemod, |
39 mergestate as mergestatemod, | |
39 mergeutil, | 40 mergeutil, |
40 node as nodemod, | 41 node as nodemod, |
41 obsolete, | 42 obsolete, |
42 obsutil, | 43 obsutil, |
43 patch, | 44 patch, |
535 commitmsg=commitmsg, | 536 commitmsg=commitmsg, |
536 editor=editor, | 537 editor=editor, |
537 user=ctx.user(), | 538 user=ctx.user(), |
538 date=date, | 539 date=date, |
539 ) | 540 ) |
540 mergemod.mergestate.clean(repo) | 541 mergestatemod.mergestate.clean(repo) |
541 else: | 542 else: |
542 newnode = commitnode( | 543 newnode = commitnode( |
543 repo, | 544 repo, |
544 extra=extra, | 545 extra=extra, |
545 commitmsg=commitmsg, | 546 commitmsg=commitmsg, |
1072 b' merge\n' | 1073 b' merge\n' |
1073 ) | 1074 ) |
1074 ) | 1075 ) |
1075 # TODO: Make in-memory merge not use the on-disk merge state, so | 1076 # TODO: Make in-memory merge not use the on-disk merge state, so |
1076 # we don't have to clean it here | 1077 # we don't have to clean it here |
1077 mergemod.mergestate.clean(repo) | 1078 mergestatemod.mergestate.clean(repo) |
1078 clearstatus(repo) | 1079 clearstatus(repo) |
1079 clearcollapsemsg(repo) | 1080 clearcollapsemsg(repo) |
1080 return _dorebase(ui, repo, action, opts, inmemory=False) | 1081 return _dorebase(ui, repo, action, opts, inmemory=False) |
1081 else: | 1082 else: |
1082 return _dorebase(ui, repo, action, opts) | 1083 return _dorebase(ui, repo, action, opts) |
1173 _(b'cannot use collapse with continue or abort') | 1174 _(b'cannot use collapse with continue or abort') |
1174 ) | 1175 ) |
1175 if action == b'abort' and opts.get(b'tool', False): | 1176 if action == b'abort' and opts.get(b'tool', False): |
1176 ui.warn(_(b'tool option will be ignored\n')) | 1177 ui.warn(_(b'tool option will be ignored\n')) |
1177 if action == b'continue': | 1178 if action == b'continue': |
1178 ms = mergemod.mergestate.read(repo) | 1179 ms = mergestatemod.mergestate.read(repo) |
1179 mergeutil.checkunresolved(ms) | 1180 mergeutil.checkunresolved(ms) |
1180 | 1181 |
1181 retcode = rbsrt._prepareabortorcontinue( | 1182 retcode = rbsrt._prepareabortorcontinue( |
1182 isabort=(action == b'abort') | 1183 isabort=(action == b'abort') |
1183 ) | 1184 ) |
2183 | 2184 |
2184 | 2185 |
2185 def continuerebase(ui, repo): | 2186 def continuerebase(ui, repo): |
2186 with repo.wlock(), repo.lock(): | 2187 with repo.wlock(), repo.lock(): |
2187 rbsrt = rebaseruntime(repo, ui) | 2188 rbsrt = rebaseruntime(repo, ui) |
2188 ms = mergemod.mergestate.read(repo) | 2189 ms = mergestatemod.mergestate.read(repo) |
2189 mergeutil.checkunresolved(ms) | 2190 mergeutil.checkunresolved(ms) |
2190 retcode = rbsrt._prepareabortorcontinue(isabort=False) | 2191 retcode = rbsrt._prepareabortorcontinue(isabort=False) |
2191 if retcode is not None: | 2192 if retcode is not None: |
2192 return retcode | 2193 return retcode |
2193 rbsrt._performrebase(None) | 2194 rbsrt._performrebase(None) |