checkunfinished: accommodate histedit quirk

Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
This commit is contained in:
Matt Mackall 2013-07-25 02:17:52 -05:00
parent c498cc8a17
commit 6d0d30f28a
7 changed files with 16 additions and 14 deletions

View File

@ -874,5 +874,5 @@ def summaryhook(ui, repo):
def extsetup(ui): def extsetup(ui):
cmdutil.summaryhooks.add('histedit', summaryhook) cmdutil.summaryhooks.add('histedit', summaryhook)
cmdutil.unfinishedstates.append( cmdutil.unfinishedstates.append(
['histedit-state', False, _('histedit in progress'), ['histedit-state', False, True, _('histedit in progress'),
_("use 'hg histedit --continue' or 'hg histedit --abort'")]) _("use 'hg histedit --continue' or 'hg histedit --abort'")])

View File

@ -800,5 +800,5 @@ def uisetup(ui):
_("specify merge tool for rebase"))) _("specify merge tool for rebase")))
cmdutil.summaryhooks.add('rebase', summaryhook) cmdutil.summaryhooks.add('rebase', summaryhook)
cmdutil.unfinishedstates.append( cmdutil.unfinishedstates.append(
['rebasestate', False, _('rebase in progress'), ['rebasestate', False, False, _('rebase in progress'),
_("use 'hg rebase --continue' or 'hg rebase --abort'")]) _("use 'hg rebase --continue' or 'hg rebase --abort'")])

View File

@ -685,7 +685,7 @@ def extsetup(ui):
revset.symbols['transplanted'] = revsettransplanted revset.symbols['transplanted'] = revsettransplanted
templatekw.keywords['transplanted'] = kwtransplanted templatekw.keywords['transplanted'] = kwtransplanted
cmdutil.unfinishedstates.append( cmdutil.unfinishedstates.append(
['series', True, _('transplant in progress'), ['series', True, False, _('transplant in progress'),
_("use 'hg transplant --continue' or 'hg update' to abort")]) _("use 'hg transplant --continue' or 'hg update' to abort")])
# tell hggettext to extract docstrings from these functions: # tell hggettext to extract docstrings from these functions:

View File

@ -2107,20 +2107,22 @@ summaryhooks = util.hooks()
# A list of state files kept by multistep operations like graft. # A list of state files kept by multistep operations like graft.
# Since graft cannot be aborted, it is considered 'clearable' by update. # Since graft cannot be aborted, it is considered 'clearable' by update.
# note: bisect is intentionally excluded # note: bisect is intentionally excluded
# (state file, clearable, error, hint) # (state file, clearable, allowcommit, error, hint)
unfinishedstates = [ unfinishedstates = [
('graftstate', True, _('graft in progress'), ('graftstate', True, False, _('graft in progress'),
_("use 'hg graft --continue' or 'hg update' to abort")), _("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")) _("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 '''Look for an unfinished multistep operation, like graft, and abort
if found. It's probably good to check this right before if found. It's probably good to check this right before
bailifchanged(). 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): if repo.vfs.exists(f):
raise util.Abort(msg, hint=hint) raise util.Abort(msg, hint=hint)
@ -2128,9 +2130,9 @@ def clearunfinished(repo):
'''Check for unfinished operations (as above), and clear the ones '''Check for unfinished operations (as above), and clear the ones
that are clearable. 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): if not clearable and repo.vfs.exists(f):
raise util.Abort(msg, hint=hint) 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): if clearable and repo.vfs.exists(f):
util.unlink(repo.join(f)) util.unlink(repo.join(f))

View File

@ -1336,7 +1336,7 @@ def commit(ui, repo, *pats, **opts):
# Save this for restoring it later # Save this for restoring it later
oldcommitphase = ui.config('phases', 'new-commit') oldcommitphase = ui.config('phases', 'new-commit')
cmdutil.checkunfinished(repo) cmdutil.checkunfinished(repo, commit=True)
branch = repo[None].branch() branch = repo[None].branch()
bheads = repo.branchheads(branch) bheads = repo.branchheads(branch)

View File

@ -73,8 +73,8 @@ Go at a random point and try to continue
(use 'hg histedit --continue' or 'hg histedit --abort') (use 'hg histedit --continue' or 'hg histedit --abort')
[255] [255]
commit, then edit the revision (temporarily disable histedit to allow commit) commit, then edit the revision
$ hg ci -m 'wat' --config 'extensions.histedit=!' $ hg ci -m 'wat'
created new head created new head
$ echo a > e $ echo a > e
$ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle

View File

@ -214,7 +214,7 @@ dropped revision.
> 5 > 5
> EOF > EOF
$ hg resolve --mark file $ hg resolve --mark file
$ hg commit -m '+5.2' --config 'extensions.histedit=!' $ hg commit -m '+5.2'
created new head created new head
$ echo 6 >> file $ echo 6 >> file
$ HGEDITOR=cat hg histedit --continue $ HGEDITOR=cat hg histedit --continue