Differences between revisions 18 and 58 (spanning 40 versions)
Revision 18 as of 2013-02-01 22:19:57
Size: 5268
Comment: add a troubled section (to be extended) and update feature status to 2.5 state
Revision 58 as of 2022-08-14 21:06:00
Size: 9459
Editor: StephenRasku
Comment: Fixed link to video.
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

= Changesets Evolution Concept =
= Changeset Evolution =
Line 7: Line 5:
/!\ This feature is experimental and is only partially implemented in core Mercurial. '''Changeset Evolution is a set of features to gracefully handle history rework operations.'''
Line 9: Line 7:
Changesets evolution allows for safe rewriting of Mercurial history. This has a close relationship with [[Phases]]  * It offers a '''safe''' and '''simple''' way to refine changesets locally and propagate those changes to other repositories.
 * It can ''automatically detect'' and ''handle the complex issues'' that can arise from exchanging draft changesets.
 * It makes it even possible for ''multiple developers'' to rewrite the same part of the history in a ''distributed'' way.
 * It fully respects the [[Phases]] concept so unsure users will only rewrite parts of the history that are safe to be changed. Phases have been part of Mercurial since early 2012.
Line 11: Line 12:
 * Presentation of the concept: http://hg-lab.logilab.org/doc/mutable-history/html/ You can [[https://www.mercurial-scm.org/doc/evolution/|read the documentation]] or [[https://d3fenhwk93s16g.cloudfront.net/6i2k0v/hd_mp4.mp4?t=14452632955624f7bf3644d|watch the talk at FOSDEM 2013]] to learn more. ([[https://www.logilab.org/120046|Slides]]).
Line 13: Line 14:
 * Related experimental extension (usable): http://bitbucket.org/marmoute/mutable-history/overview == Status ==
{i} While well on the way, the full implementation of the changeset evolution concept is still in progress. Core Mercurial already supports many of the associated features, but for now they are still '''disabled by default'''. The current implementation has been usable for multiple years already, and some parts of it are used in production in multiple projects and companies (including the Mercurial project itself, Facebook, Google, etc…).
Line 15: Line 17:
== Core principle == However, there are still some areas were the current implementation has gaps. This means some use cases or performance issues are not handled as well as they currently are without evolution. Mercurial has been around for a long time and is strongly committed to backward compatibility, and turning evolution on by default nowadays could regress the experience of some of our current users. The feature will be enabled by default at the point where users who do not use or care about the new features added by evolution won't be impacted by it.
Line 17: Line 19:
 * Store an explicit obsolescence marker between new and old version of rewritten changeset.
 * This marker is *not* part of the changeset (should not alter the hash).
 * People are able to collaborate on evolving changeset
== Using Evolution ==
Using evolution is safe and no data loss/corruption is to be expected. Once you turn evolution on, all commands from core Mercurial will use it. In addition, one can enable evolution locally and still use an "old" server. You won't "poison" the server (but won't be able to use the new feature with that server).
Line 21: Line 22:
== Additional ideas == Testing the concept early is useful for us, core developers. It provides us with data and use cases that we need to iron things out before enabling it by default. This is especially true if you can test evolve in a context that involves client/server/distributed workflows.
Line 23: Line 24:
 * Store final delta in a real and autonomous changeset.
 * The Obsolescence markers are exchangeable without rewritten changeset.
 * Easily allow other extension to manipulate such relation (and to hook on such operation)
