# HG changeset patch # User Matt Mackall # Date 1374736672 18000 # Node ID 607191a45f8cab28af630241c1784fb495adf2b6 # Parent 9aee3d01439407c66fedc30d52b8e1845387b3bb checkunfinished: accommodate histedit quirk Turns out histedit actually intends for commits (but not other operations like update) to be possible during its operation. diff -r 9aee3d014394 -r 607191a45f8c hgext/histedit.py --- 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'")]) diff -r 9aee3d014394 -r 607191a45f8c hgext/rebase.py --- 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'")]) diff -r 9aee3d014394 -r 607191a45f8c hgext/transplant.py --- 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: diff -r 9aee3d014394 -r 607191a45f8c mercurial/cmdutil.py --- 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)) diff -r 9aee3d014394 -r 607191a45f8c mercurial/commands.py --- 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) diff -r 9aee3d014394 -r 607191a45f8c tests/test-histedit-edit.t --- 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 diff -r 9aee3d014394 -r 607191a45f8c tests/test-histedit-fold.t --- 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