Today, if you run 'hg amend' while in the middle of a stack of
commits, it amends the commit and leaves the top of the stack
behind. Users then have to run 'hg amend --restack' or 'hg restack' to
bring the old top of the stack onto the new version of the commit.
Add heuristic code so that an automatic restack can be performed if
amending a commit did not change its manifest, nor did it leave behind
a dirty working copy. This optimization can be avoided by providing
the --no-rebase commandline option.
Fix the existing tests that relied on the previous behaviour (so their
original intent is kept), and add new ones to cover the new heuristic.
Since this is user-facing and not everyone knows what "manifest" is. It's more friendly to avoid the terminology. Power users may want to disable the feature (ex. if they want to amend multiple commits and then just use restack once to fix them all) but it's not obvious how. Maybe something like "(auto-rebasing descendants, use --no-rebase to disable this)"
Note "children" and "descendants" are different in hg. See hg help revset for details.