checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
--- a/hgext/histedit.py Mon Jul 22 10:04:53 2013 +0200
+++ b/hgext/histedit.py Thu Jul 25 02:17:52 2013 -0500
@@ -874,5 +874,5 @@
def extsetup(ui):
cmdutil.summaryhooks.add('histedit', summaryhook)
cmdutil.unfinishedstates.append(
- ['histedit-state', False, _('histedit in progress'),
+ ['histedit-state', False, True, _('histedit in progress'),
_("use 'hg histedit --continue' or 'hg histedit --abort'")])
--- a/hgext/rebase.py Mon Jul 22 10:04:53 2013 +0200
+++ b/hgext/rebase.py Thu Jul 25 02:17:52 2013 -0500
@@ -800,5 +800,5 @@
_("specify merge tool for rebase")))
cmdutil.summaryhooks.add('rebase', summaryhook)
cmdutil.unfinishedstates.append(
- ['rebasestate', False, _('rebase in progress'),
+ ['rebasestate', False, False, _('rebase in progress'),
_("use 'hg rebase --continue' or 'hg rebase --abort'")])
--- a/hgext/transplant.py Mon Jul 22 10:04:53 2013 +0200
+++ b/hgext/transplant.py Thu Jul 25 02:17:52 2013 -0500
@@ -685,7 +685,7 @@
revset.symbols['transplanted'] = revsettransplanted
templatekw.keywords['transplanted'] = kwtransplanted
cmdutil.unfinishedstates.append(
- ['series', True, _('transplant in progress'),
+ ['series', True, False, _('transplant in progress'),
_("use 'hg transplant --continue' or 'hg update' to abort")])
# tell hggettext to extract docstrings from these functions:
--- a/mercurial/cmdutil.py Mon Jul 22 10:04:53 2013 +0200
+++ b/mercurial/cmdutil.py Thu Jul 25 02:17:52 2013 -0500
@@ -2107,20 +2107,22 @@
# A list of state files kept by multistep operations like graft.
# Since graft cannot be aborted, it is considered 'clearable' by update.
# note: bisect is intentionally excluded
-# (state file, clearable, error, hint)
+# (state file, clearable, allowcommit, error, hint)
unfinishedstates = [
- ('graftstate', True, _('graft in progress'),
+ ('graftstate', True, False, _('graft in progress'),
_("use 'hg graft --continue' or 'hg update' to abort")),
- ('updatestate', True, _('last update was interrupted'),
+ ('updatestate', True, False, _('last update was interrupted'),
_("use 'hg update' to get a consistent checkout"))
]
-def checkunfinished(repo):
+def checkunfinished(repo, commit=False):
'''Look for an unfinished multistep operation, like graft, and abort
if found. It's probably good to check this right before
bailifchanged().
'''
- for f, clearable, msg, hint in unfinishedstates:
+ for f, clearable, allowcommit, msg, hint in unfinishedstates:
+ if commit and allowcommit:
+ continue
if repo.vfs.exists(f):
raise util.Abort(msg, hint=hint)
@@ -2128,9 +2130,9 @@
'''Check for unfinished operations (as above), and clear the ones
that are clearable.
'''
- for f, clearable, msg, hint in unfinishedstates:
+ for f, clearable, allowcommit, msg, hint in unfinishedstates:
if not clearable and repo.vfs.exists(f):
raise util.Abort(msg, hint=hint)
- for f, clearable, msg, hint in unfinishedstates:
+ for f, clearable, allowcommit, msg, hint in unfinishedstates:
if clearable and repo.vfs.exists(f):
util.unlink(repo.join(f))
--- a/mercurial/commands.py Mon Jul 22 10:04:53 2013 +0200
+++ b/mercurial/commands.py Thu Jul 25 02:17:52 2013 -0500
@@ -1336,7 +1336,7 @@
# Save this for restoring it later
oldcommitphase = ui.config('phases', 'new-commit')
- cmdutil.checkunfinished(repo)
+ cmdutil.checkunfinished(repo, commit=True)
branch = repo[None].branch()
bheads = repo.branchheads(branch)
--- a/tests/test-histedit-edit.t Mon Jul 22 10:04:53 2013 +0200
+++ b/tests/test-histedit-edit.t Thu Jul 25 02:17:52 2013 -0500
@@ -73,8 +73,8 @@
(use 'hg histedit --continue' or 'hg histedit --abort')
[255]
-commit, then edit the revision (temporarily disable histedit to allow commit)
- $ hg ci -m 'wat' --config 'extensions.histedit=!'
+commit, then edit the revision
+ $ hg ci -m 'wat'
created new head
$ echo a > e
$ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
--- a/tests/test-histedit-fold.t Mon Jul 22 10:04:53 2013 +0200
+++ b/tests/test-histedit-fold.t Thu Jul 25 02:17:52 2013 -0500
@@ -214,7 +214,7 @@
> 5
> EOF
$ hg resolve --mark file
- $ hg commit -m '+5.2' --config 'extensions.histedit=!'
+ $ hg commit -m '+5.2'
created new head
$ echo 6 >> file
$ HGEDITOR=cat hg histedit --continue