docs/user-guide.rst
branchmercurial-4.7
changeset 4971 9f69164cdc16
parent 4920 d1066fb2c95a
equal deleted inserted replaced
4886:4ab90c838772 4971:9f69164cdc16
   401 still visible, even though it is obsolete. Obsolete changesets with
   401 still visible, even though it is obsolete. Obsolete changesets with
   402 non-obsolete descendants are not hidden.
   402 non-obsolete descendants are not hidden.
   403 
   403 
   404 The fix is to *evolve* history::
   404 The fix is to *evolve* history::
   405 
   405 
   406   $ hg evolve --all
   406   $ hg evolve
   407 
   407 
   408 This is a separate step, not automatically part of ``hg amend``,
   408 This is a separate step, not automatically part of ``hg amend``,
   409 because there might be conflicts. If your amended changeset modifies a
   409 because there might be conflicts. If your amended changeset modifies a
   410 file that one of its descendants also modified, Mercurial has to fire
   410 file that one of its descendants also modified, Mercurial has to fire
   411 up your merge tool to resolve the conflict. More importantly, you have
   411 up your merge tool to resolve the conflict. More importantly, you have
   416 revisions (11-13) are obsolete and hidden. Their successor revisions
   416 revisions (11-13) are obsolete and hidden. Their successor revisions
   417 (14-16) replace them.
   417 (14-16) replace them.
   418 
   418 
   419 .. figure:: figures/figure-ug07.svg
   419 .. figure:: figures/figure-ug07.svg
   420 
   420 
   421    Figure 7: evolve your repository (``hg evolve --all``) to take care
   421    Figure 7: evolve your repository (``hg evolve``) to take care
   422    of instability. Orphan changesets become obsolete, and are
   422    of instability. Orphan changesets become obsolete, and are
   423    replaced by successors just like the amended changeset was.
   423    replaced by successors just like the amended changeset was.
   424 
   424 
   425 Example 8: Prune an older changeset
   425 Example 8: Prune an older changeset
   426 ===================================
   426 ===================================
   448    of the pruned changeset are now orphans.
   448    of the pruned changeset are now orphans.
   449 
   449 
   450 As before, the solution to orphan changesets is to evolve your
   450 As before, the solution to orphan changesets is to evolve your
   451 repository::
   451 repository::
   452 
   452 
   453   $ hg evolve --all
   453   $ hg evolve
   454 
   454 
   455 This rebases revision 20 on top of 18 as the new revision 21, leaving
   455 This rebases revision 20 on top of 18 as the new revision 21, leaving
   456 19 and 20 obsolete and hidden:
   456 19 and 20 obsolete and hidden:
   457 
   457 
   458 .. figure:: figures/figure-ug09.svg
   458 .. figure:: figures/figure-ug09.svg
   459 
   459 
   460    Figure 9: once again, ``hg evolve --all`` takes care of instability.
   460    Figure 9: once again, ``hg evolve`` takes care of instability.
   461 
   461 
   462 Example 9: Uncommit files from an older changeset (discard changes)
   462 Example 9: Uncommit files from an older changeset (discard changes)
   463 =======================================================================
   463 =======================================================================
   464 
   464 
   465 As in example 5, let's say you accidentally commit some unrelated
   465 As in example 5, let's say you accidentally commit some unrelated
   489 
   489 
   490 In this case, the change to ``file2.c`` was a temporary debugging
   490 In this case, the change to ``file2.c`` was a temporary debugging
   491 hack, so we can discard it and immediately evolve the instability away::
   491 hack, so we can discard it and immediately evolve the instability away::
   492 
   492 
   493   $ hg revert file2.c
   493   $ hg revert file2.c
   494   $ hg evolve --all
   494   $ hg evolve
   495   move:[23] fix bug 67
   495   move:[23] fix bug 67
   496   atop:[24] fix bug 53
   496   atop:[24] fix bug 53
   497 
   497 
   498 Figure 10 illustrates the whole process.
   498 Figure 10 illustrates the whole process.
   499 
   499 
   543    separately will soon result in a two-headed repository.
   543    separately will soon result in a two-headed repository.
   544 
   544 
   545 This is where things get tricky. As usual when a repository has
   545 This is where things get tricky. As usual when a repository has
   546 orphan changesets, we want to evolve it::
   546 orphan changesets, we want to evolve it::
   547 
   547 
   548   $ hg evolve --all
   548   $ hg evolve
   549 
   549 
   550 The problem is that ``hg evolve`` rebases revision 27 onto revision
   550 The problem is that ``hg evolve`` rebases revision 27 onto revision
   551 28, creating 30 (the successor of 27). This is entirely logical: 27
   551 28, creating 30 (the successor of 27). This is entirely logical: 27
   552 was the child of 26, and 26's successor is 28. So of course 27's
   552 was the child of 26, and 26's successor is 28. So of course 27's
   553 successor (30) should be the child of 26's successor (28).
   553 successor (30) should be the child of 26's successor (28).
   568 Sometimes you might obsolete a changeset, and then change your mind. You'll
   568 Sometimes you might obsolete a changeset, and then change your mind. You'll
   569 probably start looking for an “unobsolete” command to restore a changeset
   569 probably start looking for an “unobsolete” command to restore a changeset
   570 to normal state. For complicated implementation reasons, that command
   570 to normal state. For complicated implementation reasons, that command
   571 doesn't exist. (If you have already pushed an obsolescence marker to
   571 doesn't exist. (If you have already pushed an obsolescence marker to
   572 another repo, then Mercurial would need a way to revoke that remote
   572 another repo, then Mercurial would need a way to revoke that remote
   573 obsolesence marker. That's a hard problem.)
   573 obsolescence marker. That's a hard problem.)
   574 
   574 
   575 Instead, ``evolve`` provides a ``touch`` command to resurrect an
   575 Instead, ``evolve`` provides a ``touch`` command to resurrect an
   576 obsolete changeset. An unexpected quirk: you almost certainly need to
   576 obsolete changeset. An unexpected quirk: you almost certainly need to
   577 use ``--hidden``, since obsolete changesets tend to be hidden, and you
   577 use ``--hidden``, since obsolete changesets tend to be hidden, and you
   578 can't reference a hidden changeset otherwise. Typical usage thus looks
   578 can't reference a hidden changeset otherwise. Typical usage thus looks