1. Pierre-Yves David
  2. mutable-history


mutable-history / docs / index.rst

Safe Mutable History

Here are various Materials on planned improvement to mercurial regarding rewriting history.

First read about what challenge arise while rewriting history and how we plan to solve them once and for all.

The effort is splits in two parts:

  • The obsolete marker concept aims to provide and alternative to strip to get rid of changesets.
  • The evolve mercurial extension to rewrite history using obsolete marker under the hood.

The first and most important step is by far the obsolete marker. However most users will never be directly exposed to the concept. For this reason this manual starts with changeset evolution.

Evolve: A robust alternative to MQ

Evolve is an experimental history rewriting extension that uses obsolete markers. It is inspired from MQ and pbranch but have multiple advantages over them:

  • Focus on your current work.

    You can focus your work on a single changeset and take care of adapting descendent changeset later.

  • Handle non-linear history with branches and merges

  • Rely internally on robust merge mechanism of mercurial.

    Simple conflict are handled by real merge tools using appropriate ancestor. Conflict are much rarer and much more user friendly.

  • Mutable history fully available all the time.

always use 'hg update' and forget about (un)applying patches to access the mutable part of your history.
  • Use only plain changeset and forget about patches. Evole will create and exchange real changesets. Mutable history can be used in all usual operations: pull, push, log, diff, etc.
  • Allow sharing and collaboration mutable history without fear of duplicate (thanks to obsolete marker).
  • Cover all mq usage but guard.


The evolve extention and the obsolete marker are at an experimental stage. While using obsolete you'll likely be exposed to complex implication of the obsolete marker concept. I do not recommend non-power user to test this at this stage.

XXX make sure to read the XXX section before using it.

Production ready version should hide such details to normal user.

To enable the evolve extension use:

$ hg clone http://hg-dev.octopoid.net/hgwebdir.cgi/mutable-history/
$ mutable-history/enable.sh >> ~/.hgrc

You will probably want to use the associated version of hgview (qt viewer recommended).

$ hg clone http://hg-dev.octopoid.net/hgwebdir.cgi/hgview/
$ cd hgview
$ python setup.py install --user

works with mercurial 2.1 and 2.2 (recommended)


For more information see documents below:

Smart changeset deletion: Obsolete Marker

Obsolete marker is a powerful concept that allow mercurial to safely handle history rewriting operations. It is a new type of relation between Mercurial changesets that track the result of history rewriting operations.

This concept is simple to define and provides a very solid base to:

  • Very fast history rewriting operations,
  • auditable and reversible history rewriting process,
  • clean final history,
  • share and collaborate on mutable parts of the history,
  • gracefully handle history rewriting conflicts,
  • allow various history rewriting UI to collaborate with a underlying common API.

For more information see documents below

Known caveats

Here is a list of known issues that will be fixed later:

  • Unstable changeset turn secret.
  • hg stabilize does not handle conflicts.

Known limitation and bug

Here is a list of know issue that will be fixed later:

  • hg stabilize does not handle merge conflict.

    You must fallback to graft or rebase when that happen.

  • rewriting conflict are not detected yet``hg stabilize`` does not handle them.

  • hg update can move an obsolete parent

  • you need to provide to graft --continue -O if you started you graft using -O.

  • hg merge considers an extinct head to be a valid target, hence requiring you to manually specify target all the time.

  • trying to exchange obsolete relations with a static http repo will crash.

  • Extinct changeset are turned secret by various commands.

  • Extinct changesets are hidden using the hidden feature of mercurial only supported by a few commands.

    Only hg log, hgview and hg glog (2.2 only) support it. hg head or other visual viewer don't.

  • hg heads show extinct changeset

Fixed in 2.2

  • hg graphlog show extinct changeset
  • Mercurial 2.1 think you are pushing additional heads even when the new head obsolete another one. You have to use hg push -f more often than necessary.
  • hg heads shows extinct changeset
  • hg merge considers an extinct head to be a valid target, hence requiring you to manually specify target all the time.
  • trying to exchange obsolete relations with a static http repo will crash.