comparison hgext/histedit.py @ 22002:a44b7b6f3cd7

histedit: pass 'editform' argument to 'cmdutil.getcommiteditor' This patch passes 'editform' argument according to the format below: EXTENSION[.COMMAND][.ROUTE] - EXTENSION: name of extension - COMMAND: name of command, if there are two or more commands in EXTENSION - ROUTE: name of route, if there are two or more routes for COMMAND In this patch: - 'edit', 'fold', 'mess' and 'pick' are used as COMMAND - ROUTE is omitted 'histedit.pick' case is very rare, but possible if: - target revision causes conflict at merging (= requires '--continue'), and - description of it is empty ('hg commit -m " "' can create such one) In the code path for 'histedit --continue' (the last patch hunk), 'canonaction' doesn't contain the entry for 'fold', because 'fold' action causes: - using temporary commit message forcibly, and - making 'editopt' False always (= omit editor invocation if commit message is specified)
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 02 Aug 2014 21:46:26 +0900
parents af44c7a1e55e
children d5cef58d8ec8
comparison
equal deleted inserted replaced
22001:135176a198d0 22002:a44b7b6f3cd7
291 user = commitopts.get('user') 291 user = commitopts.get('user')
292 date = commitopts.get('date') 292 date = commitopts.get('date')
293 extra = commitopts.get('extra') 293 extra = commitopts.get('extra')
294 294
295 parents = (first.p1().node(), first.p2().node()) 295 parents = (first.p1().node(), first.p2().node())
296 editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
296 new = context.memctx(repo, 297 new = context.memctx(repo,
297 parents=parents, 298 parents=parents,
298 text=message, 299 text=message,
299 files=files, 300 files=files,
300 filectxfn=filectxfn, 301 filectxfn=filectxfn,
301 user=user, 302 user=user,
302 date=date, 303 date=date,
303 extra=extra, 304 extra=extra,
304 editor=cmdutil.getcommiteditor(edit=True)) 305 editor=editor)
305 return repo.commitctx(new) 306 return repo.commitctx(new)
306 307
307 def pick(ui, repo, ctx, ha, opts): 308 def pick(ui, repo, ctx, ha, opts):
308 oldctx = repo[ha] 309 oldctx = repo[ha]
309 if oldctx.parents()[0] == ctx: 310 if oldctx.parents()[0] == ctx:
403 if stats and stats[3] > 0: 404 if stats and stats[3] > 0:
404 raise error.InterventionRequired( 405 raise error.InterventionRequired(
405 _('Fix up the change and run hg histedit --continue')) 406 _('Fix up the change and run hg histedit --continue'))
406 message = oldctx.description() 407 message = oldctx.description()
407 commit = commitfuncfor(repo, oldctx) 408 commit = commitfuncfor(repo, oldctx)
409 editor = cmdutil.getcommiteditor(edit=True, editform='histedit.mess')
408 new = commit(text=message, user=oldctx.user(), date=oldctx.date(), 410 new = commit(text=message, user=oldctx.user(), date=oldctx.date(),
409 extra=oldctx.extra(), 411 extra=oldctx.extra(),
410 editor=cmdutil.getcommiteditor(edit=True)) 412 editor=editor)
411 newctx = repo[new] 413 newctx = repo[new]
412 if oldctx.node() != newctx.node(): 414 if oldctx.node() != newctx.node():
413 return newctx, [(oldctx.node(), (new,))] 415 return newctx, [(oldctx.node(), (new,))]
414 # We didn't make an edit, so just indicate no replaced nodes 416 # We didn't make an edit, so just indicate no replaced nodes
415 return newctx, [] 417 return newctx, []
682 if action in ('f', 'fold'): 684 if action in ('f', 'fold'):
683 message = 'fold-temp-revision %s' % currentnode 685 message = 'fold-temp-revision %s' % currentnode
684 else: 686 else:
685 message = ctx.description() 687 message = ctx.description()
686 editopt = action in ('e', 'edit', 'm', 'mess') 688 editopt = action in ('e', 'edit', 'm', 'mess')
687 editor = cmdutil.getcommiteditor(edit=editopt) 689 canonaction = {'e': 'edit', 'm': 'mess', 'p': 'pick'}
690 editform = 'histedit.%s' % canonaction.get(action, action)
691 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
688 commit = commitfuncfor(repo, ctx) 692 commit = commitfuncfor(repo, ctx)
689 new = commit(text=message, user=ctx.user(), 693 new = commit(text=message, user=ctx.user(),
690 date=ctx.date(), extra=ctx.extra(), 694 date=ctx.date(), extra=ctx.extra(),
691 editor=editor) 695 editor=editor)
692 if new is not None: 696 if new is not None: