18 |
18 |
19 With core Mercurial, changesets are permanent and immutable. You can |
19 With core Mercurial, changesets are permanent and immutable. You can |
20 commit new changesets to modify your source code, but you cannot |
20 commit new changesets to modify your source code, but you cannot |
21 modify or remove old changesets. |
21 modify or remove old changesets. |
22 |
22 |
23 For years, Mercurial has included various extensions that allow |
23 For years, Mercurial has included various commands that allow |
24 history modification: ``rebase``, ``mq``, ``histedit``, and so forth. |
24 history modification: ``rebase``, ``histedit``, ``commit --amend`` and so forth. |
25 These are useful and popular extensions, and in fact history |
|
26 modification is one of the big reasons DVCSes (distributed version |
|
27 control systems) like Mercurial took off. |
|
28 |
|
29 But there's a catch: until now, Mercurial's various mechanisms for |
25 But there's a catch: until now, Mercurial's various mechanisms for |
30 modifying history have been *unsafe*, in that changesets were |
26 modifying history have been *unsafe*, in that changesets were |
31 destroyed (“stripped”) rather than simply made hidden. |
27 destroyed (“stripped”) rather than simply made hidden. |
32 |
28 |
33 ``evolve`` makes things better in a couple of ways: |
29 ``evolve`` makes things better by changing the behaviour of most existing |
|
30 history modification commands so they use a safer mechanism (*changeset |
|
31 obsolescence*, covered below) rather than the older, less safe *strip* |
|
32 operation. |
34 |
33 |
35 * It changes the behaviour of most existing history modification |
34 ``evolve`` is built on infrastructure in core Mercurial: |
36 extensions (``rebase``, ``histedit``, etc.) so they use a safer |
|
37 mechanism (*changeset obsolescence*, covered below) rather than |
|
38 the older, less safe *strip* operation. |
|
39 |
|
40 * It provides a new way of modifying history that is roughly |
|
41 equivalent to ``mq`` (but much nicer and safer). |
|
42 |
|
43 It helps to understand that ``evolve`` builds on infrastructure |
|
44 already in core Mercurial: |
|
45 |
35 |
46 * *Phases* (starting in Mercurial 2.1) allow you to distinguish |
36 * *Phases* (starting in Mercurial 2.1) allow you to distinguish |
47 mutable and immutable changesets. We'll cover phases early in the |
37 mutable and immutable changesets. |
48 user guide, since understanding phases is essential to |
|
49 understanding ``evolve``. |
|
50 |
38 |
51 * *Changeset obsolescence* (starting in Mercurial 2.3) is how |
39 * *Changeset obsolescence* (starting in Mercurial 2.3) is how |
52 Mercurial knows how history has been modified, specifically when |
40 Mercurial knows how history has been modified, specifically when |
53 one changeset replaces another. In the obsolescence model, a |
41 one changeset replaces another. In the obsolescence model, a |
54 changeset is neither removed nor modified, but is instead marked |
42 changeset is neither removed nor modified, but is instead marked |
55 *obsolete* and typically replaced by a *successor*. Obsolete |
43 *obsolete* and typically replaced by a *successor*. Obsolete |
56 changesets usually become *hidden* as well. Obsolescence is an |
44 changesets usually become *hidden* as well. Obsolescence is an |
57 invisible feature until you start using ``evolve``, so we'll cover |
45 invisible feature in Mercurial until you start using ``evolve``. |
58 it in the user guide too. |
|
59 |
46 |
60 Some of the things you can do with ``evolve`` are: |
47 Some of the things you can do with ``evolve`` are: |
61 |
48 |
62 * Fix a mistake immediately: “Oops! I just committed a changeset |
49 * Fix a mistake immediately: “Oops! I just committed a changeset |
63 with a syntax error—I'll fix that and amend the changeset so no |
50 with a syntax error—I'll fix that and amend the changeset so no |