diff --git a/eden/scm/sapling/cmdutil.py b/eden/scm/sapling/cmdutil.py index 0f54aeba7696b..d688527ae7374 100644 --- a/eden/scm/sapling/cmdutil.py +++ b/eden/scm/sapling/cmdutil.py @@ -4726,13 +4726,11 @@ def _doregister(self, func, name, *args, **kwargs): summaryremotehooks = 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, allowcommit, error, hint) +# (state file, allowcommit, error, hint) unfinishedstates = [ ( "graftstate", - True, False, _("graft in progress"), _("use '@prog@ graft --continue' or '@prog@ graft --abort' to abort"), @@ -4740,13 +4738,11 @@ def _doregister(self, func, name, *args, **kwargs): ( "updatemergestate", True, - True, _("update --merge in progress"), _("use '@prog@ goto --continue' to continue"), ), ( "updatestate", - True, False, _("last update was interrupted"), _( @@ -4763,25 +4759,13 @@ def checkunfinished(repo, commit=False): if found. It's probably good to check this right before bailifchanged(). """ - for f, clearable, allowcommit, msg, hint in unfinishedstates: + for f, allowcommit, msg, hint in unfinishedstates: if commit and allowcommit: continue if repo.localvfs.exists(f): raise error.Abort(msg, hint=hint) -def clearunfinished(repo): - """Check for unfinished operations (as above), and clear the ones - that are clearable. - """ - for f, clearable, allowcommit, msg, hint in unfinishedstates: - if not clearable and repo.localvfs.exists(f): - raise error.Abort(msg, hint=hint) - for f, clearable, allowcommit, msg, hint in unfinishedstates: - if clearable and repo.localvfs.exists(f): - util.unlink(repo.localvfs.join(f)) - - afterresolvedstates = [ ("graftstate", _("@prog@ graft --continue")), ("updatemergestate", _("@prog@ goto --continue")), diff --git a/eden/scm/sapling/commands/__init__.py b/eden/scm/sapling/commands/__init__.py index 962c38382ff8e..d3242678f8ec5 100644 --- a/eden/scm/sapling/commands/__init__.py +++ b/eden/scm/sapling/commands/__init__.py @@ -6408,6 +6408,9 @@ def abort_on_unresolved_conflicts(): repo.ui.warn(_("continuing checkout to '%s'\n") % rev) else: raise error.Abort(_("not in an interrupted update state")) + else: + # proactively clean this up if we aren't continuing + repo.localvfs.tryunlink("updatestate") if rev is not None and rev != "" and node is not None: raise error.Abort(_("please specify just one revision")) @@ -6458,11 +6461,17 @@ def abort_on_unresolved_conflicts(): updatecheck = "none" with repo.wlock(): - if not clean: - # Don't delete the "updatemergestate" marker if we have conflicts. + # Don't delete the "updatemergestate" marker if we have conflicts. + if clean: + repo.localvfs.tryunlink("updatemergestate") + else: abort_on_unresolved_conflicts() - cmdutil.clearunfinished(repo) + # Either we consumed this with "--continue" or we ignoring it with a + # different destination. + repo.localvfs.tryunlink("updatestate") + + cmdutil.checkunfinished(repo) if date: rev = hex(cmdutil.finddate(ui, repo, date)) diff --git a/eden/scm/sapling/ext/histedit.py b/eden/scm/sapling/ext/histedit.py index 9dd9e928a2b1d..fcab552eb6b06 100644 --- a/eden/scm/sapling/ext/histedit.py +++ b/eden/scm/sapling/ext/histedit.py @@ -1723,7 +1723,6 @@ def extsetup(ui): cmdutil.unfinishedstates.append( [ "histedit-state", - False, True, _("histedit in progress"), _("use '@prog@ histedit --continue' or '@prog@ histedit --abort'"), diff --git a/eden/scm/sapling/ext/rebase.py b/eden/scm/sapling/ext/rebase.py index 29808b9777348..ea596872aaab1 100644 --- a/eden/scm/sapling/ext/rebase.py +++ b/eden/scm/sapling/ext/rebase.py @@ -2457,7 +2457,6 @@ def uisetup(ui) -> None: [ "rebasestate", False, - False, _("rebase in progress"), _("use '@prog@ rebase --continue' or '@prog@ rebase --abort'"), ] diff --git a/eden/scm/sapling/ext/shelve.py b/eden/scm/sapling/ext/shelve.py index fa6bdb6d9e6ef..cfcb78e01452c 100644 --- a/eden/scm/sapling/ext/shelve.py +++ b/eden/scm/sapling/ext/shelve.py @@ -1247,7 +1247,6 @@ def extsetup(ui) -> None: [ shelvedstate._filename, False, - False, _("unshelve already in progress"), _("use '@prog@ unshelve --continue' or '@prog@ unshelve --abort'"), ] diff --git a/eden/scm/sapling/ext/undo.py b/eden/scm/sapling/ext/undo.py index 37fc6fc36509c..7e072941c2c6d 100644 --- a/eden/scm/sapling/ext/undo.py +++ b/eden/scm/sapling/ext/undo.py @@ -305,7 +305,7 @@ def log(repo, command, tr): def unfinished(repo): """like cmdutil.checkunfinished without raising an Abort""" - for f, clearable, allowcommit, msg, hint in cmdutil.unfinishedstates: + for f, allowcommit, msg, hint in cmdutil.unfinishedstates: if repo.localvfs.exists(f): return True return False