Differences between revisions 20 and 21
Revision 20 as of 2013-02-09 12:53:56
Size: 5130
Editor: tonfa
Comment:
Revision 21 as of 2013-02-11 11:14:57
Size: 5188
Editor: bl17-52-174
Comment: fix formatting & grammar / tweak line wrapping
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Changeset Evolution is a set of feature to gracefully handle history rewriting
operation. It offers a **safe** and **simple** way to refines changesets.
Results of your local history rewriting operations can be propagated to other
clone in a *solid* way. It is even possible for multiple people to rewrite the
same part of the history in a distributed way.
Changeset Evolution is a set of features to gracefully handle history rewriting operations.
It offers a '''safe''' and '''simple''' way to refine changesets.
Results of your local history rewriting operations can be propagated to other clones in a '''solid''' way.
It is even possible for multiple people to rewrite the same part of the history in a distributed way.
Line 21: Line 20:
Mercurial offers multiple commands to rewrite history Mercurial offers multiple commands to rewrite history:
Line 23: Line 22:
hg commit --amend:: can adds more changes into a commit
hg rebase:: can move changesets around in your graph (requires the RebaseExtension)
hg histedit:: can performs rewrite operation on some of your changesets (require the HisteditExtension)
 * `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 operation on some of your changesets (requires the HisteditExtension)
Line 27: Line 26:
The Experimental EvolveExtension adds more commands that will eventualy moved into core The experimental EvolveExtension adds more commands, which will eventually moved into core:
Line 29: Line 28:
hg uncommit:: can removes changes from a commit a put them back in your working directory
hg fold:: can squash multiple change set together as a single new commit
hg prune:: can removes changesets from your history.
 * `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
Line 33: Line 32:
All those operations are **very safe to use**, even for Mercurial rookies.
Mercurial will actively prevent you to rewrite part of the history which are
not safe to rewrite. Reads about [[Phases]] concept for details.
All these operations are '''very safe to use''', even for Mercurial rookies.
Mercurial will actively prevent you to rewrite part of the history which are not safe to rewrite.
Read about the [[Phases]] concept for details.
Line 39: Line 38:
Obsolescence markers make it possible to mark changesets that have been
deleted or superseded in a new version of the changeset.
Obsolescence markers make it possible to mark changesets
that have been deleted or superseded in a new version of the changeset.
Line 42: Line 41:
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).
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 drafts and secret changesets can be altered
(see `hg phases` for details).
Line 49: Line 47:
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.
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 obsolescence data.
Line 56: Line 56:
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 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 64: Line 63:
Exchanging mutable changesets an inherent *troubles* 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.
Exchanging mutable changesets an inherent ''troubles'' 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.
Line 68: Line 66:
There is three kind of **troubled changesets** There are three kinds of '''troubled changesets'''
Line 70: Line 68:
In some situation you may have non-obsolete changesets descending from
obsolete changesets. Such changesets are said to be "unstable".
In some situations you may have non-obsolete changesets descending from obsolete changesets.
Such changesets are said to be "unstable".
Line 73: Line 71:
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". In some other situations 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".
Line 75: Line 74:
Finally when multiple changesets claim to be the successors of changesets they are said "divergent". Finally when multiple changesets claim to be the successors of changesets they are said to be "divergent".
Line 77: Line 76:
When Mercurial detect such *troubles* it will warn the user and prevent push by default. You can use the ``hg evolve`` command to automatically resolve them. When Mercurial detect such ''troubles'' it will warn the user and prevent push by default.
You can use the `hg evolve` command to automatically resolve them.
Line 83: Line 83:
Most history rewritting commands can now create obsolescences markers instead of stripping.
 * commit --amend,
 * rebase
 * histedit
Most history rewritting commands can now create obsolescence markers instead of stripping:
 * `commit --amend`
 * `rebase`
 * `histedit`
Line 88: Line 88:
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.
This behavior is disabled by default.
You need to explicitly enable obsolescence support using EvolveExtension to get this behavior.
When using obsolescence markers,
those
commands are allowed to rewrite an arbitrary part of the history
leaving untouched descendant behind as unstable.
Line 93: Line 94:
log --graph will display use 'x' instead of 'o' to display obsolete changesets. `log --graph` will use 'x' instead of 'o' to display obsolete changesets.
Line 96: Line 97:
and are hidden to all mercurial commands and changesets exchanged. a `--hidden`
switch is added globally to have them accessible again.
and are hidden to all mercurial commands and changesets exchanged.
A
`--hidden` switch is added globally to have them accessible again.
Line 99: Line 100:
Obsolescence markers will be exchanged between repositories that explicitly
assert support for the obsolescence feature (this can currently only be done
via an extension).
Obsolescence markers will be exchanged between repositories
that explicitly assert support for the obsolescence feature
(this can currently only be done via an extension).
Line 109: Line 110:

Changesets Evolution

Changeset Evolution is a set of features to gracefully handle history rewriting operations. It offers a safe and simple way to refine changesets. Results of your local history rewriting operations can be propagated to other clones in a solid way. It is even possible for multiple people to rewrite the same part of the history in a distributed way.

/!\ The changeset evolution concept is still being implemented. Most of it is disabled by default.

The functionality is currently available from an external repository: mutable-history repo.

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 operation on some of your changesets (requires the HisteditExtension)

The experimental EvolveExtension adds more commands, which will eventually 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

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

2. Tracking and sharing rewriting

Obsolescence markers make it possible to mark changesets that have been deleted or superseded in 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 drafts 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 obsolescence 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. Automatic detection and resolution arising troubles

Exchanging mutable changesets an inherent troubles 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.

There are three kinds of troubled changesets

In some situations you may have non-obsolete changesets descending from obsolete changesets. Such changesets are said to be "unstable".

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 "bumped".

Finally when multiple changesets claim to be the successors of changesets they are said to be "divergent".

When Mercurial detect such troubles 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 (Mercurial 2.5.1)

Most history rewritting commands can now create obsolescence markers instead of stripping:

  • commit --amend

  • rebase

  • histedit

This behavior is disabled by default. You need to explicitly enable obsolescence support using EvolveExtension to get this behavior. When using obsolescence markers, those commands are allowed to rewrite an arbitrary part of the history leaving untouched descendant behind as unstable.

log --graph will use 'x' instead of 'o' to display obsolete changesets.

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.

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.

5. Older materials

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