comparison mercurial/commands.py @ 2267:d812d91c5a84

Force editor to appear for an 'hg backout' if a message or logfile aren't supplied. Pre-fill the commit message with the changeset being backed out. Fixes bug 238.
author john.levon@sun.com
date Thu, 11 May 2006 14:32:09 -0700
parents 827fcfe88b14
children 6c9305fbebaf
comparison
equal deleted inserted replaced
2263:2f64cbaa1e92 2267:d812d91c5a84
787 revert(ui, repo, **revert_opts) 787 revert(ui, repo, **revert_opts)
788 commit_opts = opts.copy() 788 commit_opts = opts.copy()
789 commit_opts['addremove'] = False 789 commit_opts['addremove'] = False
790 if not commit_opts['message'] and not commit_opts['logfile']: 790 if not commit_opts['message'] and not commit_opts['logfile']:
791 commit_opts['message'] = _("Backed out changeset %s") % (hex(node)) 791 commit_opts['message'] = _("Backed out changeset %s") % (hex(node))
792 commit_opts['force_editor'] = True;
792 commit(ui, repo, **commit_opts) 793 commit(ui, repo, **commit_opts)
793 def nice(node): 794 def nice(node):
794 return '%d:%s' % (repo.changelog.rev(node), short(node)) 795 return '%d:%s' % (repo.changelog.rev(node), short(node))
795 ui.status(_('changeset %s backs out changeset %s\n') % 796 ui.status(_('changeset %s backs out changeset %s\n') %
796 (nice(repo.changelog.tip()), nice(node))) 797 (nice(repo.changelog.tip()), nice(node)))
985 repo.changes(files=fns, match=match)) 986 repo.changes(files=fns, match=match))
986 files = modified + added + removed 987 files = modified + added + removed
987 else: 988 else:
988 files = [] 989 files = []
989 try: 990 try:
990 repo.commit(files, message, opts['user'], opts['date'], match) 991 try:
992 force_editor = opts['force_editor']
993 except KeyError:
994 force_editor = False
995 repo.commit(files, message, opts['user'], opts['date'], match,
996 force_editor=force_editor)
991 except ValueError, inst: 997 except ValueError, inst:
992 raise util.Abort(str(inst)) 998 raise util.Abort(str(inst))
993 999
994 def docopy(ui, repo, pats, opts, wlock): 1000 def docopy(ui, repo, pats, opts, wlock):
995 # called with the repo lock held 1001 # called with the repo lock held