mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
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:
parent
c498cc8a17
commit
6d0d30f28a
@ -874,5 +874,5 @@ def summaryhook(ui, repo):
|
||||
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'")])
|
||||
|
@ -800,5 +800,5 @@ def uisetup(ui):
|
||||
_("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'")])
|
||||
|
@ -685,7 +685,7 @@ def extsetup(ui):
|
||||
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:
|
||||
|
@ -2107,20 +2107,22 @@ summaryhooks = util.hooks()
|
||||
# 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 @@ def clearunfinished(repo):
|
||||
'''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))
|
||||
|
@ -1336,7 +1336,7 @@ def commit(ui, repo, *pats, **opts):
|
||||
# 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)
|
||||
|
@ -73,8 +73,8 @@ Go at a random point and try to continue
|
||||
(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
|
||||
|
@ -214,7 +214,7 @@ dropped revision.
|
||||
> 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
|
||||
|
Loading…
Reference in New Issue
Block a user