Here are the recommended steps to try evolution:
Line 27: Line 26:
== Handled situations ==  1. Subscribe to the [[https://www.mercurial-scm.org/mailman/listinfo/evolve-testers|evolve beta tester]] mailing list,
 1. Install and use the EvolveExtension
 1. Enjoy changeset evolution
Line 29: Line 30:
 * Rewriting content of a changeset
 * Deleting/killing a changeset
 * Splitting a single changeset into multiple ones
 * Collapsing/folding multiple changeset into a single one
 * Changing changeset order
 * Adding (e.g., pulling) a changeset evolution that conflicts with another one
 * Adding (or adding in general) new changesets on one which already evolved (or evolving a changeset that have descendants)
The [[EvolveExtension|evolve extensions]] will take care of enabling all the appropriate features in core and add a small layer with the latest state of the new commands and algorithms. The extension is developed by core Mercurial developers and its code collaborates closely with Mercurial's core internals. It is left outside of core to support older versions of Mercurial (extending the tester base) and gain flexibility when experimenting with new algorithms.
Line 37: Line 32:
== Changeset Obsolescence == As the implementation is still in progress, some command behavior might change. Subscribe to the [[http://selenic.com/mailman/listinfo/evolve-testers|evolve beta tester]] mailing list to make sure you stay aware of new releases and the changes they might introduce.
Line 39: Line 34:
Obsolescence markers make it possible to mark changesets that have been
deleted or superseded in a new version of the changeset.
== Overview ==
{i} You can also check the [[https://www.mercurial-scm.org/doc/evolution/|evolve documentation]].
Line 42: Line 37:
Unlike the previous way of handling such changes, by stripping the old
changesets from the repository, obsolescence markers can be propagated
between repositories. This allows for a safe and simple way of exchanging
mutable history and altering it after the fact. Changeset phases are
respected, such that only draft and secret changesets can be altered (see
`hg phases` for details).
=== Rewriting history ===
Mercurial offers multiple commands to rewrite history:
Line 49: Line 40:
Obsolescence is tracked using "obsolescence markers", a piece of metadata
that tracks which changesets have been made obsolete, potential successors for
a given changeset, the moment the changeset was marked as obsolete, and the
user who performed the rewriting operation. The markers are stored
separately from standard changeset data can be exchanged without any of the
precursor changesets, preventing unnecessary exchange of obsolescence data.
 * `hg commit --amend`: can add more changes into a commit
 * `hg rebase`: can move changesets around in your graph (requires the RebaseExtension)
 * `hg histedit`: can perform rewrite operations on some of your changesets (requires the HisteditExtension)
Line 56: Line 44:
The complete set of obsolescence markers describes a history of changeset
modifications that is orthogonal to the repository history of file
modifications. This changeset history allows for detection and automatic
resolution of edge cases arising from multiple users rewriting the same part
of history concurrently.
The experimental EvolveExtension adds more commands, which will eventually be moved into core:
Line 62: Line 46:
== Troubled Changesets ==  * `hg uncommit`: can remove changes from a commit and put them back in your working directory
 * `hg fold`: can squash multiple changesets together as a single new commit
 * `hg prune`: can remove changesets from your history
 * `hg split`: can split a changeset into smaller ones
Line 64: Line 51:
There is three kind of **troubled changesets** All these operations are '''very safe to use''', even for Mercurial rookies. Mercurial will actively prevent you from rewriting parts of history which are not safe to rewrite. Read about the [[Phases]] concept for details.
Line 66: Line 53:
In some situation you may have non-obsolete changesets descending from
obsolete changesets. Such changesets are said to be "unstable".
=== Tracking and sharing rewriting ===
Obsolescence markers make it possible to mark changesets that have been deleted or superseded by a new version of the changeset.
Line 69: Line 56:
In some other situation you may have successors for changesets which are now [[immutable||Phases]]. In such case the obsolescence marker does not apply and the unlucky successors are said to be "bumped". Unlike the previous way of handling such changes (which stripped the old changesets from the repository), obsolescence markers can be propagated between repositories. This allows for a safe and simple way of exchanging mutable history and altering it after the fact. Changeset phases are respected, such that only draft and secret changesets can be altered (see `hg phases` for details).
Line 71: Line 58:
Finally when multiple changeset claim to be the successors of changesets they are said "divergent". Obsolescence is tracked using "obsolescence markers", a piece of metadata that tracks which changesets have been made obsolete, potential successors for a given changeset, the moment the changeset was marked as obsolete, and the user who performed the rewriting operation. The markers are stored separately from standard changeset data and can be exchanged without any of the precursor changesets, preventing unnecessary exchange of obsolete data.
Line 73: Line 60:
The complete set of obsolescence markers describes a history of changeset modifications that is orthogonal to the repository history of file modifications. This changeset history allows for detection and automatic resolution of edge cases arising from multiple users rewriting the same part of history concurrently.
Line 74: Line 62:
== Current feature status == === Automatic detection and resolution arising troubles ===
Exchanging mutable changesets has inherent issues that we must be prepare to deal with. Most people will never run into them but Mercurial is able to detect and solve them automatically. Please note: there was a renaming of the terms used here; what used to be called "troubled" (encompassing the three kinds of issues below) is now called "unstable". You may still encounter documentation using the old terms, please point it out or contribute an update if you notice any.
Line 76: Line 65:
This feature is still at development stage. While most part of Mercurial are now aware of the concept, some works remains to be done on user interface and network aspect. There are three kinds of '''unstable changesets:'''
Line 78: Line 67:
We do not recommend using this feature with version 2.5 of Mercurial unless you are an experienced user aware of the limitation of the current implementation.  1. In some situations you may have non-obsolete changesets descending from obsolete changesets. Such changesets are said to be "orphaned" (this used to be called 'unstable').
 1. In some other situations you may have successors for changesets which are now [[immutable]]. In such case the obsolescence marker does not apply and the unlucky successors are said to be "phase-divergent" (this used to be called 'bumped').
 1. Finally when multiple changesets claim to be the successors of changesets they are said to be "content-divergent" (the old name for this was simply 'divergent').
Line 80: Line 71:
== State of the concept in version 2.5 == When Mercurial detect such unstable changesets, it will warn the user and prevent push by default. You can use the `hg evolve` command to automatically resolve them.
Line 82: Line 73:
Most history rewritting commands can now create obsolescences markers instead of stripping.
 * commit --amend,
 * rebase
 * histedit
This command is partially implemented in the EvolveExtension.
Line 87: Line 75:
This behavior is disabled by default. You need to explicitly enable obsolescence support using EvolveExtension to get this behavior.
When using obsolescence markers, thoses commandes are allowed to rewrite an arbitrary part of the history leaving untouched descendant behind as unstable.
== Current implementation state ==
As of January 2017, the following areas are covered:
Line 90: Line 78:
log --graph will display use 'x' instead of 'o' to display obsolete changesets.  * All commands know how to create, store and read obsolescence information,
 * obsolete changesets are properly excluded from the user's view and not exchanged between repositories,
 * the obsolescence markers are properly exchanged between repositories, propagating relevant obsolescence information alongside the changesets,
 * hg log and summary will display some information related to evolution,
 * commands like hg update, hg pull and hg rebase can use obsolescence information to make smarter decisions,
 * all evolution issues are properly detected and diagnosed,
 * the `evolve` command can automatically resolve the most common cases of such issues.
Line 92: Line 86:
Obsolete changesets with no non-obsolete descendants are said to be
"extinct" and are hidden to all mercurial commands and changesets exchanged. a `--hidden` switch is added globally to have them accessible again.
And the following areas need improvement: (get on the tester mailing list if you get stuck on one of them)
Line 95: Line 88:
Obsolescence markers will be exchanged between repositories that explicitly
assert support for the obsolescence feature (this can currently only be done
via an extension).

Successors of a changeset are seen as valid destinations for bookmarks.

== Experimental use ==

/!\ This feature is experimental! Do not try it unless you are an experienced Mercurial user.

A set of extensions experimenting around the obsolescence concept is provided by Logilab. It has prototype implementation for most of the final feature. See its documentation for details:

http://hg-lab.logilab.org/doc/mutable-history/html/
 * the most rare/advance case of evolution issues are not automatically handled yet,
 * we need more barriers to prevent the user from shooting themselves in the foot in some corner cases
 * raw obsolescence data is available to the user, but we lack good tools to visualise the obsolescence history,
 * bringing an obsolete changeset to life is harder than it should be,
 * support for other advance maintenance operations (like bundling or stripping obsmarkers) is missing,
 * during exchange, the discovery protocol for markers can be very slow in some case (we have a second iteration to be implemented),
 * we need more scaling work for large/old installations, for update and bookmarks.
Line 110: Line 97:
 * Initial presentation at Copenhagen: http://public.octopoid.net/talk.pdf
 * First tutorial, written by Peter Arrenbrecht: http://arrenbrecht.ch/mercurial/evolution/
 * Blog post by Arne Babenhauserheide (Test of the hg evolve extension for easier upstreaming): http://draketo.de/light/english/mercurial/hg-evolve-2013-01-12
Line 111: Line 101:
  * Initial presentation at Copenhagen: http://public.octopoid.net/talk.pdf
  * First tutorial, written by Peter Arrenbrecht: http://arrenbrecht.ch/mercurial/evolution/
== Related Developer pages ==
 * ChangesetEvolutionDevel

----
CategoryNewFeature CategoryEvolution

Changeset Evolution

Changeset Evolution is a set of features to gracefully handle history rework operations.

  • It offers a safe and simple way to refine changesets locally and propagate those changes to other repositories.

  • It can automatically detect and handle the complex issues that can arise from exchanging draft changesets.

  • It makes it even possible for multiple developers to rewrite the same part of the history in a distributed way.

  • It fully respects the Phases concept so unsure users will only rewrite parts of the history that are safe to be changed. Phases have been part of Mercurial since early 2012.

You can read the documentation or watch the talk at FOSDEM 2013 to learn more. (Slides).

1. Status

{i} While well on the way, the full implementation of the changeset evolution concept is still in progress. Core Mercurial already supports many of the associated features, but for now they are still disabled by default. The current implementation has been usable for multiple years already, and some parts of it are used in production in multiple projects and companies (including the Mercurial project itself, Facebook, Google, etc…).

However, there are still some areas were the current implementation has gaps. This means some use cases or performance issues are not handled as well as they currently are without evolution. Mercurial has been around for a long time and is strongly committed to backward compatibility, and turning evolution on by default nowadays could regress the experience of some of our current users. The feature will be enabled by default at the point where users who do not use or care about the new features added by evolution won't be impacted by it.

2. Using Evolution

Using evolution is safe and no data loss/corruption is to be expected. Once you turn evolution on, all commands from core Mercurial will use it. In addition, one can enable evolution locally and still use an "old" server. You won't "poison" the server (but won't be able to use the new feature with that server).

Testing the concept early is useful for us, core developers. It provides us with data and use cases that we need to iron things out before enabling it by default. This is especially true if you can test evolve in a context that involves client/server/distributed workflows.

Here are the recommended steps to try evolution:

  1. Subscribe to the evolve beta tester mailing list,

  2. Install and use the EvolveExtension

  3. Enjoy changeset evolution

The evolve extensions will take care of enabling all the appropriate features in core and add a small layer with the latest state of the new commands and algorithms. The extension is developed by core Mercurial developers and its code collaborates closely with Mercurial's core internals. It is left outside of core to support older versions of Mercurial (extending the tester base) and gain flexibility when experimenting with new algorithms.

As the implementation is still in progress, some command behavior might change. Subscribe to the evolve beta tester mailing list to make sure you stay aware of new releases and the changes they might introduce.

3. Overview

{i} You can also check the evolve documentation.

3.1. Rewriting history

Mercurial offers multiple commands to rewrite history:

  • hg commit --amend: can add more changes into a commit

  • hg rebase: can move changesets around in your graph (requires the RebaseExtension)

  • hg histedit: can perform rewrite operations on some of your changesets (requires the HisteditExtension)

The experimental EvolveExtension adds more commands, which will eventually be moved into core:

  • hg uncommit: can remove changes from a commit and put them back in your working directory

  • hg fold: can squash multiple changesets together as a single new commit

  • hg prune: can remove changesets from your history

  • hg split: can split a changeset into smaller ones

All these operations are very safe to use, even for Mercurial rookies. Mercurial will actively prevent you from rewriting parts of history which are not safe to rewrite. Read about the Phases concept for details.

3.2. Tracking and sharing rewriting

Obsolescence markers make it possible to mark changesets that have been deleted or superseded by a new version of the changeset.

Unlike the previous way of handling such changes (which stripped the old changesets from the repository), obsolescence markers can be propagated between repositories. This allows for a safe and simple way of exchanging mutable history and altering it after the fact. Changeset phases are respected, such that only draft and secret changesets can be altered (see hg phases for details).

Obsolescence is tracked using "obsolescence markers", a piece of metadata that tracks which changesets have been made obsolete, potential successors for a given changeset, the moment the changeset was marked as obsolete, and the user who performed the rewriting operation. The markers are stored separately from standard changeset data and can be exchanged without any of the precursor changesets, preventing unnecessary exchange of obsolete data.

The complete set of obsolescence markers describes a history of changeset modifications that is orthogonal to the repository history of file modifications. This changeset history allows for detection and automatic resolution of edge cases arising from multiple users rewriting the same part of history concurrently.

3.3. Automatic detection and resolution arising troubles

Exchanging mutable changesets has inherent issues that we must be prepare to deal with. Most people will never run into them but Mercurial is able to detect and solve them automatically. Please note: there was a renaming of the terms used here; what used to be called "troubled" (encompassing the three kinds of issues below) is now called "unstable". You may still encounter documentation using the old terms, please point it out or contribute an update if you notice any.

There are three kinds of unstable changesets:

  1. In some situations you may have non-obsolete changesets descending from obsolete changesets. Such changesets are said to be "orphaned" (this used to be called 'unstable').
  2. In some other situations you may have successors for changesets which are now immutable. In such case the obsolescence marker does not apply and the unlucky successors are said to be "phase-divergent" (this used to be called 'bumped').

  3. Finally when multiple changesets claim to be the successors of changesets they are said to be "content-divergent" (the old name for this was simply 'divergent').

When Mercurial detect such unstable changesets, it will warn the user and prevent push by default. You can use the hg evolve command to automatically resolve them.

This command is partially implemented in the EvolveExtension.

4. Current implementation state

As of January 2017, the following areas are covered:

  • All commands know how to create, store and read obsolescence information,
  • obsolete changesets are properly excluded from the user's view and not exchanged between repositories,
  • the obsolescence markers are properly exchanged between repositories, propagating relevant obsolescence information alongside the changesets,
  • hg log and summary will display some information related to evolution,
  • commands like hg update, hg pull and hg rebase can use obsolescence information to make smarter decisions,
  • all evolution issues are properly detected and diagnosed,
  • the evolve command can automatically resolve the most common cases of such issues.

And the following areas need improvement: (get on the tester mailing list if you get stuck on one of them)

  • the most rare/advance case of evolution issues are not automatically handled yet,
  • we need more barriers to prevent the user from shooting themselves in the foot in some corner cases
  • raw obsolescence data is available to the user, but we lack good tools to visualise the obsolescence history,
  • bringing an obsolete changeset to life is harder than it should be,
  • support for other advance maintenance operations (like bundling or stripping obsmarkers) is missing,
  • during exchange, the discovery protocol for markers can be very slow in some case (we have a second iteration to be implemented),
  • we need more scaling work for large/old installations, for update and bookmarks.

5. Older materials


CategoryNewFeature CategoryEvolution

ChangesetEvolution (last edited 2022-08-14 21:06:00 by StephenRasku)