[PATCH 10 of 16] rebase: move histedit suggestion to a rebase runtime object
Kostia Balytskyi
ikostia at fb.com
Sun May 29 18:38:41 EDT 2016
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464547233 -3600
# Sun May 29 19:40:33 2016 +0100
# Node ID 44f5af0d5d1057ab359aef0bcd1bc7f8b06376c3
# Parent 97669ad5e4d47a509a636a4e915e189a49f90bc5
rebase: move histedit suggestion to a rebase runtime object
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -122,6 +122,10 @@
class RebaseRuntimeState(object):
"""This class is a container for rebase runtime state"""
def __init__(self, repo, ui, opts):
+ self.repo = repo
+ self.ui = ui
+ self.opts = opts
+
self.originalwd = None
self.external = nullrev
# Mapping between the old revision id and either what is the new rebased
@@ -159,6 +163,18 @@
# other extensions
self.keepopen = opts.get('keepopen', False)
+ def validateoptions(self):
+ if self.opts.get('interactive'):
+ try:
+ if extensions.find('histedit'):
+ enablehistedit = ''
+ except KeyError:
+ enablehistedit = " --config extensions.histedit="
+ help = "hg%s help -e histedit" % enablehistedit
+ msg = _("interactive history editing is supported by the "
+ "'histedit' extension (see \"%s\")") % help
+ raise error.Abort(msg)
+
@command('rebase',
[('s', 'source', '',
_('rebase the specified changeset and descendants'), _('REV')),
@@ -270,23 +286,13 @@
"""
rtstate = RebaseRuntimeState(repo, ui, opts)
+ rtstate.validateoptions()
lock = wlock = None
try:
wlock = repo.wlock()
lock = repo.lock()
- if opts.get('interactive'):
- try:
- if extensions.find('histedit'):
- enablehistedit = ''
- except KeyError:
- enablehistedit = " --config extensions.histedit="
- help = "hg%s help -e histedit" % enablehistedit
- msg = _("interactive history editing is supported by the "
- "'histedit' extension (see \"%s\")") % help
- raise error.Abort(msg)
-
if rtstate.collapsemsg and not rtstate.collapsef:
raise error.Abort(
_('message can only be specified with collapse'))
More information about the Mercurial-devel
mailing list