=============================
Mutable History For Mercurial
=============================

Evolve Extension
=================

This package supplies the ``evolve`` extension for Mercurial,

**The full implementation of the changeset evolution concept is still in
progress.**  Please subscribe to the `evolve-testers mailing list
<https://www.mercurial-scm.org/mailman/listinfo/evolve-testers>`_ to stay up to
date with changes.

This extension:

* enables the “changeset evolution” feature of Mercurial core,

* provides a set of commands to mutate your history,

* issues several warning messages when troubles from some mutable appears in
  your repository,

* provides an ``hg evolve`` command to deal with such "troubles",

* improves performance of obsolescence marker exchanges and discovery during
  push and pull.

Documentation
-------------

We recommend reading the documentation first. An online version is
available here:

    https://www.mercurial-scm.org/doc/evolution/

How to Install
==============

Using Pip
---------

You can install the latest evolution version usin pip::

    $ pip install --user hg-evolve

Then just enable it in you hgrc::

    $ hg config --edit # adds the two line below:
    [extensions]
    evolve =

From Source
-----------

To install a local version from source::

    $ hg clone https://www.mercurial-scm.org/repo/evolve/
    $ cd evolve
    $ pip install --user .

Then just enable it in you hgrc::

    $ hg config --edit # adds the two line below:
    [extensions]
    evolve =

Documentation lives in ``doc/``.

Server Only Setup
=================

It is possible to enable a smaller subset of the extensions aimed at server
serving repository. It skips the additions of the new commands and local UI
messages that might add performance overheads. To use the server only
extension, install the package and use::

    $ hg config --edit # adds the two line below:
    [extensions]
    evolve.serveronly =


How to Contribute
=================

Bugs are to be reported on the mercurial's bug tracker (component: `evolution`_):

.. _evolution: https://bz.mercurial-scm.org/buglist.cgi?component=evolution&query_format=advanced&resolution=---

Please use the patchbomb extension to send email to `mercurial devel
<https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel>`_. Please make
sure to use the evolve-ext flag when doing so. You can use a command like
this::

    $ hg email --to mercurial-devel@mercurial-scm.org --flag evolve-ext --rev '<your patches>'

For guidelines on the patch description, see the `official Mercurial guideline`_.

.. _`official Mercurial guideline`: https://mercurial-scm.org/wiki/ContributingChanges#Patch_descriptions

Please don't forget to update and run the tests when you fix a bug or
add a feature. To run the tests, you need a working copy of Mercurial,
say in $HGSRC::

    $ cd tests
    $ python $HGSRC/tests/run-tests.py

Branch policy
-------------

The evolve test are highly impacted by changes in core. To deal with this, we use named branches.

There are two main branches: "stable" and "default". Tests on these branch are
supposed to pass with the corresponding "default" and "stable" branch from core
Mercurial. The documentation is built from the tip of stable.

In addition, we have compatibility branches to check tests on older version of
Mercurial. They are the "mercurial-x.y" branches. They are used to apply
expected test change only, no code change should happen there.

Changelog
=========

6.6.0 -- 2017-07-25
-------------------

  - amend: add a --extract flag to move change back to the working copy,
    (same as uncommit, but accessible through the amend commit)
  - split: now properly refuse to split public changeset,
  - commands: unify and improve the pre-rewrite validation and error message,
  - uncommit: add support for --current-date and --current-user option,
  - fold: add support for --current-date and --current-user option,
  - metaedit: add support for --current-date and --current-user option,
  - split: add support for --current-date and --current-user option,
  - compat: use various new API instead of the one deprecated in 4.3,
    (when available)
  - documentation: various minor documentation update.

topic (0.2.0):

  - topic: add --age option to sort topic by the most recently touched,
  - topic: add a 't0' to access the root of a topic while keeping it active,
  - topic: allow 'hg prev' to me move to 't0',
  - topic: add a config option to enforce topic on new commit,
    (experimental.enforce-topic)
  - topic: make command names valid as expected, even if ui.strict=true.

6.5.0 -- 2017-07-02
-------------------

features:

 - obslog: gain a --patch flag to display changes introduced by the evolution
  (Currently limited to in simple case only)
 - log: display obsolescence fate by default, (future 4.3 only)
 - doc: various minor improvement.

bugfixes:

 - evolve: fix branch preservation for merge,
 - obsfate: improve support for advanced template reformating,
 - split: preserve author of the splitted changeset.
 - grab: properly fix hg executable on windows.

