Multi-Step Command Plan
This page is primarily intended for Mercurial's developers.
Several commands can be interrupted in the middle, typically to fix up merge conflicts. The usual advice is to run <command> --continue after fixing the conflicts up, and <command> --abort to abort the command and return to a pristine state. However, running another state-modifying command while one command is paused can lead to unexpected results.
One example of such a command is hg commit in the middle of an interrupted rebase. Since rebase internally uses merge logic, the commit that happens is a merge commit.
1. The plan
There are already hooks in place to tell people about in-progress commands in hg summary.
- Extend those hooks or add new hooks for core commands and/or extensions. These hooks will be responsible for aborting with the appropriate hint if necessary. The summary hooks and the in-progress abort hooks can probably share some code.
Whenever repo.wlock is taken, run those hooks. Since the "right" commands will also take the lock, have a way to figure out what's taking the wlock. The easiest way is probably a string parameter passed into the lock function.
What about if repo.lock is taken?