##// END OF EJS Templates
graft: move "dry_run" and "base" in statedate...
marmoute -
r53229:8d702921 default
parent child Browse files
Show More
@@ -116,6 +116,7 def _process_args(ui, repo, *revs, **opt
116 116 b'user',
117 117 b'log',
118 118 b'no_commit',
119 b'dry_run',
119 120 ):
120 121 v = opts.get(o.decode('ascii'))
121 122 # if statedata is already set, it comes from --continue and test says
@@ -127,6 +128,7 def _process_args(ui, repo, *revs, **opt
127 128 basectx = None
128 129 if opts.get('base'):
129 130 basectx = logcmdutil.revsingle(repo, opts['base'], None)
131 statedata[b'base'] = basectx.hex()
130 132 if basectx is None:
131 133 # check for merges
132 134 for rev in repo.revs(b'%ld and merge()', revs):
@@ -217,10 +219,8 def _process_args(ui, repo, *revs, **opt
217 219 if not revs:
218 220 return None
219 221
220 if opts.get('base'):
221 statedata[b'base'] = opts['base']
222
223 return "GRAFT", [graftstate, statedata, revs, editor, basectx, cont, opts]
222 dry_run = bool(opts.get("dry_run"))
223 return "GRAFT", [graftstate, statedata, revs, editor, cont, dry_run, opts]
224 224
225 225
226 226 def _graft_revisions(
@@ -230,8 +230,8 def _graft_revisions(
230 230 statedata,
231 231 revs,
232 232 editor,
233 basectx,
234 233 cont=False,
234 dry_run=False,
235 235 opts,
236 236 ):
237 237 """actually graft some revisions"""
@@ -245,7 +245,7 def _graft_revisions(
245 245 if names:
246 246 desc += b' (%s)' % b' '.join(names)
247 247 ui.status(_(b'grafting %s\n') % desc)
248 if opts.get('dry_run'):
248 if dry_run:
249 249 continue
250 250
251 251 source = ctx.extra().get(b'source')
@@ -265,7 +265,10 def _graft_revisions(
265 265 if not cont:
266 266 # perform the graft merge with p1(rev) as 'ancestor'
267 267 overrides = {(b'ui', b'forcemerge'): opts.get('tool', b'')}
268 base = ctx.p1() if basectx is None else basectx
268 if b'base' in statedata:
269 base = repo[statedata[b'base']]
270 else:
271 base = ctx.p1()
269 272 with ui.configoverride(overrides, b'graft'):
270 273 stats = mergemod.graft(
271 274 repo, ctx, base, [b'local', b'graft', b'parent of graft']
@@ -300,7 +303,7 def _graft_revisions(
300 303 nn.append(node)
301 304
302 305 # remove state when we complete successfully
303 if not opts.get('dry_run'):
306 if not dry_run:
304 307 graftstate.delete()
305 308
306 309 return 0
General Comments 0
You need to be logged in to leave comments. Login now