topic (0.1.0):

 - stack: also show the unstable status for the current changeset, (issue5553)
 - stack: properly abort when and unknown topic is requested,
 - stack: add basic and raw support for named branches,
 - topic: changing topic on revs no longer adds extra instability, (issue5441)
 - topic: topics: rename '--change' flag to '--rev' flag,
 - topic: multiple large performance improvements,
 - topic: various small output improvement,
 - topic: improved topic preservation for various commands.


6.4.0 -- 2017-06-16
-------------------

 - template: signifiant improvement to the '{obsfate}' template (now 4.2+ only)
 - template: fix 'successors' and 'precursors' template to expose hex-node
 - effect flag: the experiment is now active by default,
   (see 'hg help -e evolve' to opt out)
 - effect flag: fix a small bug related to hidden changeset,
 - obscache: reduce impact on large repository
 - obshashrange: install a '.max-revs' option see extension help for details

6.3.1 -- 2017-06-01
-------------------

 - also backport the "revelant-markers" fix when using "evolve.serveronly"

6.3.0 -- 2017-05-31
-------------------

 - olog: add an 'obslog' alias
 - olog: add an '--all' option to show the whole obsolescence history tree.
 - evolution: add an experiment to track the effect of rewrites.
   (See hg help - evolve for details)
 - exchange: fix the "relevant-markers" algorithm to include inline prune.
   This will impact discovery of obsmarkers between server and client if one
   still uses the old algorithm. Please upgrade both clients and servers as
   soon as possible.
   (See changeset 176d1a0ce385 in core Mercurial for details)
 - obsdiscovery: add a config flag to disable all obsmarkers discovery
   (See hg help - evolve for details)
 - template: add a 'precursors' template that display the closests precursors of changesets
 - template: add a 'successors' template that display the closests successors of changesets
 - template: add a 'obsfate' template that display how a changeset has evolved
 - new discovery experiment: add options to restrict memory consumption on
   large repository (see "hg help -e evolve" for details).
 - evolve: fix --rev handling in --list mode

6.2.1 -- 2017-05-23
-------------------

 - prune: fix a crash related to color handling,
 - next: fix a crash related to color handling,
 - discovery: document the 'obshashrange' experiment,
 - cache: reduce the warming load in case of reset,
 - cache: add a 'experimental.obshashcache.warm-cache' option to allow
   disabling post transaction cache warming.

6.2.0 -- 2017-05-18
-------------------

 - olog: a new command to inspect the obs-history of a changeset (hg-4.0 + only),
 - topic: have thg display topic name if possible,
 - blackbox: log more information about discovery and cache computation,
 - obscache: more efficient update in the (rare) case of a transaction adding
   markers without changesets,
 - obscache: fix more cache invalidation propagation,
 - obscache: also enable the new cache (from 6.1.0) for 'evolve.server-only',
 - obshashrange-cache: update incrementally in the (common) case of a
   transaction not affecting existing range,
 - obshashrange-cache: keep the cache warm after each transaction,
 - topic: now requires Mercurial 4.0 or above,
 - stack: now display if current revision is in bad state (issue5533),
 - stack: fix json output to be valid json.

6.1.0 -- 2017-05-03
-------------------

 - improve message about obsolete working copy parent,
 - improve message issued  when accessing hidden nodes (4.2 only),
 - introduce a new caches to reduce the impact of evolution on read-only commands,
 - add a 'experimental.auto-publish' config. See `hg help -e evolve` for details.
 - fix the propagation of some some cache invalidation,

6.0.1 -- 2017-04-20
-------------------

 - template: adapt to change in 4.2,
 - fix 'debugrecordpruneparents' (outdated API usage)
 - checkheads: give priority to updated 4.2 code,
 - serveronly: fix repository initialization.

6.0.0 -- 2017-03-31
-------------------

- push: improved detection of obsoleted remote branch (issue4354),
- drop compatibility for Mercurial < 3.8,
- removed old (unpackaged) pushexperiment extension,
- move all extensions in the official 'hgext3rd' namespace package,
- add the "topic" experimental extensions. See the README.topic file for details
- officially ship 'evolve.serveronly' extensions. That extensions contains
  only the part related to exchange and is intended to be used by server.

  Using the extension will enable evolution, use 'experimental.evolution=!'
  to disable obsmarkers echange.  The old '__temporary__.advertiseobsolete'
  option is no longer supported.

- a new prototype of obsmarker discovery is available. The prototype is still
  at early stage and not recommended for production.
  Examples of current limitations:

  - write access to the repo is highly recommanded for all operation,
  - large memory footprint,
  - initial caching is slow,
  - unusable on large repo (because of various issue pointed earlier),
  - likely to constains various bugs.

  It can be tested by setting `experimental.obshashrange=1` on both client and
  server. It is recommanded to get in touch with the evolve maintainer if you
  decide to test it.

