hg rewind#

rewind a stack of changesets to a previous state#

hg rewind [--as-divergence] [--exact] [--keep] [--to REV]... [--from REV]...

Aliases: undo

This command is provided by the evolve extension.

This command can be used to restore stacks of changesets to an obsolete state, creating identical copies.

There are two main ways to select the rewind target. Rewinding "from" changesets will restore the direct predecessors of these changesets (and obsolete the changeset you rewind from). Rewinding "to" will restore the changeset you have selected (and obsolete their latest successors).

By default, we rewind from the working directory parents, restoring its predecessor.

When we rewind to an obsolete version, we also rewind to all its obsolete ancestors. To only rewind to the explicitly selected changesets use the --exact flag. Using the --exact flag can restore some changesets as orphan.

The latest successors of the obsolete changesets will be superseded by these new copies. This behavior can be disabled using --as-divergence, the current latest successors won't be affected and content-divergence will appear between them and the restored version of the obsolete changesets.

Current rough edges:

  • fold: rewinding to only some of the initially folded changesets will be

    problematic. The fold result is marked obsolete and the part not rewinded to are "lost". Please use --as-divergence when you need to perform such operation.

  • `hg rewind` might affect changesets outside the current stack. Without

    --exact, we also restore ancestors of the rewind target, obsoleting their latest successors (unless --as-divergent is provided). In some case, these latest successors will be on branches unrelated to the changeset you rewind from. (We plan to automatically detect this case in the future)

Options

--to REV [+]

rewind to these revisions

--as-divergence

preserve current latest successors

--exact

only rewind explicitly selected revisions

--from REV [+]

rewind these revisions to their predecessors

-k

--keep

do not modify working directory during rewind

-n

--dry-run

do not perform actions, just print what would be done

--mq

operate on patch repository

Options marked [+] can be repeated.