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