- the 'debugrecordpruneparents' have been moved into the 'evolve.legacy'
  separate extension. enable that extentions if you need to convert/update
  markers in an old repository.

5.6.1 -- 2017-02-28
-------------------

- fix a crash that sometime happened when evolving merges.

5.6.0 -- 2017-02-01
-------------------

- compatibility with Mercurial 4.1.
- improvement of prune error message.
- fold: require --from flag for folding revisions to working copy
- fix crash when trying to fold an empty revision set (issue5453)
- uncommit: preserve copy information of remaining files (issue5403)

5.5.0 -- 2016-10-30
-------------------

- The {obsolete} template now yield "obsolete" or "".
- compatibility with Mercurial 4.0
- Fix erroneous manifest computation when solving 'bumped' changeset.
- split: avoid crash on empty commit (issue5191),
- next: improve locking to avoid issue with working copy parent (issue5244)
- prev: improve locking to avoid issue with working copy parent (issue5244)
- evolve: fix abort suggestion to include '.' in 'hg update -C .'

5.4.1 -- 2016-08-01
-------------------

 - compat with Mercurial 3.9

5.4.0 -- 2016-05-06
-------------------

- Some collaboration with the topic experimental extensions,
  - hg evolve --all with consider all troubles in your current topic,
  - preserve 'topic' during evolve,
  - 'next' and 'prev' restrict themself to the current topic by default,
- remove the dangerous 'kill' alias for 'prune' (because 'hg kill -1' without
  the leading 'hg' will give you an hardtime)
- during 'hg evolve' skip unsupported merge instead of aborting
- various documentation fix and update
- hg summary now suggest 'hg evolve --continue when appropriate`
- compatibility with Mercurial 3.8 'hgext' namespace package.
- small improvement to the `hg split` instruction
- add a 'metaedit' command to rewrite changeset meta data.

5.3.0 -- 2016-02-11
-------------------

- split: add a new command to split changesets,
- tests: drop our copy of 'run-tests.py' use core one instead,
- bookmark: do all bookmark movement within a transaction.
- evolve: compatibility with Mercurial 3.7
- evolve: support merge with a single obsolete parent (hg-3.7+ only)
- evolve: prevent added file to be marked as unknown if evolve fails (issue4966)
- evolve: stop relying on graftstate file for save evolve state
          (for `hg evolve --continue`)
- evolve: fix divergence resolution when it result in an empty commit
          (issue4950) (hg-3.5+ only)
- no longer lock the repository for `hg parents` (issue4895)
- updated help for the `evolve` command

5.2.1 -- 2015-11-02
-------------------

- add compatibility with Mercurial 3.6
- prune: fixed possible issue with lock and bookmark
- next/prev: fixed possible issue with lock and bookmark
- add some progress data during changesets discovery
- take advantage of dirstate/transaction collaboration

5.2.0 -- 2015-06-25
-------------------

- evolve: gain a --rev option to control what revisions to evolve (issue4391)
- evolve: revision are processed in the order they stack on destination
- evolve: properly skip unstable revision with non-evolved unstable parent
- evolve: gain --unstable --divergent --bumped flag to select the trouble
- evolve: issue more useful error message and hint when evolve has nothing to
          do as invocated.
- evolve: bare `hg evolve` commands now abort when multiple changesets could be
          a target.
- evolve: `hg evolve --all` only evolve changeset that will end up as
          descendant of the current working copy. The old behavior of `--all`
          in now in `--all --any`.
- evolve: add a 'experimental.evolutioncommands' for fine grained commands
          enabling
- next/prev: requires `--merge` to move with uncommitted changes
- next: significantly reword error messages
- next: add a --evolve flag to evolve aspiring children when on a head

5.1.5 -- 2015-06-23
-------------------

- minor documentation cleanup
- support -i option for `hg amend` if commit supports it (3.4)
- fix the `debugrecordpruneparents` utility
- fix some possible crash during command abort (release nonexistent transaction)
- fix simple4server bug tracker URL
- compatibility with bookmark API change in future Mercurial 3.5
- prune no longer move the active bookmark for no reason (issue4559)
- evolve: stop reporting divergence base as missing when we actually have it
- significant performance improvement for all revsets.
- provide a hint of how to update to the successor of an obsolete working copy
  parent.

5.1.4 -- 2015-04-23
-------------------

- significant documentation update
- fix issue4616: pulling with bundle2 would crash if common marker when
  discovered on non-served changesets.
- fix the debugobsrelsethashtree command

