Show More
@@ -8,18 +8,19 from .. import cmdutil, error, logcmduti | |||
|
8 | 8 | def cmd_graft(ui, repo, *revs, **opts): |
|
9 | 9 | """implement the graft command as defined in mercuria/commands.py""" |
|
10 | 10 | ret = _process_args(ui, repo, *revs, **opts) |
|
11 | if ret is None: | |
|
11 | action, graftstate, args = ret | |
|
12 | if action == "ERROR": | |
|
12 | 13 | return -1 |
|
13 | action, args = ret | |
|
14 | if action == "ABORT": | |
|
15 |
return cmdutil.abortgraft(ui, repo, |
|
|
14 | elif action == "ABORT": | |
|
15 | assert args is None | |
|
16 | return cmdutil.abortgraft(ui, repo, graftstate) | |
|
16 | 17 | elif action == "STOP": |
|
17 | return _stopgraft(ui, repo, *args) | |
|
18 | assert args is None | |
|
19 | return _stopgraft(ui, repo, graftstate) | |
|
18 | 20 | elif action == "GRAFT": |
|
19 | return _graft_revisions(ui, repo, *args) | |
|
21 | return _graft_revisions(ui, repo, graftstate, *args) | |
|
20 | 22 | else: |
|
21 | 23 | raise error.ProgrammingError(b'unknown action: %s' % action) |
|
22 | return 0 | |
|
23 | 24 | |
|
24 | 25 | |
|
25 | 26 | def _process_args(ui, repo, *revs, **opts): |
@@ -73,7 +74,7 def _process_args(ui, repo, *revs, **opt | |||
|
73 | 74 | 'rev', |
|
74 | 75 | ], |
|
75 | 76 | ) |
|
76 |
return "STOP", |
|
|
77 | return "STOP", graftstate, None | |
|
77 | 78 | elif opts.get('abort'): |
|
78 | 79 | cmdutil.check_incompatible_arguments( |
|
79 | 80 | opts, |
@@ -88,7 +89,7 def _process_args(ui, repo, *revs, **opt | |||
|
88 | 89 | 'rev', |
|
89 | 90 | ], |
|
90 | 91 | ) |
|
91 |
return "ABORT", |
|
|
92 | return "ABORT", graftstate, None | |
|
92 | 93 | elif opts.get('continue'): |
|
93 | 94 | cont = True |
|
94 | 95 | if revs: |
@@ -136,7 +137,7 def _process_args(ui, repo, *revs, **opt | |||
|
136 | 137 | skipped.add(rev) |
|
137 | 138 | revs = [r for r in revs if r not in skipped] |
|
138 | 139 | if not revs: |
|
139 | return None | |
|
140 | return "ERROR", None, None | |
|
140 | 141 | if basectx is not None and len(revs) != 1: |
|
141 | 142 | raise error.InputError(_(b'only one revision allowed with --base ')) |
|
142 | 143 | |
@@ -155,7 +156,7 def _process_args(ui, repo, *revs, **opt | |||
|
155 | 156 | revs = [r for r in revs if r not in ancestors] |
|
156 | 157 | |
|
157 | 158 | if not revs: |
|
158 | return None | |
|
159 | return "ERROR", None, None | |
|
159 | 160 | |
|
160 | 161 | # analyze revs for earlier grafts |
|
161 | 162 | ids = {} |
@@ -217,11 +218,11 def _process_args(ui, repo, *revs, **opt | |||
|
217 | 218 | ) |
|
218 | 219 | revs.remove(r) |
|
219 | 220 | if not revs: |
|
220 | return None | |
|
221 | return "ERROR", None, None | |
|
221 | 222 | |
|
222 | 223 | dry_run = bool(opts.get("dry_run")) |
|
223 | 224 | tool = opts.get('tool', b'') |
|
224 |
return "GRAFT", |
|
|
225 | return "GRAFT", graftstate, (statedata, revs, editor, cont, dry_run, tool) | |
|
225 | 226 | |
|
226 | 227 | |
|
227 | 228 | def _graft_revisions( |
General Comments 0
You need to be logged in to leave comments.
Login now