comparison mercurial/commands.py @ 38238:2b8c8b8d1a06

graft: reuse the --log value passed initially in `hg graft --continue` (BC) We now stores the value of --log flag passed initially in the graftstate and reuse that value when doing `hg graft --continue` which is a nice behavior. The test updates demonstrate the fix. Since we now preserve the value by default, drop the mention of `--log` flag from the hint which we see after conflicts. Differential Revision: https://phab.mercurial-scm.org/D3662
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 26 May 2018 03:01:14 +0530
parents ad50f0399e1e
children fa4a286410a5
comparison
equal deleted inserted replaced
38237:66fc2ef8dbff 38238:2b8c8b8d1a06
2228 statedata = _readgraftstate(repo, graftstate) 2228 statedata = _readgraftstate(repo, graftstate)
2229 if statedata.get('date'): 2229 if statedata.get('date'):
2230 opts['date'] = statedata['date'] 2230 opts['date'] = statedata['date']
2231 if statedata.get('user'): 2231 if statedata.get('user'):
2232 opts['user'] = statedata['user'] 2232 opts['user'] = statedata['user']
2233 if statedata.get('log'):
2234 opts['log'] = True
2233 nodes = statedata['nodes'] 2235 nodes = statedata['nodes']
2234 revs = [repo[node].rev() for node in nodes] 2236 revs = [repo[node].rev() for node in nodes]
2235 else: 2237 else:
2236 cmdutil.wrongtooltocontinue(repo, _('graft')) 2238 cmdutil.wrongtooltocontinue(repo, _('graft'))
2237 else: 2239 else:
2342 date = opts['date'] 2344 date = opts['date']
2343 statedata['date'] = date 2345 statedata['date'] = date
2344 message = ctx.description() 2346 message = ctx.description()
2345 if opts.get('log'): 2347 if opts.get('log'):
2346 message += '\n(grafted from %s)' % ctx.hex() 2348 message += '\n(grafted from %s)' % ctx.hex()
2349 statedata['log'] = True
2347 2350
2348 # we don't merge the first commit when continuing 2351 # we don't merge the first commit when continuing
2349 if not cont: 2352 if not cont:
2350 # perform the graft merge with p1(rev) as 'ancestor' 2353 # perform the graft merge with p1(rev) as 'ancestor'
2351 try: 2354 try:
2361 # write out state for --continue 2364 # write out state for --continue
2362 nodes = [repo[rev].hex() for rev in revs[pos:]] 2365 nodes = [repo[rev].hex() for rev in revs[pos:]]
2363 statedata['nodes'] = nodes 2366 statedata['nodes'] = nodes
2364 stateversion = 1 2367 stateversion = 1
2365 graftstate.save(stateversion, statedata) 2368 graftstate.save(stateversion, statedata)
2366 extra = '' 2369 hint = _("use 'hg resolve' and 'hg graft --continue'")
2367 if opts.get('log'):
2368 extra += ' --log'
2369 hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra
2370 raise error.Abort( 2370 raise error.Abort(
2371 _("unresolved conflicts, can't continue"), 2371 _("unresolved conflicts, can't continue"),
2372 hint=hint) 2372 hint=hint)
2373 else: 2373 else:
2374 cont = False 2374 cont = False