5.1.3 -- 2015-04-20
-------------------

- discovery: fix misbehaving discovery across python version
- pull: properly install the bundle2 par generator
  (avoid sending all markers for each pull)
- commit: avoid potential deadlock (acquires wlock before lock)
- graft: avoid potential deadlock (acquires wlock before lock)

5.1.2 -- 2015-04-01
-------------------

- evolve: prevent a crash in httpclient_pushobsmarkers() when pushing

5.1.1 -- 2015-03-05
-------------------

- debugobsconvert: fix invalid markers during conversion
- discovery: cache some of the obs hash computation to improve performance (issue4518)
- revset: fix some crash with (issue4515)

5.1 -- 2015-01-30
-------------------

- evolve: explicitly disable bookmark on evolve (issue4432)
- evolve: don't abort Mercurial on version mismatch
- compatibility with mercurial 3.3

5.0.2 -- 2014-12-14
-------------------

- evolve: remove dependency to the rebase extension

5.0.1 -- 2014-11-25
-------------------

- amend: fix --logfile argument
- evolve: preserve branch change when evolving
- evolve: fix potential crash while solving `bumped` changesets.
- uncommit: abort when rev specifies the current changeset
- evolve: various message improvement
- evolve: fix selection of changeset to evolve from the middle of a stack (issue4434)
- evolve: make next/prev only move bookmarks optionally
- evolve: tell user which "base of divergent changeset" is not found

5.0.0 -- 2014-10-22
-------------------

- drop compat with Mercurial pre 3.2
- uncommit: add a --rev argument
- evolve: add a `working directory now at xxxxxxxxxx` message
- evolve: automatically translate obsolete hashes when evolving
- properly skip marker creating if patch apply cleanly
- prune: work around a massive slowdown from lazy revset
- grab: "fix" the grab alias on window

- fix an issue where prune performance were quadratic with the number of
  changesets pruned.
- pull: use discovery to pull less obsmarkers through bundle2


4.1.0 -- 2014-08-08
-------------------

- amend: add -D/--current-date option
- amend: add -U/--current-user option
- evolve: add a --tool option
- evolve: add a --confirm option
- mark "commit -o", "graft -o" and "graft -O" as deprecated since they are
  unlikely to eventually make it into core.
- push obsmarkers and phases in the same transaction than changesets
  (when using hg >= 3.1 and bundle2-exp is enabled)
- hide message about the obsolescence marker exchange behind a
  `experimental.verbose-obsolescence-exchange` variable (default to False).

4.0.1 -- 2014-08-08
-------------------

- createmarkers() accept an iterable (for compat with other extension)

4.0.0 -- 2014-06-03
-------------------

- require Mercurial version 3.0.1 or above
- some compatibility fixes with future 3.1.0
- deprecated `gup` and `gdown` in favor of prev and next
- record parent of pruned parent at prune time
- added a `debugobsstorestat` command to gather data on obsmarker content.
- added a `debugrecordpruneparents` command to upgrade existing prune marker
  with parent information. Please run it once per repo after upgrading.
- improvement to obsolescence marker exchange:
  - added progress when pushing obsmarkers
  - added multiple output during obsolescence markers exchange
  - only push markers relevant to pushed subset
  - add a new experimental way to exchange marker (when server support):

    - added progress when pulling obsmarkers
    - only pull markers relevant to pulled subset
    - avoid exchanging common markers in some case
    - use bundle2 as transport when available.

 - add a hook related to the new commands

3.3.2 -- 2014-05-14
-------------------

- fix a bug where evolve were creating changeset with 2 parents on windows
  (fix issues #16, #35 and #42)
- adds a --obsolete flag to import (requires Mercurial 3.0)
- prune: update to successor rather than parent when pruning '.' with -s
- fold: add missing --message and --logfile option
- fold: add squash as an alias

3.3.1 -- 2014-04-23
-------------------

- various language fix
- active bookmark now move when using prev/next (#37)
- fix some preservation of rename information on evolve (#33)
- abort when evolve tries to move a node on top of itself (will helps on the #35 front)
- fold: enable --date and --user options

3.3.0 -- 2014-03-04
-------------------

- raise Mercurial's minimal requirement to 2.7
- drop `latercomer` and `conflicting` compatibility. Those old alias are
  deprecated for a long time now.
- add verbose hint about how to handle corner case by hand.
  This should help people until evolve is able to to it itself.
- removed the qsync extension. The only user I knew about (logilab) is not
  using it anymore. It not compatible with coming Mercurial version 2.9.
- add progress indicator for long evolve command
- report troubles creation from `hg import`

3.2.0 -- 2013-11-15
-------------------

- conform to the Mercurial custom of lowercase messages
- added a small extension to experiment with obsolescence marker push
- amend: drop the deprecated note option
- amend: use core mechanism for amend (fix multiple bugs)
- parents command: add "working directory parent is obsolete" message
- evolve command: allow updating to the successor if the parent is
  obsolete
- gdown and gup commands: add next and previous alias, respectively
- make grab aliases compatible with Mercurial 2.8
- Tested with 2.6, 2.7 and 2.8

3.1.0 -- 2013-02-11
-------------------

- amend: drop deprecated --change option for amend
- alias: add a grab alias to be used instead of graft -O
- touch: add a --duplicate option to *not* obsolete the old version
- touch: fix touching multiple revision at the same time
- evolve: add a --all option
- prune: various minor improvements
- prune: add option to prune a specific bookmark
- prune: add -u and -d option to control metadata

3.0.0 -- 2013-02-02
-------------------

- compatibility with 2.5

2.2.0 --
-------------------

- make evolve smarter at picking next troubled to solved without --any

2.1.0 -- 2012-12-03
-------------------

- qsync fixes
- have qfold ask for commit message

2.0.0 -- 2012-10-26
-------------------

- compat with mercurial 2.4

1.1.0 -- 2012-10-26
-------------------

- fix troubles creation reporting from rebase
- rename latecomer to bumped
- renamed conflicting to divergent
- smarter divergent handling

1.0.2 -- 2012-09-19
-------------------

- fix hg fold bug
- fix hg pull --rebase
- fix detection of conflict with external tools
- adapt to core movement (caches and --amend)

1.0.1 -- 2012-08-31
-------------------

- documentation improvement
- fix a performance bug with hgweb

1.0 -- 2012-08-29
-------------------

- Align with Mercurial version 2.3 (drop 2.2 support).
- stabilize handle killed parent
- stabilize handle late comer
- stabilize handle conflicting
- stabilize get a --continue switch
- merge and update ignore extinct changeset in most case.
- new "troubled()" revset
- summary now reports troubles changesets
- new touch command
- new fold command
- new basic olog alias

- rebase refuse to work on public changeset again
- rebase explicitly state that there is nothing to rebase because everything is
  extinct() when that happen.
- amend now cleanly abort when --change switch is misused


0.7 -- 2012-08-06
-------------------

- hook: work around insanely huge value in obsolete pushkey call
- pushkey: properly handle abort during obsolete markers push
- amend: wrap the whole process in a single transaction.
- evolve: tweak and add EOL to kill warning
- obsolete: fix doc, rebase no longer aborts with --keep
- obsolete/evolve: fix grammar in prerequisite messages
- evolve: avoid duplication in graft wrapper
- evolve: graft --continue is optional, test

0.6 -- 2012-07-31
-------------------

- obsolete: change warning output to match mercurial core on
- qsync: ignore nonexistent nodes
- make compat server both compatible with "dump" and "dump%i" version

0.5 -- 2012-07-16
-------------------

- obsolete: Detect conflicting changeset!
- obsolete: adapt to core: marker are written in transaction now
- evolve: add the solve alias to obsolete
- doc: big update of terms and summary of the concept
- evolve: switch the official name for "kill" to prune


0.4.1 -- 2012-07-10
-------------------

- [convert] properly exclude null successors from conversion
- Ignore buggy marker in newerversion


0.4.0 -- 2012-07-06
-------------------

- obsolete: public changeset are no longer latecomer.
- obsolete: move to official binary format
- adapt for new mercurial
- obsolete: we are not compatible with 2.1 any more

0.3.0 -- 2012-06-27
-------------------

- obsolete:  Add "latecomer" error detection (stabilize does not handle resolution yet)
- evolve:    Introduce a new `uncommit` command to remove change from a changeset
- rebase:    allow the use of --keep again
- commit:    --amend option create obsolete marker (but still strip)
- obsolete:  fewer marker are created when collapsing revision.
- revset:    add, successors(), allsuccessors(), precursors(), allprecursors(),
             latecomer() and hidden()
- evolve:    add `prune` alias to `kill`.
- stabilize: clearly state that stabilize does not handle conflict
- template:  add an {obsolete} keyword

0.2.0 -- 2012-06-20
-------------------

- stabilize: improve choice of the next changeset to stabilize
- stabilize: improve resolution of several corner case
- rebase:    handle removing empty changesets
- rebase:    handle --collapse
- evolve:   add `obsolete` alias to `kill`
- evolve:   add `evolve` alias to `stabilize`
