# HG changeset patch # User Pierre-Yves David # Date 1407564840 25200 # Node ID a585353a816bae10f5337c3e6dcb4074f1f596da # Parent acc2b590edd912e7d7b951081c6f0c87b2b0c8f9# Parent d830377bf1868aa9e4b3951e361b19be7a4116d5 merge default into stable Release 4.1.0 is coming diff -r acc2b590edd9 -r a585353a816b README --- a/README Fri Aug 08 15:50:26 2014 -0700 +++ b/README Fri Aug 08 23:14:00 2014 -0700 @@ -29,9 +29,19 @@ ========== The simplest way to contribute is to issue a pull request on Bitbucket -(https://bitbucket.org/marmoute/mutable-history). Please don't forget -to update and run the tests when you fix a bug or add a feature. To -run the tests: +(https://bitbucket.org/marmoute/mutable-history). Alternatively, you +can use the patchbomb extension to send email to 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@selenic.com --flag evolve-ext --rev '' + +See also +http://mercurial.selenic.com/wiki/ContributingChanges#Patch_descriptions +for guidelines on the patch description. + +Please don't forget to update and run the tests when you fix a bug or +add a feature. To run the tests: cd tests python run-tests.py --with-hg=/path/to/hg @@ -47,6 +57,19 @@ Changelog ========= +4.1.0 -- + +- 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) diff -r acc2b590edd9 -r a585353a816b debian/rules --- a/debian/rules Fri Aug 08 15:50:26 2014 -0700 +++ b/debian/rules Fri Aug 08 23:14:00 2014 -0700 @@ -18,6 +18,7 @@ dh_python2 clean: clean-docs + rm -f tests/*.err clean-docs: rm -rf html diff -r acc2b590edd9 -r a585353a816b docs/concepts.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/concepts.rst Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,223 @@ +.. Copyright 2014 Greg Ward + +---------------- +Evolve: Concepts +---------------- + +Getting the most out of software requires an accurate understanding of +the concepts underlying it. For example, you cannot use Mercurial to +its full potential without understanding the DAG (directed acyclic +graph) of changesets and the meaning of parent/child relationships +between nodes in that graph. Mercurial with changeset evolution adds +some additional concepts to the graph of changesets. Understanding +those concepts will make you an informed and empowered user of +``evolve``. + +.. note:: This document contains math! If you have a pathological fear + of set theory and the associated notation, you might be + better off just reading the `user guide`_. But if you + appreciate the theoretical rigour underlying core Mercurial, + you will be happy to know that it continues right into + changeset evolution. + +.. note:: This document is incomplete! (The formatting of the math + isn't quite right yet, and the diagrams are missing for + malformatted.) + +This document follows standard set theory notation: + + x ∈ A: x is a member of A + + A ∪ B: union of A and B: { x | x ∈ A or x ∈ B } + + A ∖ B: set difference: { x | x ∈ A and x ∉ B } + + A ⊇ B: superset: if x ∈ B, then x ∈ A + +.. _`user guide`: user-guide.html + +Phases +------ + +First, every changeset in a Mercurial repository (since 2.3) has a +*phase*. Phases are independent of ``evolve`` and they affect +Mercurial usage with or without changeset evolution. However, they +were implemented in order to support evolution, and are a critical +foundation of ``evolve``. + +Phases are strictly ordered: + + secret > draft > public + +Changesets generally only move from a higher phase to a lower phase. +Typically, changesets start life in *draft* phase, and move to +*public* phase when they are pushed to a public repository. (You can +set the default phase of new commits in Mercurial configuration.) + +The purpose of phases is to prevent modifying published history. +``evolve`` will therefore only let you rewrite changesets in one of +the two *mutable* phases (secret or draft). + +Run ``hg help phases`` for more information on phases. + +Obsolete changesets +------------------- + +*Obsolescence* is they key concept at the heart of changeset +evolution. Everything else in this document depends on understanding +obsolescence. So: what does it mean for a changeset to be obsolete? + +In implementation terms, there is an *obsolescence marker* associated +with changesets: every changeset is either obsolete or not. + +The simplest way that a changeset becomes obsolete is by *pruning* it. +The ``hg prune`` command simply marks the specified changesets +obsolete, as long as they are mutable. + +More commonly, a changeset *A* becomes obsolete by *amending* it. +Amendment creates a new changeset *A'* that replaces *A*, which is now +obsolete. *A'* is the successor of *A*, and *A* the predecessor of *A'*: + + [diagram: A and A' with pred/succ edge] + +The predecessor/successor relationship forms an additional +*obsolescence graph* overlaid on top of the traditional DAG formed by +changesets and their parent/child relationships. In fact, the +obsolescence graph is second-order version control. Where the +traditional parent/child DAG tracks changes to your source code, the +obsolescence graph tracks changes to your changesets. It tracks the +evolution of your changesets. + +(If you prefer a calculus metaphor to set theory, it might help to +think of the traditional parent/child DAG as the first derivative of +your source code, and the obsolescence DAG as the second derivative.) + +Troubled changesets (unstable, bumped, divergent) +------------------------------------------------- + +Evolving history can introduce problems that need to be solved. For +example, if you prune a changeset *P* but not its descendants, those +descendants are now on thin ice. To push a changeset to another +repository *R*, all of its ancestors must be present in *R* or pushed +at the same time. But Mercurial does not push obsolete changesets like +*P*, so it cannot push the descendants of *P*. Any non-obsolete +changeset that is a descendant of an obsolete changeset is said to be +*unstable*. + + [diagram: obsolete cset with non-obsolete descendant] + +Another sort of trouble occurs when two developers, Alice and Bob, +collaborate via a shared non-publishing repository. (This is how +developers can safely `share mutable history`_.) Say Alice and Bob +both start the day with changeset *C* in *draft* phase. If Alice +pushes *C* to their public repository, then it is now published and +therefore immutable. But Bob is working from a desert island and +cannot pull this change in *C*'s phase. For Bob, *C* is still in draft +phase and therefore mutable. So Bob amends *C*, which marks it +obsolete and replaces it with *C'*. When he is back online and pulls +from the public repository, Mercurial learns that *C* is public, which +means it cannot be obsolete. We say that *C'* is *bumped*, since it is +the successor of a public changeset. + +.. _`share mutable history`: sharing.html + +(Incidentally, the terminology here comes from airline overbooking: if +two people have bought tickets for the same seat on a plane and they +both show up at the airport, only one of them gets on the plane. The +passenger who is left behind in the airport terminal has been +"bumped".) + +The third sort of trouble is when Alice and Bob both amend the same +changeset *C* to have different successors. When this happens, the +successors are both called *divergent* (unless one of them is in +public phase; only mutable changesets are divergent). + +The collective term for unstable, bumped, and divergent changeset is +*troubled*: + + troubled = unstable ∪ bumped ∪ divergent + +It is possible for a changeset to be in any of the troubled categories +at the same time: it might be unstable and divergent, or bumped and +divergent, or whatever. + + [diagram: Venn diagram of troubled changesets, showing overlap] + +The presence of troubled changesets indicates the need to run ``hg +evolve``. + +Hidden (and visible) changesets +------------------------------- + +Some obsolete changesets are *hidden*: deliberately suppressed by +Mercurial and usually not visible through the UI. (As of Mercurial +2.9, there are still some commands that inadvertently reveal hidden +changesets; these are bugs and will be fixed in due course.) + +All hidden changesets are obsolete, and all obsolete changesets are +part of your repository. Mathematically speaking: + + repo ⊇ obsolete ⊇ hidden + +Or, putting it visually: + + [diagram: Venn diagram showing nested strict subsets] + +However, the presence of obsolete but not hidden changesets should be +temporary. The desired end state for any history mutation operation is +that all obsolete changesets are hidden, i.e.: + + repo ⊇ obsolete, obsolete = hidden + +Visually: + + [diagram: Venn diagram showing obsolete = hidden, subset of repo] + + +Why is this changeset visible? +------------------------------ + +Any changeset which is not hidden is *visible*. That is, + + visible = repo ∖ hidden + +(Recall that ∖ means set difference: *visible* is the set of +changesets that are in *repo* but not in *hidden*.) + +After amending or pruning a changeset, you might expect it to be +hidden. It doesn't always work out that way. The precise rules are: + + hideable = obsolete + blockers = bookmarks ∪ parents(workingcopy) ∪ localtags + hidden = hideable ∖ ancestors((repo ∖ hideable) ∪ blockers) + +This will probably be clearer with a worked example. First, here's a +repository with some obsolete changesets, some troubled changesets, +one bookmark, a working copy, and some hidden changesets: + + x-x + / + -o-o-o-o + \ + x-x-o + +Here's the computation required to determine which changesets are +hidden: + + repo = { 0, 1, 2, 3, 4, 5, 6, 7, 8 } + + hideable = obsolete = { 2, 4, 5, 8 } + + blockers = { 6 } ∪ { 4 } ∪ {} + + blockers = { 4, 6 } + + hidden = hideable ∖ ancestors((repo ∖ { 2, 4, 5, 8 }) ∪ { 4, 6 }) + + hidden = hideable ∖ ancestors({ 0, 1, 3, 6, 7 } ∪ { 4, 6 }) + + hidden = hideable ∖ ancestors({ 0, 1, 3, 4, 6, 7 }) + + hidden = { 2, 4, 5, 8 } ∖ { 0, 1, 2, 3, 4, 5, 6, 7 } + + hidden = { 8 } diff -r acc2b590edd9 -r a585353a816b docs/conf.py --- a/docs/conf.py Fri Aug 08 15:50:26 2014 -0700 +++ b/docs/conf.py Fri Aug 08 23:14:00 2014 -0700 @@ -12,8 +12,8 @@ master_doc = 'index' # General substitutions. -project = 'Obsolete experimentation' -copyright = '2010-2011, pierre-yves.david@logilab.fr' +project = 'evolve extension for Mercurial' +copyright = '2010-2014, Pierre-Yves David, Greg Ward, and contributors' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug01.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug01.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 0 + + + + 1 + + + hg commit --amend + + + + + + + + 0 + + + + 1' + + + + poof! + + + + (destructive, not using evolve) + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug02.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug02.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,590 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 0 + + + + 1 + + + + + 0 + + + + 3 + + + + hg commit --amend + (safe, using evolve) + + + + 1 + + + + + + 2 + + T + + temporaryamendcommit + obsolete (and hidden) + precursor + successor + + + + + + + + + + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug03.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug03.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + 3 + + + + 4 + + + + + hg prune . + + + + + + + + + + + 3 + + + + 4 + + + obsolete,hidden,no successors + working dir + working dir + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug04.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug04.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,547 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 3 + + + + 5 + + + + + + 3 + + + + + + 6 + + + + + + + 5 + + + + + + obsolete, hidden + precursor + successor + + + working dir (clean) + working dir(with uncommittedchanges to f1 f2 ...) + + + + hg uncommit f1 f2 ... + + + + + + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug05.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug05.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,723 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 6 + + + + + 7 + + + + + + 6 + + + + 10 + + + + + obsolete, hidden precursors + successor, working dir + + hg fold 7 + + + + + + + + + + + + 8 + + + + + + 9 + + + + + + + 7 + + + + 8 + + + + 9 + + + + + + + + + + + working dir + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug06.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug06.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,851 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + hg amend + + + + + + + + + + 10 + + 11 + + + + 10 + + + 15 + + + + + 12 + + + + 13 + + + + + working dir + + + 11 + + + + 12 + + + + 13 + + + + + obsoletebut visible + unstable + + + + + + 14 + + T + + temporaryamendcommit;obsolete andhidden + working dir + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug07.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug07.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + hg evolve --all + + + + + + + + + + 10 + + + 15 + + + + + 11 + + + + 12 + + + + 13 + + + + + + + 14 + + T + + + + 16 + + + + 17 + + + + + + obsolete, hidden + working dir + successors + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug08.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug08.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,415 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 18 + + + + 19 + + + + 20 + + + + working dir + hg prune 19 + + + + + + + + + + 18 + + + 19 + + + 20 + + + + obsoletebut visible + unstable + working dir + + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug09.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug09.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + hg evolve --all + + + + + + + + + + 18 + + + + 19 + + + + 20 + + + + + + 21 + + + + obsolete, hidden + successor,working dir + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug10.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug10.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,872 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 21 + + + + 22 + + + + 23 + + + + + + 21 + + + 22 + + + 23 + + + + obsoletebut visible + unstable + + hg uncommit f1 f2 ... + + + + + + + + + + + 24 + + working dir(with uncommittedchanges to f1 f2 ...) + + + hg revert f1 f2 ...hg evolve --all + + + + + + + + + + 21 + + + 22 + + + 23 + + + + + + 24 + + + + + + 25 + + + + working dir(clean) + obsolete,hidden,precursors + successors + working dir(clean) + + + + + + + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug11.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug11.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,659 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 25 + + + + 26 + + + + 27 + + + + + + 25 + + + 26 + + + 27 + + + + obsoletebut visible + unstable + hg uncommit f1 f2 ...hg commit + + + + + + + + + + 28 + + working dir(clean) + + + working dir(clean) + + + + 29 + + + + + + + diff -r acc2b590edd9 -r a585353a816b docs/figures/figure-ug12.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug12.svg Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,606 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + hg evolve --all + + + + + + + + + + + 25 + + + 26 + + + 27 + + + + + + 28 + + working dir(clean) + + + + + 29 + + + + + 30 + + + + + two heads!(merge or rebase) + + + + diff -r acc2b590edd9 -r a585353a816b docs/index.rst --- a/docs/index.rst Fri Aug 08 15:50:26 2014 -0700 +++ b/docs/index.rst Fri Aug 08 23:14:00 2014 -0700 @@ -1,166 +1,105 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - -======================================== -Changeset Evolution Experimentation -======================================== - +.. Copyright © 2014 Greg Ward -This is the online documentation of the `evolve extension`_. An experimental -extension that drive the implementation of the `changeset evolution concept`_ for -Mercurial. +================================== +Changeset Evolution with Mercurial +================================== -.. _`evolve extension`: http://mercurial.selenic.com/wiki/EvolveExtension -.. _`changeset evolution concept`: http://mercurial.selenic.com/wiki/ChangesetEvolution +`evolve`_ is an experimental Mercurial extension for safe mutable history. -Here are various materials on planned improvement to Mercurial regarding -rewriting history. +.. _`evolve`: http://mercurial.selenic.com/wiki/EvolveExtension -First, read about what challenges arise while rewriting history and how we plan to -solve them once and for all. - -.. toctree:: - :maxdepth: 2 - - instability - -The effort is split in two parts: +With core Mercurial, changesets are permanent and immutable. You can +commit new changesets to modify your source code, but you cannot +modify or remove old changesets—they are carved in stone for all +eternity. - * The **obsolescence marker** concept aims to provide an alternative to ``strip`` - to get rid of changesets. This concept has been partially implemented since - Mercurial 2.3. +For years, Mercurial has included various extensions that allow +history modification: ``rebase``, ``mq``, ``histedit``, and so forth. +These are useful and popular extensions, and in fact history +modification is one of the big reasons DVCSes (distributed version +control systems) like Mercurial took off. - * The **evolve** Mercurial extension rewrites history using obsolete - *marker* under the hood. - -The first and most important step is by far the **obsolescence marker**. However -most users will never be directly exposed to the concept. For this reason -this manual starts with changeset evolution. +But there's a catch: until now, Mercurial's various mechanisms for +modifying history have been *unsafe*, in that changesets were +destroyed (“stripped”) rather than simply made invisible. -Evolve: A robust alternative to MQ -==================================== - -Evolve is an experimental history rewriting extension that uses obsolete -markers. It is inspired by MQ and pbranch but has multiple advantages over -them: - -* Focus on your current work. +``evolve`` makes things better in a couple of ways: - You can focus your work on a single changeset and take care of adapting - descendent changesets later. - -* Handle **non-linear history with branches and merges** + * It changes the behaviour of most existing history modification + extensions (``rebase``, ``histedit``, etc.) so they use a safer + mechanism (*changeset obsolescence*, covered below) rather than + the older, less safe *strip* operation. -* Rely internally on Mercurial's **robust merge** mechanism. + * It provides a new way of modifying history that is roughly + equivalent to ``mq`` (but much nicer and safer). - Simple conflicts are handled by real merge tools using the appropriate ancestor. - Conflicts are much rarer and much more user friendly. +It helps to understand that ``evolve`` builds on infrastructure +already in core Mercurial: -* Mutable history **fully available all the time**. - - Always use 'hg update' and forget about (un)applying patches to access the - mutable part of your history. - - -* Use only **plain changesets** and forget about patches. Evolve will create and - exchange real changesets. Mutable history can be used in all usual operations: - pull, push, log, diff, etc. + * *Phases* (starting in Mercurial 2.1) allow you to distinguish + mutable and immutable changesets. We'll cover phases early in the + user guide, since understanding phases is essential to + understanding ``evolve``. -* Allow **sharing and collaboration** mutable history without fear of duplicates - (thanks to obsolete marker). - -* Cover all MQ usage but guard. - -.. warning:: The evolve extension and obsolete markers are at an experimental - stage. While using obsolete you willl likely be exposed to complex - implications of the **obsolete marker** concept. I do not recommend - non-power users to test this at this stage. + * *Changeset obsolescence* (starting in Mercurial 2.3) is how + Mercurial knows how history has been modified, specifically when + one changeset replaces another. In the obsolescence model, a + changeset is neither removed nor modified, but is instead marked + *obsolete* and typically replaced by a *successor*. Obsolete + changesets usually become *hidden* as well. Obsolescence is an + invisible feature until you start using ``evolve``, so we'll cover + it in the user guide too. - While numbered 1.0.0, the command line API of this version should - **not** be regarded as *stable*: command behavior, name and - options may change in future releases or once integrated into - Mercurial. It is still an immature extension; a lot of - features are still missing but there is low risk of - repository corruption. - - Production-ready version should hide such details from normal users. +Some of the things you can do with ``evolve`` are: -The evolve extension requires Mercurial 2.5 (older versions supports down to 2.2) - -To enable the evolve extension use:: - - $ hg clone https://bitbucket.org/marmoute/mutable-history -u stable - $ echo '[extensions]\nevolve=$PWD/mutable-history/hgext/evolve.py' >> ~/.hgrc - -You will probably want to use hgview_ to visualize obsolescence. Version 1.7.1 -or later is required. - -.. _hgview: http://www.logilab.org/project/hgview/ + * Fix a mistake immediately: “Oops! I just committed a changeset + with a syntax error—I'll fix that and amend the changeset so no + one sees my mistake.” (While this is possible using existing + features of core Mercurial, ``evolve`` makes it safer.) - - --- - -For more information see the documents below: - -.. toctree:: - :maxdepth: 1 + * Fix a mistake a little bit later: “Oops! I broke the tests three + commits back, but only noticed it now—I'll just update back to the + bad changeset, fix my mistake, amend the changeset, and evolve + history to update the affected changesets.” - tutorials/tutorial - evolve-good-practice - evolve-faq - from-mq - evolve-collaboration - qsync + * Remove unwanted changes: “I hacked in some debug output two + commits back; everything is working now, so I'll just prune that + unwanted changeset and evolve history before pushing.” -Smart changeset deletion: Obsolete Marker -========================================== - -The obsolete marker is a powerful concept that allows Mercurial to safely handle -history rewriting operations. It is a new type of relation between Mercurial -changesets that tracks the result of history rewriting operations. + * Share mutable history with yourself: say you do most of your + programming work locally, but need to test on a big remote server + somewhere before you know everything is good. You can use + ``evolve`` to share mutable history between two computers, pushing + finely polished changesets to a public repository only after + testing on the test server. -This concept is simple to define and provides a very solid base for: - -- very fast history rewriting operations - -- auditable and reversible history rewriting process - -- clean final history - -- share and collaborate on mutable parts of the history + * Share mutable history for code review: you don't want to publish + unreviewed changesets, but you can't block every commit waiting + for code review. The solution is to share mutable history with + your reviewer, amending each changeset until it passes review. -- gracefully handle history rewriting conflicts - -- allow various history rewriting UI to collaborate with a underlying common API +``evolve`` is experimental! +--------------------------- - --- +TODO -For more information, see the documents below - -.. toctree:: - :maxdepth: 1 + * unstable UI + * some corner cases not covered yet - obs-concept - obs-terms - obs-implementation - +Installation and setup +---------------------- -Known limitations and bugs -================================= - -Here is a list of known issues that will be fixed later: - +TODO -* You need to provide to `graft --continue -O` if you started you - graft using `-O`. - - you to manually specify target all the time. - -* Trying to exchange obsolete marker with a static http repo will crash. +Next steps: + * For a practical guide to using ``evolve`` in a single repository, + see the `user guide`_. + * For more advanced tricks, see `sharing mutable history`_. + * To learn about the concepts underlying ``evolve``, see `concepts`_ + (incomplete). + * If you're coming from MQ, see the `MQ migration guide`_ (incomplete). -* Extinct changesets are hidden using the *hidden* feature of mercurial only - supported by a few commands. - - Only ``hg log``, ``hgview`` and `hg glog` support it. Neither ``hg heads`` nor other visual viewers do. - -* hg heads shows extinct changesets. +.. _`user guide`: user-guide.html +.. _`concepts`: concepts.html +.. _`sharing mutable history`: sharing.html +.. _`MQ migration guide`: from-mq.html diff -r acc2b590edd9 -r a585353a816b docs/sharing.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/sharing.rst Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,461 @@ +.. Copyright © 2014 Greg Ward + +------------------------------ +Evolve: Shared Mutable History +------------------------------ + +Once you have mastered the art of mutable history in a single +repository, you might want to move up to the next level: *shared* +mutable history. ``evolve`` lets you push and pull draft changesets +between repositories along with their obsolescence markers. This opens +up a number of interesting possibilities. + +The most common scenario is a single developer working across two +computers. Say you're working on code that must be tested on a remote +test server, probably in a rack somewhere, only accessible by SSH, and +running an “enterprise-grade” (out-of-date) OS. But you probably +prefer to write code locally: everything is setup the way you like it, +and you can use your preferred editor, IDE, merge/diff tools, etc. + +Traditionally, your options are limited: either + + * (ab)use your source control system by committing half-working code + in order to get it onto the remote test server, or + * go behind source control's back by using ``rsync`` (or similar) to + transfer your code back-and-forth until it is ready to commit + +The former is less bad with distributed version control systems like +Mercurial, but it's still far from ideal. (One important version +control “best practice” is that every commit should make things just a +little bit better, i.e. you should never commit code that is worse +than what came before.) The latter, avoiding version control entirely, +means that you're walking a tightrope without a safety net. One +accidental ``rsync`` in the wrong direction could destroy hours of +work. + +Using Mercurial with ``evolve`` to share mutable history solves all of +these problems. As with single-repository ``evolve``, you can commit +whenever the code is demonstrably better, even if all the tests aren't +passing yet—just ``hg amend`` when they are. And you can transfer +those half-baked changesets between repositories to try things out on +your test server before anything is carved in stone. + +A less common scenario is multiple developers sharing mutable history. +(This is in fact how Mercurial itself is developed.) We'll cover this +scenario later. But first, single-user sharing. + +Publishing and non-publishing repositories +------------------------------------------ + +The key to shared mutable history is to keep your changesets in +*draft* phase as you pass them around. Recall that by default, ``hg +push`` promotes changesets from *draft* to *public*, and public +changesets are immutable. You can change this behaviour by +reconfiguring the *target* repository so that it is non-publishing. +(Short version: set ``phases.publish`` to ``false``. Long version +follows.) + +Setting things up +----------------- + +We'll work an example with three local repositories, although in the +real world they'd most likely be on three different computers. First, +the public repository is where tested, polished changesets live, and +it is where you push/pull changesets to/from the rest of your team. :: + + $ hg init public + +We'll need two clones where work gets done:: + + $ hg clone -q public test-repo + $ hg clone -q test-repo dev-repo + +``dev-repo`` is your local machine, with GUI merge tools and IDEs and +everything configured just the way you like it. ``test-repo`` is the +test server in a rack somewhere behind SSH. So for the most part, +we'll develop in ``dev-repo``, push to ``test-repo``, test and polish +there, and push to ``public``. + +The key to making this whole thing work is to make ``test-repo`` +non-publishing:: + + $ cat >> test-repo/.hg/hgrc <> test-repo/.hg/hgrc <> dev-repo/.hg/hgrc < file1 + $ hg add file1 + $ hg commit -m 'create new project' + $ hg push -q + +and pull that into the development repository:: + + $ cd ../dev-repo + $ hg pull -u + +Amending a shared changeset +--------------------------- + +Everything you learned in the `user guide`_ applies to work done in +``dev-repo``. You can commit, amend, uncommit, evolve, and so forth +just as before. + +.. _`user guide`: user-guide.html + +Things get different when you push changesets to ``test-repo``. Or +rather, things stay the same, which *is* different: because we +configured ``test-repo`` to be non-publishing, draft changesets stay +draft when we push them to ``test-repo``. Importantly, they're also +draft (mutable) in ``test-repo``. + +Let's commit a preliminary change and push it to ``test-repo`` for +testing. :: + + $ echo 'fix fix fix' > file1 + $ hg commit -m 'prelim change' + $ hg push ../test-repo + +At this point, ``dev-repo`` and ``test-repo`` have the same changesets +in the same phases: + + [figure SG01: rev 0:0dc9 public, rev 1:f649 draft, same on both repos] + +(You may notice a change in notation from the user guide: now +changesets are labelled with their revision number and the first four +digits of the 40-digit hexadecimal changeset ID. Mercurial revision +numbers are never stable when working across repositories, especially +when obsolescence is involved. We'll see why shortly.) + +Now let's switch to ``test-repo`` to test our change:: + + $ cd ../test-repo + $ hg update + +Don't forget to ``hg update``! Pushing only adds changesets to a +remote repository; it does not update the working directory (unless +you have a hook that updates for you). + +Now let's imagine the tests failed because we didn't use proper +punctuation and capitalization (oops). Let's amend our preliminary fix +(and fix the lame commit message while we're at it):: + + $ echo 'Fix fix fix.' > file1 + $ hg amend -m 'fix bug 37' + +Now we're in a funny intermediate state (figure 2): revision 1:f649 is +obsolete in ``test-repo``, having been replaced by revision 3:60ff +(revision 2:2a03 is another one of those temporary amend commits that +we saw in the user guide)—but ``dev-repo`` knows nothing of these +recent developments. + + [figure SG02: rev 0:0dc9 public, rev 1:f649, 2:2a03 obsolete, rev 3:60ff draft -- but dev-repo same as in SG01] + +Let's resynchronize:: + + $ cd ../dev-repo + $ hg pull -u + +As seen in figure 3, this transfers the new changeset *and* the +obsolescence marker for revision 1. However, it does *not* transfer +the temporary amend commit, because it is obsolete. Push and pull +transfer obsolesence markers between repositories, but they do not +normally transfer obsolete changesets. + + [figure SG03: dev-repo grows new rev 2:60ff, marks 1:f649 obsolete] + +Because of this deliberately incomplete synchronization, revision +numbers in ``test-repo`` and ``dev-repo`` are no longer consistent. We +*must* use changeset IDs. + +Amend again, locally +-------------------- + +This process can repeat. Perhaps you figure out a more elegant fix to +the bug, and want to mutate history so nobody ever knows you had a +less-than-perfect idea. We'll implement it locally in ``dev-repo`` and +push to ``test-repo``:: + + $ echo 'Fix, fix, and fix.' > file1 + $ hg amend + $ hg push + +This time around, the temporary amend commit is in ``dev-repo``, and +it is not transferred to ``test-repo``—the same as before, just in the +opposite direction. Figure 4 shows the two repositories after amending +in ``dev-repo`` and pushing to ``test-repo``. + + [figure SG04: each repo has one temporary amend commit, but they're different in each one] + +Let's hop over to ``test-repo`` to test the more elegant fix:: + + $ cd ../test-repo + $ hg update -q + +This time, all the tests pass, so no further amendment is required. +This bug fix is finished, so we push it to the public repository:: + + $ hg push + [...] + added 1 changesets with 1 changes to 1 files + +Note that only one changeset—the final version, after two +amendments—was actually pushed. Again, Mercurial normally doesn't +transfer obsolete changesets on push and pull. (Specifically, it +doesn't transfer *hidden* changesets: roughly speaking, obsolete +changesets with no non-obsolete descendants. If you're curious, see +the `concept guide`_ for the precise definition of hidden.) + +.. _`concept guide`: concepts.html + +So the picture in ``public`` is much simpler than in either +``dev-repo`` or ``test-repo``. None of our missteps or amendments are +visible publicly, just the final, beautifully polished changeset: + + [figure SG05: public repo with rev 0:0dc9, 1:de61, both public] + +There is one important step left to do. Because we pushed from +``test-repo`` to ``public``, the pushed changeset is in *public* phase +in those two repositories. But ``dev-repo`` knows nothing of this: +that changeset is still *draft* there. If we're not careful, we might +mutate history in ``dev-repo``, obsoleting a changeset that is already +public. Let's avoid that situation for now by pulling from +``test-repo`` down to ``dev-repo``:: + + $ cd ../dev-repo + $ hg pull -u + +Getting into trouble +-------------------- + +Mercurial with ``evolve`` is a powerful tool, and using powerful tools +can have consequences. (You can cut yourself badly with a sharp knife, +but every competent chef keeps several around. Ever try to chop onions +with a spoon?) + +In the user guide, we saw examples of *unstable* changesets, which are +the most common type of troubled changeset. (Recall that a +non-obsolete changeset with obsolete ancestors is unstable.) + +Two other types of trouble can crop up: *bumped* and *divergent* +changesets. Both are more likely with shared mutable history, +especially mutable history shared by multiple developers. + +To demonstrate, let's start with the ``public`` repository as we left +it in the last example, with two immutable changesets (figure 5 +above). Two developers, Alice and Bob, start working from this point:: + + $ hg clone -q public alice + $ hg clone -q public bob + +We need to configure Alice's and Bob's working repositories similar to +``test-repo``, i.e. make them non-publishing and enable ``evolve``:: + + $ cat >> alice/.hg/hgrc < file2 + $ hg commit -q -A -m 'fix bug 15' + +Now Bob has a bad idea: he decides to pull whatever Alice is working +on and tweak her bug fix to his taste:: + + $ cd ../bob + $ hg pull -q -u ../alice + $ echo 'Fix.' > file2 + $ hg amend -q -A -m 'fix bug 15 (amended)' + +(Note the lack of communication between Alice and Bob. Failing to +communicate with your colleagues is a good way to get into trouble. +Nevertheless, ``evolve`` can usually sort things out, as we will see.) + + [figure SG06: Bob's repo with one amendment] + +After some testing, Alice realizes her bug fix is just fine as it is: +no need for further polishing and amending, this changeset is ready to +publish. :: + + $ cd ../alice + $ hg push -q + +This introduces a contradiction: in Bob's repository, changeset 2:e011 +(his copy of Alice's fix) is obsolete, since Bob amended it. But in +Alice's repository (and ``public``), that changeset is public: it is +immutable, carved in stone for all eternity. No changeset can be both +obsolete and public, so Bob is in for a surprise the next time he +pulls from ``public``:: + + $ cd ../bob + $ hg pull -q -u + 1 new bumped changesets + +Figure 7 shows what just happened to Bob's repository: changeset +2:e011 is now public, so it can't be obsolete. When that changeset was +obsolete, it made perfect sense for it to have a successor, namely +Bob's amendment of Alice's fix (changeset 4:fe88). But it's illogical +for a public changeset to have a successor, so 4:fe88 is in trouble: +it has been *bumped*. + + [figure SG07: 2:e011 now public not obsolete, 4:fe88 now bumped] + +As usual when there's trouble in your repository, the solution is to +evolve it:: + + $ hg evolve --all + +Figure 8 illustrate's Bob's repository after evolving away the bumped +changeset. Ignoring the obsolete changesets, Bob now has a nice, +clean, simple history. His amendment of Alice's bug fix lives on, as +changeset 5:227d—albeit with a software-generated commit message. (Bob +should probably amend that changeset to improve the commit message.) +But the important thing is that his repository no longer has any +troubled changesets, thanks to ``evolve``. + + [figure SG08: 5:227d is new, formerly bumped changeset 4:fe88 now hidden] + +Divergent changesets +-------------------- + +In addition to *unstable* and *bumped*, there is a third kind of +troubled changeset: *divergent*. When an obsolete changeset has two +successors, those successors are divergent. + +To illustrate, let's start Alice and Bob at the same +point—specifically, the point where Alice's repository currently +stands. Bob's repository is a bit of a mess, so we'll throw it away +and start him off with a copy of Alice's repository:: + + $ cd .. + $ rm -rf bob + $ cp -rp alice bob + +Now we'll have Bob commit a bug fix that could still be improved:: + + $ cd bob + $ echo 'pretty good fix' >> file1 + $ hg commit -u bob -m 'fix bug 24 (v1)' + +This time, Alice meddles with her colleague's work (still a bad +idea):: + + $ cd ../alice + $ hg pull -q -u ../bob + $ echo 'better (alice)' >> file1 + $ hg amend -u alice -m 'fix bug 24 (v2 by alice)' + +Here's where things change from the "bumped" scenario above: this +time, the original author (Bob) decides to amend his changeset too. :: + + $ cd ../bob + $ echo 'better (bob)' >> file1 + $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' + +At this point, the divergence exists, but only in theory: Bob's +original changeset, 3:fe81, is obsolete and has two successors. But +those successors are in different repositories, so the trouble is not +visible to anyone yet. It will be as soon as one of our players pulls +from the other's repository. Let's make Bob the victim again:: + + $ hg pull -q -u ../alice + not updating: not a linear update + (merge or update --check to force update) + 2 new divergent changesets + +The “not a linear update” is our first hint that something is wrong, +but of course “2 new divergent changesets” is the real problem. Figure +9 shows both problems. + + [figure SG09: bob's repo with 2 heads for the 2 divergent changesets, 5:fc16 and 6:694f; wc is at 5:fc16, hence update refused; both are successors of obsolete 3:fe81, hence divergence] + +Now we need to get out of trouble. Unfortunately, a `bug`_ in +``evolve`` means that the usual answer (run ``hg evolve --all``) does +not work. Bob has to figure out the solution on his own: in this case, +merge. To avoid distractions, we'll set ``HGMERGE`` to make Mercurial +resolve any conflicts in favour of Bob. :: + + $ HGMERGE=internal:local hg merge + $ hg commit -m merge + +.. _`bug`: https://bitbucket.org/marmoute/mutable-history/issue/48/ + +This is approximately what ``hg evolve`` would do in this +circumstance, if not for that bug. One annoying difference is that +Mercurial thinks the two divergent changesets are still divergent, +which you can see with a simple revset query:: + + $ hg log -q -r 'divergent()' + 5:fc16901f4d7a + 6:694fd0f6b503 + +(That annoyance should go away when the bug is fixed.) + +Conclusion +---------- + +Mutable history is a powerful tool. Like a sharp knife, an experienced +user can do wonderful things with it, much more wonderful than with a +dull knife (never mind a rusty spoon). At the same time, an +inattentive or careless user can do harm to himself or others. +Mercurial with ``evolve`` goes to great lengths to limit the harm you +can do by trying to handle all possible types of “troubled” +changesets. But having a first-aid kit nearby does not excuse you from +being careful with sharp knives. + +Mutable history shared across multiple repositories by a single +developer is a natural extension of this model. Once you are used to +using a single sharp knife on its own, it's pretty straightforward to +chop onions and mushrooms using the same knife, or to alternate +between two chopping boards with different knives. + +Mutable history shared by multiple developers is a scary place to go. +Imagine a professional kitchen full of expert chefs tossing their +favourite knives back and forth, with the occasional axe or chainsaw +thrown in to spice things up. If you're confident that you *and your +colleagues* can do it without losing a limb, go for it. But be sure to +practice a lot first before you rely on it! diff -r acc2b590edd9 -r a585353a816b docs/user-guide.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/user-guide.rst Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,561 @@ +.. Copyright © 2014 Greg Ward + +------------------ +Evolve: User Guide +------------------ + +.. contents:: + +Life without ``evolve`` +----------------------- + +Before we dive into learning about ``evolve``, let's look into some +features of core Mercurial that interact with ``evolve``. ``commit`` +affects ``evolve``, and ``evolve`` modifies how ``commit --amend`` +works. + +Example 1: Commit a new changeset +================================= + +To create a new changeset, simply run ``hg commit`` as usual. +``evolve`` does not change the behaviour of ``commit`` at all. + +However, it's important to understand that new changesets are in the +*draft* phase by default: they are mutable. This means that they can +be modified by Mercurial's existing history-editing commands +(``rebase``, ``histedit``, etc.), and also by the ``evolve`` +extension. Specifically, ``evolve`` adds a number of commands that can +be used to modify history: ``amend``, ``uncommit``, ``prune``, +``fold``, and ``evolve``. Generally speaking, changesets remain in +*draft* phase until they are pushed to another repository, at which +point they enter *public* phase. :: + + $ hg commit -m 'implement feature X' + $ hg phase -r . + 1: draft + +(Strictly speaking, changesets only become public when they are pushed +to a *publishing* repository. But all repositories are publishing by +default; you have to explicitly configure repositories to be +*non-publishing*. Non-publishing repositories are an advanced topic +which we'll see when we get to `sharing mutable history`_.) + +.. _`sharing mutable history`: sharing.html + +Example 2: Amend a changeset (traditional) +========================================== + +Imagine you've just committed a new changeset, and then you discover a +mistake. Maybe you forgot to run the tests and a failure slipped in. +You want to modify history so that you push one perfect changeset, +rather than one flawed changeset followed by an "oops" commit. (Or +perhaps you made a typo in the commit message—this is really feature +*Y*, not feature X. You can't fix that with a followup commit.) + +This is actually trivial with plain vanilla Mercurial since 2.2: fix +your mistake and run :: + + $ hg commit --amend -m 'implement feature Y' + +to create a new, amended changeset. The drawback of doing this with +vanilla Mercurial is that your original, flawed, changeset is removed +from the repository. This is *unsafe* history editing. It's probably +not too serious if all you did was fix a syntax error, but still. + +.. figure:: figures/figure-ug01.svg + + Figure 1: unsafe history modification with core Mercurial (not + using ``evolve``): the original revision 1 is destroyed. + +(Incidentally, Mercurial's traditional history modification mechanism +isn't *really* unsafe: any changeset(s) removed from the repository +are kept in a backup directory, so you can manually restore them later +if you change your mind. But it's awkward and inconvenient compared to +the features provided by ``evolve`` and changeset obsolescence.) + +Life with ``evolve`` (basic usage) +---------------------------------- + +Once you enable the ``evolve`` extension, a number of features are +available to you. First, we're going to explore several examples of +painless, trouble-free history modification. + +Example 3: Amend a changeset (with ``evolve``) +============================================== + +Outwardly, amending a changeset with ``evolve`` can look exactly the +same as it does with core Mercurial (example 2):: + + $ hg commit --amend -m 'implement feature Y' + +Alternately, you can use the new ``amend`` command added by +``evolve``:: + + $ hg amend -m 'implement feature Y' + +(``hg amend`` is nearly synonymous with ``hg commit --amend``. The +difference is that ``hg amend`` reuses the existing commit message by +default, whereas ``hg commit --amend`` runs your editor if you don't +pass ``-m`` or ``-l``.) + +Under the hood, though, things are quite different. Mercurial has +simply marked the old changeset *obsolete*, replacing it with a new +one. We'll explore what this means in detail later, after working +through a few more examples. + +Example 4: Prune an unwanted changeset +====================================== + +Sometimes you make a change, and then decide it was such a bad idea +that you don't want anyone to know about it. Or maybe it was a +debugging hack that you needed to keep around for a while, but do not +intend to ever push publicly. :: + + $ echo 'debug hack' >> file1.c + $ hg commit -m 'debug hack' + +In either case, ``hg prune`` is the answer. ``prune`` simply marks +changesets obsolete without creating any new changesets to replace +them:: + + $ hg prune . + 1 changesets pruned + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + working directory now at 934359450037 + +Outwardly, it appears that your “debug hack” commit never happened; +we're right back where we started:: + + $ hg parents --template '{rev}:{node|short} {desc|firstline}\n' + 3:934359450037 implement feature Y + +In reality, though, the “debug hack” is still there, obsolete and hidden. + +Example 5: Uncommit changes to certain files +============================================ + +Occasionally you commit more than you intended: perhaps you made +unrelated changes to different files, and thus intend to commit +different files separately. :: + + $ echo 'relevant' >> file1.c + $ echo 'irrelevant' >> file2.c + +If you forget to specify filenames on the ``commit`` command line, +Mercurial commits all those changes together:: + + $ hg commit -m 'fix bug 234' # oops: too many files + +Luckily, this mistake is easy to fix with ``uncommit``:: + + $ hg uncommit file2.c + $ hg status + M file2.c + +Let's verify that the replacement changeset looks right (i.e., +modifies only ``file1.c``):: + + $ hg parents --template '{rev}:{node|short} {desc|firstline}\n{files}\n' + 6:c8defeecf7a4 fix bug 234 + file1.c + +As before, the original flawed changeset is still there, but obsolete +and hidden. It won't be exchanged with other repositories by ``push``, +``pull``, or ``clone``. + +Example 6: Fold multiple changesets together into one +===================================================== + +If you're making extensive changes to fragile source code, you might +commit more frequently than normal so that you can fallback on a +known good state if one step goes badly. :: + + $ echo step1 >> file1.c + $ hg commit -m 'step 1' # revision 7 + $ echo step2 >> file1.c + $ hg commit -m 'step 2' # revision 8 + $ echo step3 >> file2.c + $ hg commit -m 'step 3' # revision 9 + +At the end of such a sequence, you often end up with a series of small +changesets that are tedious to review individually. It might make more +sense to combine them into a single changeset using the ``fold`` +command. + +To make sure we pass the right revisions to ``fold``, let's review the +changesets we just created, from revision 7:: + + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' -r 7:: + 7:05e61aab8294 step 1 + 8:be6d5bc8e4cc step 2 + 9:35f432d9f7c1 step 3 + +and fold them:: + + $ hg fold -m 'fix bug 64' -r 7:: + 3 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +This time, Mercurial marks three changesets obsolete, replacing them +all with a single *successor*. + +(You might be familiar with this operation under other names, like +*squash* or *collapse*.) + +Changeset obsolescence under the hood +------------------------------------- + +So far, everything has gone just fine. We haven't run into merge +conflicts or other trouble. Before we start exploring advanced usage +that can run into trouble, let's step back and see what happens when +Mercurial marks changesets obsolete. That will make it much easier to +understand the more advanced use cases we'll see later. + +When you have the ``evolve`` extension enabled, all history +modification uses the same underlying mechanism: the original +changesets are marked *obsolete* and replaced by zero or more +*successors*. The obsolete changesets are the *precursors* of their +successors. This applies equally to built-in commands (``commit +--amend``), commands added by ``evolve`` (``amend``, ``prune``, +``uncommit``, ``fold``), and even commands provided by other +extensions (``rebase``, ``histedit``). + +Another way of looking at it is that obsolescence is second-order +version control, i.e. the history of your history. We'll cover this in +more detail (and mathematical precision) in the `concepts`_ guide. + +.. _`concepts`: concepts.html + +Under the hood: Amend a changeset +================================= + +Consider Example 2, amending a changeset with ``evolve``. We saw above +that you can do this using the exact same command-line syntax as core +Mercurial, namely ``hg commit --amend``. But the implementation is +quite different, and Figure 2 shows how. + +.. figure:: figures/figure-ug02.svg + + Figure 2: safe history modification using ``evolve``: the original + revision 1 is preserved as an obsolete changeset. (The "temporary + amend commit", marked with T, is an implementation detail stemming + from limitations in Mercurial's current merge machinery. Future + versions of Mercurial will not create them.) + +In this case, the obsolete changesets are also *hidden*. That is the +usual end state for obsolete changesets. But many scenarios result in +obsolete changesets that are still visible, which indicates your +history modification work is not yet done. We'll see examples of that +later, when we cover advanced usage. + +Seeing hidden changesets +======================== + +TODO + +Under the hood: Prune an unwanted changeset +=========================================== + +``prune`` (example 4 above) is the simplest history modification +command provided by ``evolve``. All it does is mark the specified +changeset(s) obsolete, with no successor/precursor relationships +involved. (If the working directory parent was one of the obsolete +changesets, ``prune`` updates back to a suitable ancestor.) + +.. figure:: figures/figure-ug03.svg + + Figure 3: pruning a changeset marks it obsolete with no successors. + +Under the hood: Uncommit changes to certain files +================================================= + +In one sense, ``uncommit`` is a simplified version of ``amend``. Like +``amend``, it obsoletes one changeset and leaves it with a single +successor. Unlike ``amend``, there is no ugly "temporary amend commit" +cluttering up the repository. + +In another sense, ``uncommit`` is the inverse of ``amend``: ``amend`` +takes any uncommitted changes in the working dir and “adds” +them to the working directory's parent changeset. (In reality, of +course, it creates a successor changeset, marking the original +obsolete.) In contrast, ``uncommit`` takes some changes in the working +directory's parent and moves them to the working dir, creating a new +successor changeset in the process. Figure 4 illustrates. + +.. figure:: figures/figure-ug04.svg + + Figure 4: uncommit moves some of the changes from the working + directory parent into the working dir, preserving the remaining + changes as a new successor changeset. (N.B. revision 4 is not shown + here because it was marked obsolete in the previous example.) + + +Under the hood: Fold multiple changesets together into one +========================================================== + +The last basic example is folding multiple changesets into one, which +marks multiple changesets obsolete, replacing them all with a single +successor. + +.. figure:: figures/figure-ug05.svg + + Figure 5: fold combines multiple changesets into a single + successor, marking the original (folded) changesets obsolete. + + +Obsolete is not hidden +====================== + +TODO + + +Understanding revision numbers +============================== + +If you're trying these examples on your own, especially using ``hg +log`` without ``--hidden``, you have probably noticed some funny +business going on with revision numbers: there are now gaps in the +sequence. That's something you don't see with plain vanilla Mercurial; +normally, revision N is always followed by revision N+1. + +This is just the visible manifestation of hidden changesets. If +revision 95 is followed by revision 98, that means there are two +hidden changesets, 96 and 97, in between. + +Note that changeset IDs are still the permanent, immutable identifier +for changesets. Revision numbers are, as ever, a handy shorthand that +work in your local repository, but cannot be used across repositories. +They also have the useful property of showing when there are hidden +changesets lurking under the covers, which is why this document uses +revision numbers. + + +Life with ``evolve`` (advanced usage) +------------------------------------- + +Now that you've got a solid understanding of how ``evolve`` works in +concert with changeset obsolescence, let's explore some more advanced +scenarios. All of these scenarios will involve *unstable* changesets, +which is an unavoidable consequence of obsolescence. What really sets +``evolve`` apart from other history modification mechanisms is the +fact that it recognizes troubles like unstable changesets and provides +a consistent way for you to get out of trouble. + +(Incidentally, there are two other types of trouble that changesets +can get into with ``evolve``: they may be *divergent* or *bumped*. +Both of those states are more likely to occur when `sharing mutable +history`_, so we won't see them in this user guide.) + +.. _`sharing mutable history`: sharing.html + + +Example 7: Amend an older changeset +=================================== + +Sometimes you don't notice your mistakes until after you have +committed some new changesets on top of them. :: + + $ hg commit -m 'fix bug 17' # rev 11 (mistake here) + $ hg commit -m 'cleanup' # rev 12 + $ hg commit -m 'feature 23' # rev 13 + +Traditionally, your only option is to commit an "oops" changeset that +fixes your mistake. That works, of course, but it makes you look bad: +you made a mistake, and the record of that mistake is recorded in +history for all eternity. (If the mistake was in the commit message, +too bad.) + +More subtly, there now exist changesets that are *worse* than what +came before—the code no longer builds, the tests don't pass, or +similar. Anyone reviewing these patches will waste time noticing the +error in the earlier patch, and then the correction later on. + +You can avoid all this by amending the bad changeset and *evolving* +subsequent history. Here's how it works, assuming you have just +committed revision 13 and noticed the mistake in revision 11:: + + $ hg update 11 + [...fix mistake...] + $ hg amend + +At this point, revision 11 is *obsolete* and revisions 12 and 13—the +descendants of 11—are in a funny state: they are *unstable*. + +.. figure:: figures/figure-ug06.svg + + Figure 6: amending a changeset with descendants means the amended + changeset is obsolete but remains visible; its non-obsolete + descendants are *unstable*. The temporary amend commit, revision + 14, is hidden because it has no non-obsolete descendants. + +All non-obsolete descendants of an obsolete changeset are unstable. An +interesting consequence of this is that revision 11 is still visible, +even though it is obsolete. Obsolete changesets with non-obsolete +descendants are not hidden. + +The fix is to *evolve* history:: + + $ hg evolve --all + +This is a separate step, not automatically part of ``hg amend``, +because there might be conflicts. If your amended changeset modifies a +file that one of its descendants also modified, Mercurial has to fire +up your merge tool to resolve the conflict. More importantly, you have +to switch contexts from "writing code" to "resolving conflicts". That +can be an expensive context switch, so Mercurial lets you decide when +to do it. + +The end state, after ``evolve`` finishes, is that the original +revisions (11-13) are obsolete and hidden. Their successor revisions +(15-17) replace them. + +.. figure:: figures/figure-ug07.svg + + Figure 7: evolve your repository (``hg evolve --all``) to take care + of instability. Unstable changesets become obsolete, and are + replaced by successors just like the amended changeset was. + +Example 8: Prune an older changeset +=================================== + +Let's say you've just committed the following changesets:: + + $ hg commit -m 'useful work' # rev 18 + $ hg commit -m 'debug hack' # rev 19 + $ hg commit -m 'more work' # rev 20 + +You want to drop revision 19, but keep 18 and 20. No problem:: + + $ hg prune 19 + 1 changesets pruned + 1 new unstable changesets + +As above, this leaves your repository in a funny intermediate state: +revision 20 is the non-obsolete descendant of obsolete revision 19. +That is, revision 20 is unstable. + +.. figure:: figures/figure-ug08.svg + + Figure 8: ``hg prune`` marks a changeset obsolete without creating + a successor. Just like with ``hg amend``, non-obsolete descendants + of the pruned changeset are now unstable. + +As before, the solution to unstable changesets is to evolve your +repository:: + + $ hg evolve --all + +This rebases revision 20 on top of 18 as the new revision 21, leaving +19 and 20 obsolete and hidden: + +.. figure:: figures/figure-ug09.svg + + Figure 9: once again, ``hg evolve --all`` takes care of instability. + +Example 9: Uncommit files from an older changeset (discard changes) +======================================================================= + +As in example 5, let's say you accidentally commit some unrelated +changes together. Unlike example 5, you don't notice your mistake +immediately, but commit a new changeset on top of the bad one. :: + + $ echo 'this fixes bug 53' >> file1.c + $ echo 'debug hack' >> file2.c + $ hg commit -m 'fix bug 53' # rev 22 (oops) + $ echo 'and this handles bug 67' >> file1.c + $ hg commit -m 'fix bug 67' # rev 23 (fine) + +As with ``amend``, you need to travel back in time and repair revision +22, leaving your changes to ``file2.c`` back in the working +directory:: + + $ hg update 22 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg uncommit file2.c + 1 new unstable changesets + $ hg status + M file2.c + +Now your repository has unstable changesets, so you need to evolve it. +But ``hg evolve`` requires a clean working directory to resolve merge +conflicts, so you need to decide what to do with ``file2.c``. + +In this case, the change to ``file2.c`` was a temporary debugging +hack, so we can discard it and immediately evolve the instability away:: + + $ hg revert file2.c + $ hg evolve --all + move:[23] fix bug 67 + atop:[24] fix bug 53 + +Figure 10 illustrates the whole process. + +.. figure:: figures/figure-ug10.svg + + Figure 10: ``hg uncommit`` of a changeset with descendants results + in instability *and* a dirty working directory, both of which must + be dealt with. + + +Example 10: Uncommit files to an older changeset (keep changes) +=================================================================== + +This is very similar to example 9. The difference that this time, our +change to ``file2.c`` is valuable enough to commit, making things a +bit more complicated. The setup is nearly identical:: + + $ echo 'fix a bug' >> file1.c + $ echo 'useful but unrelated' >> file2.c + $ hg commit -u dan -d '11 0' -m 'fix a bug' # rev 26 (oops) + $ echo 'new feature' >> file1.c + $ hg commit -u dan -d '12 0' -m 'new feature' # rev 27 (fine) + +As before, we update back to the flawed changeset (this time, +revision 26) and ``uncommit``, leaving uncommitted changes to +``file2.c`` in the working dir:: + + $ hg update -q 26 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg uncommit -q file2.c # obsoletes rev 26, creates rev 28 + 1 new unstable changesets + $ hg status + M file2.c + +This time, let's save that useful change before evolving:: + + $ hg commit -m 'useful tweak' # rev 29 + +Figure 11 shows the story so far: ``uncommit`` obsoleted revision 26 +and created revision 28, the successor of 26. Then we committed +revision 29, a child of 28. We still have to deal with the unstable +revision 27. + +.. figure:: figures/figure-ug11.svg + + Figure 11: Uncommitting a file and then committing that change + separately will soon result in a two-headed repository. + +This is where things get tricky. As usual when a repository has +unstable changesets, we want to evolve it:: + + $ hg evolve --all + +The problem is that ``hg evolve`` rebases revision 27 onto revision +28, creating 30 (the successor of 27). This is entirely logical: 27 +was the child of 26, and 26's successor is 28. So of course 27's +successor (30) should be the child of 26's successor (28). +Unfortunately, that leaves us with a two-headed repository: + +.. figure:: figures/figure-ug12.svg + + Figure 12: ``evolve`` takes care of unstable changesets; it does + not solve all the world's problems. + +As usual when faced with a two-headed repository, you can either merge +or rebase. It's up to you. + + +Example 11: Recover an obsolete changeset +========================================= + +TODO diff -r acc2b590edd9 -r a585353a816b hgext/evolve.py --- a/hgext/evolve.py Fri Aug 08 15:50:26 2014 -0700 +++ b/hgext/evolve.py Fri Aug 08 23:14:00 2014 -0700 @@ -58,11 +58,12 @@ from mercurial import node from mercurial import phases from mercurial import patch +from mercurial import pushkey from mercurial import revset from mercurial import scmutil from mercurial import templatekw from mercurial.i18n import _ -from mercurial.commands import walkopts, commitopts, commitopts2 +from mercurial.commands import walkopts, commitopts, commitopts2, mergetoolopts from mercurial.node import nullid from mercurial import wireproto from mercurial import localrepo @@ -90,6 +91,18 @@ # - Older format compat +##################################################################### +### Compatibility with core ### +##################################################################### + + +def retractboundary(repo, tr, targetphase, nodes): + """Older mercurial version does not move phase within a transaction""" + try: + return phases.retractboundary(repo, tr, targetphase, nodes) + except TypeError: + return phases.retractboundary(repo, targetphase, nodes) + ##################################################################### ### Extension helper ### @@ -325,6 +338,25 @@ ### experimental behavior ### ##################################################################### +commitopts3 = [ + ('D', 'current-date', None, + _('record the current date as commit date')), + ('U', 'current-user', None, + _('record the current user as committer')), +] + +def _resolveoptions(ui, opts): + """modify commit options dict to handle related options + + For now, all it does is figure out the commit date: respect -D unless + -d was supplied. + """ + # N.B. this is extremely similar to setupheaderopts() in mq.py + if not opts.get('date') and opts.get('current_date'): + opts['date'] = '%d %d' % util.makedate() + if not opts.get('user') and opts.get('current_user'): + opts['user'] = ui.username() + @eh.wrapfunction(mercurial.obsolete, 'createmarkers') def _createmarkers(orig, repo, relations, *args, **kwargs): """register parent information at prune time""" @@ -435,7 +467,7 @@ """``troubled()`` Changesets with troubles. """ - _ = revset.getargs(x, 0, 0, 'troubled takes no arguments') + revset.getargs(x, 0, 0, 'troubled takes no arguments') return repo.revs('%ld and (unstable() + bumped() + divergent())', subset) @@ -594,6 +626,13 @@ return 'unstable' return 'stable' +@eh.templatekw('troubles') +def showtroubles(repo, ctx, **args): + """:troubles: List of strings. Evolution troubles affecting the changeset + (zero or more of "unstable", "divergent" or "bumped").""" + return templatekw.showlist('trouble', ctx.troubles(), plural='troubles', + **args) + ##################################################################### ### Various trouble warning ### ##################################################################### @@ -732,72 +771,67 @@ base = old.p1() updatebookmarks = _bookmarksupdater(repo, old.node()) - wlock = repo.wlock() - try: - - # commit a new version of the old changeset, including the update - # collect all files which might be affected - files = set(old.files()) - for u in updates: - files.update(u.files()) - - # Recompute copies (avoid recording a -> b -> a) - copied = copies.pathcopies(base, head) - - - # prune files which were reverted by the updates - def samefile(f): - if f in head.manifest(): - a = head.filectx(f) - if f in base.manifest(): - b = base.filectx(f) - return (a.data() == b.data() - and a.flags() == b.flags()) - else: - return False + # commit a new version of the old changeset, including the update + # collect all files which might be affected + files = set(old.files()) + for u in updates: + files.update(u.files()) + + # Recompute copies (avoid recording a -> b -> a) + copied = copies.pathcopies(base, head) + + + # prune files which were reverted by the updates + def samefile(f): + if f in head.manifest(): + a = head.filectx(f) + if f in base.manifest(): + b = base.filectx(f) + return (a.data() == b.data() + and a.flags() == b.flags()) else: - return f not in base.manifest() - files = [f for f in files if not samefile(f)] - # commit version of these files as defined by head - headmf = head.manifest() - def filectxfn(repo, ctx, path): - if path in headmf: - fctx = head[path] - flags = fctx.flags() - mctx = memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) - return mctx - raise IOError() - - message = cmdutil.logmessage(repo.ui, commitopts) - if not message: - message = old.description() - - user = commitopts.get('user') or old.user() - date = commitopts.get('date') or None # old.date() - extra = dict(commitopts.get('extra', {})) - extra['branch'] = head.branch() - - new = context.memctx(repo, - parents=newbases, - text=message, - files=files, - filectxfn=filectxfn, - user=user, - date=date, - extra=extra) - - if commitopts.get('edit'): - new._text = cmdutil.commitforceeditor(repo, new, []) - revcount = len(repo) - newid = repo.commitctx(new) - new = repo[newid] - created = len(repo) != revcount - updatebookmarks(newid) - finally: - wlock.release() + return False + else: + return f not in base.manifest() + files = [f for f in files if not samefile(f)] + # commit version of these files as defined by head + headmf = head.manifest() + def filectxfn(repo, ctx, path): + if path in headmf: + fctx = head[path] + flags = fctx.flags() + mctx = memfilectx(repo, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) + return mctx + raise IOError() + + message = cmdutil.logmessage(repo.ui, commitopts) + if not message: + message = old.description() + + user = commitopts.get('user') or old.user() + date = commitopts.get('date') or None # old.date() + extra = dict(commitopts.get('extra', {})) + extra['branch'] = head.branch() + + new = context.memctx(repo, + parents=newbases, + text=message, + files=files, + filectxfn=filectxfn, + user=user, + date=date, + extra=extra) + + if commitopts.get('edit'): + new._text = cmdutil.commitforceeditor(repo, new, []) + revcount = len(repo) + newid = repo.commitctx(new) + new = repo[newid] + created = len(repo) != revcount + updatebookmarks(newid) return newid, created @@ -806,27 +840,25 @@ def relocate(repo, orig, dest): """rewrite on dest""" + if orig.rev() == dest.rev(): + raise util.Abort(_('tried to relocate a node on top of itself'), + hint=_("This shouldn't happen. If you still " + "need to move changesets, please do so " + "manually with nothing to rebase - working " + "directory parent is also destination")) + + rebase = extensions.find('rebase') + # dummy state to trick rebase node + if not orig.p2().rev() == node.nullrev: + raise util.Abort( + 'no support for evolving merge changesets yet', + hint="Redo the merge a use `hg prune` to obsolete the old one") + destbookmarks = repo.nodebookmarks(dest.node()) + nodesrc = orig.node() + destphase = repo[nodesrc].phase() + tr = repo.transaction('relocate') try: - if orig.rev() == dest.rev(): - raise util.Abort(_('tried to relocate a node on top of itself'), - hint=_("This shouldn't happen. If you still " - "need to move changesets, please do so " - "manually with nothing to rebase - working " - "directory parent is also destination")) - - rebase = extensions.find('rebase') - # dummy state to trick rebase node - if not orig.p2().rev() == node.nullrev: - raise util.Abort( - 'no support for evolving merge changesets yet', - hint="Redo the merge a use `hg prune` to obsolete the old one") - destbookmarks = repo.nodebookmarks(dest.node()) - nodesrc = orig.node() - destphase = repo[nodesrc].phase() - wlock = lock = None try: - wlock = repo.wlock() - lock = repo.lock() r = rebase.rebasenode(repo, orig.node(), dest.node(), {node.nullrev: node.nullrev}, False) if r[-1]: #some conflict @@ -840,11 +872,9 @@ pass exc.__class__ = LocalMergeFailure raise - finally: - lockmod.release(lock, wlock) oldbookmarks = repo.nodebookmarks(nodesrc) if nodenew is not None: - phases.retractboundary(repo, destphase, [nodenew]) + retractboundary(repo, tr, destphase, [nodenew]) createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) for book in oldbookmarks: repo._bookmarks[book] = nodenew @@ -857,11 +887,10 @@ repo._bookmarks[book] = dest.node() if oldbookmarks or destbookmarks: repo._bookmarks.write() - return nodenew - except util.Abort: - # Invalidate the previous setparents - repo.dirstate.invalidate() - raise + tr.close() + finally: + tr.release() + return nodenew def _bookmarksupdater(repo, oldid): """Return a callable update(newid) updating the current bookmark @@ -994,9 +1023,7 @@ tr.close() ui.progress(pgop, None) finally: - if tr is not None: - tr.release() - lockmod.release(lock, wlock) + lockmod.release(tr, lock, wlock) @command('debugobsstorestat', [], '') def cmddebugobsstorestat(ui, repo): @@ -1124,9 +1151,13 @@ @command('^evolve|stabilize|solve', [('n', 'dry-run', False, 'do not perform actions, just print what would be done'), - ('A', 'any', False, 'evolve any troubled changeset'), - ('a', 'all', False, 'evolve all troubled changesets'), - ('c', 'continue', False, 'continue an interrupted evolution'), ], + ('', 'confirm', False, + 'ask for confirmation before performing the action'), + ('A', 'any', False, 'also consider troubled changesets unrelated to current working directory'), + ('a', 'all', False, 'evolve all troubled changesets in the repo ' + '(implies any)'), + ('c', 'continue', False, 'continue an interrupted evolution'), + ] + mergetoolopts, _('[OPTIONS]...')) def evolve(ui, repo, **opts): """Solve trouble in your repository @@ -1137,9 +1168,10 @@ - update to a successor if the working directory parent is obsolete - By default, takes the first troubled changeset that looks relevant. - - (The logic is still a bit fuzzy) + By default a single changeset is evolved for each invocation and only + troubled changesets that would evolve as a descendant of the current + working directory will be considered. See --all and --any options to change + this behavior. - For unstable, this means taking the first which could be rebased as a child of the working directory parent revision or one of its descendants @@ -1156,6 +1188,8 @@ anyopt = opts['any'] allopt = opts['all'] dryrunopt = opts['dry_run'] + confirmopt = opts['confirm'] + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve') if contopt: if anyopt: @@ -1165,8 +1199,8 @@ graftcmd = commands.table['graft'][0] return graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) - tr = _picknexttroubled(ui, repo, anyopt or allopt) - if tr is None: + tro = _picknexttroubled(ui, repo, anyopt or allopt) + if tro is None: if repo['.'].obsolete(): displayer = cmdutil.show_changeset( ui, repo, {'template': shorttemplate}) @@ -1218,33 +1252,43 @@ seen = 1 count = allopt and _counttroubled(ui, repo) or 1 - while tr is not None: + while tro is not None: progresscb() - result = _evolveany(ui, repo, tr, dryrunopt, progresscb=progresscb) + wlock = lock = tr = None + try: + wlock = repo.wlock() + lock = repo.lock() + tr = repo.transaction("evolve") + result = _evolveany(ui, repo, tro, dryrunopt, confirmopt, + progresscb=progresscb) + tr.close() + finally: + lockmod.release(tr, lock, wlock) progresscb() seen += 1 if not allopt: return result progresscb() - tr = _picknexttroubled(ui, repo, anyopt or allopt) + tro = _picknexttroubled(ui, repo, anyopt or allopt) if allopt: ui.progress('evolve', None) -def _evolveany(ui, repo, tr, dryrunopt, progresscb): +def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb): repo = repo.unfiltered() - tr = repo[tr.rev()] + tro = repo[tro.rev()] cmdutil.bailifchanged(repo) - troubles = tr.troubles() + troubles = tro.troubles() if 'unstable' in troubles: - return _solveunstable(ui, repo, tr, dryrunopt, progresscb) + return _solveunstable(ui, repo, tro, dryrunopt, confirmopt, progresscb) elif 'bumped' in troubles: - return _solvebumped(ui, repo, tr, dryrunopt, progresscb) + return _solvebumped(ui, repo, tro, dryrunopt, confirmopt, progresscb) elif 'divergent' in troubles: repo = repo.unfiltered() - tr = repo[tr.rev()] - return _solvedivergent(ui, repo, tr, dryrunopt, progresscb) + tro = repo[tro.rev()] + return _solvedivergent(ui, repo, tro, dryrunopt, confirmopt, + progresscb) else: assert False # WHAT? unknown troubles @@ -1259,21 +1303,21 @@ def _picknexttroubled(ui, repo, pickany=False, progresscb=None): """Pick a the next trouble changeset to solve""" if progresscb: progresscb() - tr = _stabilizableunstable(repo, repo['.']) - if tr is None: + tro = _stabilizableunstable(repo, repo['.']) + if tro is None: wdp = repo['.'] if 'divergent' in wdp.troubles(): - tr = wdp - if tr is None and pickany: + tro = wdp + if tro is None and pickany: troubled = list(repo.set('unstable()')) if not troubled: troubled = list(repo.set('bumped()')) if not troubled: troubled = list(repo.set('divergent()')) if troubled: - tr = troubled[0] - - return tr + tro = troubled[0] + + return tro def _stabilizableunstable(repo, pctx): """Return a changectx for an unstable changeset which can be @@ -1297,7 +1341,8 @@ return child return None -def _solveunstable(ui, repo, orig, dryrun=False, progresscb=None): +def _solveunstable(ui, repo, orig, dryrun=False, confirm=False, + progresscb=None): """Stabilize a unstable changeset""" obs = orig.parents()[0] if not obs.obsolete(): @@ -1322,12 +1367,13 @@ target = targets[0] displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) target = repo[target] - repo.ui.status(_('move:')) - if not ui.quiet: + if not ui.quiet or confirm: + repo.ui.write(_('move:')) displayer.show(orig) - repo.ui.status(_('atop:')) - if not ui.quiet: + repo.ui.write(_('atop:')) displayer.show(target) + if confirm and ui.prompt('perform evolve? [Ny]') != 'y': + raise util.Abort(_('evolve aborted by user')) if progresscb: progresscb() todo = 'hg rebase -r %s -d %s\n' % (orig, target) if dryrun: @@ -1335,7 +1381,6 @@ else: repo.ui.note(todo) if progresscb: progresscb() - lock = repo.lock() try: relocate(repo, orig, target) except MergeFailure: @@ -1344,10 +1389,9 @@ repo.ui.write_err( _('fix conflict and run "hg evolve --continue"\n')) raise - finally: - lock.release() - -def _solvebumped(ui, repo, bumped, dryrun=False, progresscb=None): + +def _solvebumped(ui, repo, bumped, dryrun=False, confirm=False, + progresscb=None): """Stabilize a bumped changeset""" # For now we deny bumped merge if len(bumped.parents()) > 1: @@ -1360,12 +1404,13 @@ ' %s being a merge' % prec) displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) - repo.ui.status(_('recreate:')) - if not ui.quiet: + if not ui.quiet or confirm: + repo.ui.write(_('recreate:')) displayer.show(bumped) - repo.ui.status(_('atop:')) - if not ui.quiet: + repo.ui.write(_('atop:')) displayer.show(prec) + if confirm and ui.prompt('perform evolve? [Ny]') != 'y': + raise util.Abort(_('evolve aborted by user')) if dryrun: todo = 'hg rebase --rev %s --dest %s;\n' % (bumped, prec.p1()) repo.ui.write(todo) @@ -1374,85 +1419,78 @@ repo.ui.write('hg commit --msg "bumped update to %s"') return 0 if progresscb: progresscb() - wlock = repo.wlock() + newid = tmpctx = None + tmpctx = bumped + bmupdate = _bookmarksupdater(repo, bumped.node()) + # Basic check for common parent. Far too complicated and fragile + tr = repo.transaction('bumped-stabilize') try: - newid = tmpctx = None - tmpctx = bumped - lock = repo.lock() - try: - bmupdate = _bookmarksupdater(repo, bumped.node()) - # Basic check for common parent. Far too complicated and fragile - tr = repo.transaction('bumped-stabilize') + if not list(repo.set('parents(%d) and parents(%d)', bumped, prec)): + # Need to rebase the changeset at the right place + repo.ui.status( + _('rebasing to destination parent: %s\n') % prec.p1()) try: - if not list(repo.set('parents(%d) and parents(%d)', bumped, prec)): - # Need to rebase the changeset at the right place - repo.ui.status( - _('rebasing to destination parent: %s\n') % prec.p1()) - try: - tmpid = relocate(repo, bumped, prec.p1()) - if tmpid is not None: - tmpctx = repo[tmpid] - createmarkers(repo, [(bumped, (tmpctx,))]) - except MergeFailure: - repo.opener.write('graftstate', bumped.hex() + '\n') - repo.ui.write_err(_('evolution failed!\n')) - repo.ui.write_err( - _('fix conflict and run "hg evolve --continue"\n')) - raise - # Create the new commit context - repo.ui.status(_('computing new diff\n')) - files = set() - copied = copies.pathcopies(prec, bumped) - precmanifest = prec.manifest() - for key, val in bumped.manifest().iteritems(): - if precmanifest.pop(key, None) != val: - files.add(key) - files.update(precmanifest) # add missing files - # commit it - if files: # something to commit! - def filectxfn(repo, ctx, path): - if path in bumped: - fctx = bumped[path] - flags = fctx.flags() - mctx = memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) - return mctx - raise IOError() - text = 'bumped update to %s:\n\n' % prec - text += bumped.description() - - new = context.memctx(repo, - parents=[prec.node(), node.nullid], - text=text, - files=files, - filectxfn=filectxfn, - user=bumped.user(), - date=bumped.date(), - extra=bumped.extra()) - - newid = repo.commitctx(new) - if newid is None: - createmarkers(repo, [(tmpctx, ())]) - newid = prec.node() - else: - phases.retractboundary(repo, bumped.phase(), [newid]) - createmarkers(repo, [(tmpctx, (repo[newid],))], - flag=obsolete.bumpedfix) - bmupdate(newid) - tr.close() - repo.ui.status(_('committed as %s\n') % node.short(newid)) - finally: - tr.release() - finally: - lock.release() - # reroute the working copy parent to the new changeset - repo.dirstate.setparents(newid, node.nullid) + tmpid = relocate(repo, bumped, prec.p1()) + if tmpid is not None: + tmpctx = repo[tmpid] + createmarkers(repo, [(bumped, (tmpctx,))]) + except MergeFailure: + repo.opener.write('graftstate', bumped.hex() + '\n') + repo.ui.write_err(_('evolution failed!\n')) + repo.ui.write_err( + _('fix conflict and run "hg evolve --continue"\n')) + raise + # Create the new commit context + repo.ui.status(_('computing new diff\n')) + files = set() + copied = copies.pathcopies(prec, bumped) + precmanifest = prec.manifest() + for key, val in bumped.manifest().iteritems(): + if precmanifest.pop(key, None) != val: + files.add(key) + files.update(precmanifest) # add missing files + # commit it + if files: # something to commit! + def filectxfn(repo, ctx, path): + if path in bumped: + fctx = bumped[path] + flags = fctx.flags() + mctx = memfilectx(repo, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) + return mctx + raise IOError() + text = 'bumped update to %s:\n\n' % prec + text += bumped.description() + + new = context.memctx(repo, + parents=[prec.node(), node.nullid], + text=text, + files=files, + filectxfn=filectxfn, + user=bumped.user(), + date=bumped.date(), + extra=bumped.extra()) + + newid = repo.commitctx(new) + if newid is None: + createmarkers(repo, [(tmpctx, ())]) + newid = prec.node() + else: + retractboundary(repo, tr, bumped.phase(), [newid]) + createmarkers(repo, [(tmpctx, (repo[newid],))], + flag=obsolete.bumpedfix) + bmupdate(newid) + tr.close() + repo.ui.status(_('committed as %s\n') % node.short(newid)) finally: - wlock.release() - -def _solvedivergent(ui, repo, divergent, dryrun=False, progresscb=None): + tr.release() + # reroute the working copy parent to the new changeset + repo.dirstate.setparents(newid, node.nullid) + +def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False, + progresscb=None): base, others = divergentdata(divergent) if len(others) > 1: othersstr = "[%s]" % (','.join([str(i) for i in others])) @@ -1467,7 +1505,7 @@ "| You should contact your local evolution Guru for help.\n" % (divergent, othersstr)) raise util.Abort("we do not handle divergence with split yet", - hint='') + hint=hint) other = others[0] if divergent.phase() <= phases.public: raise util.Abort("we can't resolve this conflict from the public side", @@ -1489,15 +1527,15 @@ % {'d': divergent, 'o': other}) displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) - ui.status(_('merge:')) - if not ui.quiet: + if not ui.quiet or confirm: + ui.write(_('merge:')) displayer.show(divergent) - ui.status(_('with: ')) - if not ui.quiet: + ui.write(_('with: ')) displayer.show(other) - ui.status(_('base: ')) - if not ui.quiet: + ui.write(_('base: ')) displayer.show(base) + if confirm and ui.prompt('perform evolve? [Ny]') != 'y': + raise util.Abort(_('evolve aborted by user')) if dryrun: ui.write('hg update -c %s &&\n' % divergent) ui.write('hg merge %s &&\n' % other) @@ -1508,55 +1546,48 @@ ui.write('hg commit -m "`hg log -r %s --template={desc}`";\n' % divergent) return - wlock = lock = None - try: - wlock = repo.wlock() - lock = repo.lock() - if divergent not in repo[None].parents(): - repo.ui.status(_('updating to "local" conflict\n')) - hg.update(repo, divergent.rev()) - repo.ui.note(_('merging divergent changeset\n')) - if progresscb: progresscb() - stats = merge.update(repo, - other.node(), - branchmerge=True, - force=False, - partial=None, - ancestor=base.node(), - mergeancestor=True) - hg._showstats(repo, stats) - if stats[3]: - repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " - "or 'hg update -C .' to abandon\n")) - if stats[3] > 0: - raise util.Abort('merge conflict between several amendments ' - '(this is not automated yet)', - hint="""/!\ You can try: + if divergent not in repo[None].parents(): + repo.ui.status(_('updating to "local" conflict\n')) + hg.update(repo, divergent.rev()) + repo.ui.note(_('merging divergent changeset\n')) + if progresscb: progresscb() + stats = merge.update(repo, + other.node(), + branchmerge=True, + force=False, + partial=None, + ancestor=base.node(), + mergeancestor=True) + hg._showstats(repo, stats) + if stats[3]: + repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " + "or 'hg update -C .' to abandon\n")) + if stats[3] > 0: + raise util.Abort('merge conflict between several amendments ' + '(this is not automated yet)', + hint="""/!\ You can try: /!\ * manual merge + resolve => new cset X /!\ * hg up to the parent of the amended changeset (which are named W and Z) /!\ * hg revert --all -r X /!\ * hg ci -m "same message as the amended changeset" => new cset Y /!\ * hg kill -n Y W Z """) - if progresscb: progresscb() - tr = repo.transaction('stabilize-divergent') - try: - repo.dirstate.setparents(divergent.node(), node.nullid) - oldlen = len(repo) - amend(ui, repo, message='', logfile='') - if oldlen == len(repo): - new = divergent - # no changes - else: - new = repo['.'] - createmarkers(repo, [(other, (new,))]) - phases.retractboundary(repo, other.phase(), [new.node()]) - tr.close() - finally: - tr.release() + if progresscb: progresscb() + tr = repo.transaction('stabilize-divergent') + try: + repo.dirstate.setparents(divergent.node(), node.nullid) + oldlen = len(repo) + amend(ui, repo, message='', logfile='') + if oldlen == len(repo): + new = divergent + # no changes + else: + new = repo['.'] + createmarkers(repo, [(other, (new,))]) + retractboundary(repo, tr, other.phase(), [new.node()]) + tr.close() finally: - lockmod.release(lock, wlock) - + tr.release() def divergentdata(ctx): """return base, other part of a conflict @@ -1725,9 +1756,9 @@ raise util.Abort(_('nothing to prune')) wlock = lock = None - wlock = repo.wlock() - sortedrevs = lambda specs: sorted(set(scmutil.revrange(repo, specs))) try: + wlock = repo.wlock() + sortedrevs = lambda specs: sorted(set(scmutil.revrange(repo, specs))) lock = repo.lock() # defines pruned changesets precs = [] @@ -1796,7 +1827,7 @@ ('', 'close-branch', None, _('mark a branch as closed, hiding it from the branch list')), ('s', 'secret', None, _('use the secret phase for committing')), - ] + walkopts + commitopts + commitopts2, + ] + walkopts + commitopts + commitopts2 + commitopts3, _('[OPTION]... [FILE]...')) def amend(ui, repo, *pats, **opts): """combine a changeset with updates and replace it with a new one @@ -1821,6 +1852,7 @@ opts['amend'] = True if not (edit or opts['message']): opts['message'] = repo['.'].description() + _resolveoptions(ui, opts) _alias, commitcmd = cmdutil.findcmd('commit', commands.table) return commitcmd[0](ui, repo, *pats, **opts) @@ -1923,43 +1955,46 @@ Return 0 if changed files are uncommitted. """ - lock = repo.lock() + + wlock = lock = tr = None try: wlock = repo.wlock() - try: - wctx = repo[None] - if len(wctx.parents()) <= 0: - raise util.Abort(_("cannot uncommit null changeset")) - if len(wctx.parents()) > 1: - raise util.Abort(_("cannot uncommit while merging")) - old = repo['.'] - if old.phase() == phases.public: - raise util.Abort(_("cannot rewrite immutable changeset")) - if len(old.parents()) > 1: - raise util.Abort(_("cannot uncommit merge changeset")) - oldphase = old.phase() - updatebookmarks = _bookmarksupdater(repo, old.node()) - # Recommit the filtered changeset - newid = None - if (pats or opts.get('include') or opts.get('exclude') - or opts.get('all')): - match = scmutil.match(old, pats, opts) - newid = _commitfiltered(repo, old, match) - if newid is None: - raise util.Abort(_('nothing to uncommit')) - # Move local changes on filtered changeset - createmarkers(repo, [(old, (repo[newid],))]) - phases.retractboundary(repo, oldphase, [newid]) - repo.dirstate.setparents(newid, node.nullid) - _uncommitdirstate(repo, old, match) - updatebookmarks(newid) - if not repo[newid].files(): - ui.warn(_("new changeset is empty\n")) - ui.status(_('(use "hg prune ." to remove it)\n')) - finally: - wlock.release() + lock = repo.lock() + wctx = repo[None] + if len(wctx.parents()) <= 0: + raise util.Abort(_("cannot uncommit null changeset")) + if len(wctx.parents()) > 1: + raise util.Abort(_("cannot uncommit while merging")) + old = repo['.'] + if old.phase() == phases.public: + raise util.Abort(_("cannot rewrite immutable changeset")) + if len(old.parents()) > 1: + raise util.Abort(_("cannot uncommit merge changeset")) + oldphase = old.phase() + updatebookmarks = _bookmarksupdater(repo, old.node()) + + # Recommit the filtered changeset + tr = repo.transaction('uncommit') + newid = None + if (pats or opts.get('include') or opts.get('exclude') + or opts.get('all')): + match = scmutil.match(old, pats, opts) + newid = _commitfiltered(repo, old, match) + if newid is None: + raise util.Abort(_('nothing to uncommit'), + hint=_("use --all to uncommit all files")) + # Move local changes on filtered changeset + createmarkers(repo, [(old, (repo[newid],))]) + retractboundary(repo, tr, oldphase, [newid]) + repo.dirstate.setparents(newid, node.nullid) + _uncommitdirstate(repo, old, match) + updatebookmarks(newid) + if not repo[newid].files(): + ui.warn(_("new changeset is empty\n")) + ui.status(_('(use "hg prune ." to remove it)\n')) + tr.close() finally: - lock.release() + lockmod.release(tr, lock, wlock) @eh.wrapcommand('commit') def commitwrapper(orig, ui, repo, *arg, **kwargs): @@ -2029,14 +2064,14 @@ p2 = ctx.p2().node() p1 = newmapping.get(p1, p1) p2 = newmapping.get(p2, p2) - new, _ = rewrite(repo, ctx, [], ctx, - [p1, p2], - commitopts={'extra': extra}) + new, unusedvariable = rewrite(repo, ctx, [], ctx, + [p1, p2], + commitopts={'extra': extra}) # store touched version to help potential children newmapping[ctx.node()] = new if not duplicate: createmarkers(repo, [(ctx, (repo[new],))]) - phases.retractboundary(repo, ctx.phase(), [new]) + retractboundary(repo, tr, ctx.phase(), [new]) if ctx in repo[None].parents(): repo.dirstate.setparents(new, node.nullid) tr.close() @@ -2046,41 +2081,76 @@ lockmod.release(lock, wlock) @command('^fold|squash', - [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), + [('r', 'rev', [], _("revision to fold")), + ('', 'exact', None, _("only fold specified revisions")) ] + commitopts + commitopts2, - # allow to choose the seed ? - _('rev')) + _('hg fold [OPTION]... [-r] REV')) def fold(ui, repo, *revs, **opts): - """Fold multiple revisions into a single one - - The revisions from your current working directory to the given one are folded - into a single successor revision. - - you can alternatively use --rev to explicitly specify revisions to be folded, - ignoring the current working directory parent. + """fold multiple revisions into a single one + + Folds a set of revisions with the parent of the working directory. + All revisions linearly between the given revisions and the parent + of the working directory will also be folded. + + Use --exact for folding only the specified revisions while ignoring the + parent of the working directory. In this case, the given revisions must + form a linear unbroken chain. + + .. container:: verbose + + Some examples: + + - Fold the current revision with its parent:: + + hg fold .^ + + - Fold all draft revisions with working directory parent:: + + hg fold 'draft()' + + See :hg:`help phases` for more about draft revisions and + :hg:`help revsets` for more about the `draft()` keyword + + - Fold revisions 3, 4, 5, and 6 with the working directory parent:: + + hg fold 3:6 + + - Only fold revisions linearly between foo and @:: + + hg fold foo::@ --exact """ revs = list(revs) - if revs: - if opts.get('rev', ()): - raise util.Abort("cannot specify both --rev and a target revision") - targets = scmutil.revrange(repo, revs) - revs = repo.revs('(%ld::.) or (.::%ld)', targets, targets) - elif 'rev' in opts: - revs = scmutil.revrange(repo, opts['rev']) - else: - revs = () + revs.extend(opts['rev']) if not revs: - ui.write_err('no revision to fold\n') + raise util.Abort(_('no revisions specified')) + + revs = scmutil.revrange(repo, revs) + + if not opts['exact']: + # Try to extend given revision starting from the working directory + extrevs = repo.revs('(%ld::.) or (.::%ld)', revs, revs) + discardedrevs = [r for r in revs if r not in extrevs] + if discardedrevs: + raise util.Abort(_("cannot fold non-linear revisions"), + hint=_("given revisions are unrelated to parent " + "of working directory")) + revs = extrevs + + if len(revs) == 1: + ui.write_err(_('single revision specified, nothing to fold\n')) return 1 + roots = repo.revs('roots(%ld)', revs) if len(roots) > 1: - raise util.Abort("set has multiple roots") + raise util.Abort(_("cannot fold non-linear revisions " + "(multiple roots given)")) root = repo[roots[0]] if root.phase() <= phases.public: - raise util.Abort("can't fold public revisions") + raise util.Abort(_("cannot fold public revisions")) heads = repo.revs('heads(%ld)', revs) if len(heads) > 1: - raise util.Abort("set has multiple heads") + raise util.Abort(_("cannot fold non-linear revisions " + "(multiple heads given)")) head = repo[heads[0]] wlock = lock = None try: @@ -2101,10 +2171,10 @@ commitopts['message'] = "\n".join(msgs) commitopts['edit'] = True - newid, _ = rewrite(repo, root, allctx, head, - [root.p1().node(), root.p2().node()], - commitopts=commitopts) - phases.retractboundary(repo, targetphase, [newid]) + newid, unusedvariable = rewrite(repo, root, allctx, head, + [root.p1().node(), root.p2().node()], + commitopts=commitopts) + retractboundary(repo, tr, targetphase, [newid]) createmarkers(repo, [(ctx, (repo[newid],)) for ctx in allctx]) tr.close() @@ -2156,17 +2226,32 @@ entry = cmdutil.findcmd('commit', commands.table)[1] entry[1].append(('o', 'obsolete', [], - _("make commit obsolete this revision"))) + _("make commit obsolete this revision (DEPRECATED)"))) entry = cmdutil.findcmd('graft', commands.table)[1] entry[1].append(('o', 'obsolete', [], - _("make graft obsoletes this revision"))) + _("make graft obsoletes this revision (DEPRECATED)"))) entry[1].append(('O', 'old-obsolete', False, - _("make graft obsoletes its source"))) + _("make graft obsoletes its source (DEPRECATED)"))) ##################################################################### ### Obsolescence marker exchange experimenation ### ##################################################################### +def obsexcmsg(ui, message, important=False): + verbose = ui.configbool('experimental', 'verbose-obsolescence-exchange', + False) + if verbose: + message = 'OBSEXC: ' + message + if important or verbose: + ui.status(message) + +def obsexcprg(ui, *args, **kwargs): + topic = 'obsmarkers exchange' + if ui.configbool('experimental', 'verbose-obsolescence-exchange', False): + topic = 'OBSEXC' + ui.progress(topic, *args, **kwargs) + + @command('debugobsoleterelevant', [], 'REVSET') @@ -2244,8 +2329,7 @@ return len(self.getvalue()) def read(self, size): - self.ui.progress('OBSEXC', self.tell(), unit="bytes", - total=self.length) + obsexcprg(self.ui, self.tell(), unit="bytes", total=self.length) return StringIO.read(self, size) def __iter__(self): @@ -2254,11 +2338,145 @@ yield d d = self.read(4096) - +bundle2partsgenerators = getattr(exchange, 'bundle2partsgenerators', None) + + +if bundle2partsgenerators is not None: + + def _pushb2phases(pushop, bundler): + """adds phases update to the main bundle2 push""" + outgoing = pushop.outgoing + unfi = pushop.repo.unfiltered() + remotephases = pushop.remote.listkeys('phases') + publishing = remotephases.get('publishing', False) + ana = phases.analyzeremotephases(pushop.repo, + outgoing.commonheads, + remotephases) + pheads, droots = ana + revset = 'heads((%ln::%ln))' + if not publishing: + revset += ' and public()' + # Get the list of all revs draft on remote by public here. + # XXX Beware that revset break if droots is not strictly + # XXX root we may want to ensure it is but it is costly + fallback = list(unfi.set(revset, droots, outgoing.commonheads)) + if not outgoing.missing: + future = fallback + else: + # adds changeset we are going to push as draft + # + # should not be necessary for pushblishing server, but because of + # an issue fixed in xxxxx we have to do it anyway. + fdroots = list(unfi.set('roots(%ln + %ln::)', outgoing.missing, droots)) + fdroots = [f.node() for f in fdroots] + future = list(unfi.set(revset, fdroots, outgoing.missingheads)) + + b2caps = bundle2.bundle2caps(pushop.remote) + if 'b2x:pushkey' not in b2caps: + return + pushop.stepsdone.add('phases') + part2node = [] + enc = pushkey.encode + for newremotehead in future: + part = bundler.newpart('b2x:pushkey') + part.addparam('namespace', enc('phases')) + part.addparam('key', enc(newremotehead.hex())) + part.addparam('old', enc(str(phases.draft))) + part.addparam('new', enc(str(phases.public))) + part2node.append((part.id, newremotehead)) + def handlereply(op): + for partid, pnode in part2node: + partrep = op.records.getreplies(partid) + results = partrep['pushkey'] + assert len(results) <= 1 + msg = None + if not results: + msg = _('server ignored update of %s to public!\n') % pnode + elif not int(results[0]['return']): + msg = _('updating %s to public failed!\n') % pnode + if msg is not None: + pushop.ui.warn(msg) + return handlereply + + def _pushb2obsmarker(pushop, bundler): + """adds obsmarker to the main bundle2 push""" + repo = pushop.repo + remote = pushop.remote + if ('obsmarkers' not in pushop.stepsdone + and (obsolete._enabled and repo.obsstore and + 'obsolete' in remote.listkeys('namespaces')) + and remote.capable('_evoext_b2x_obsmarkers_0')): + # + pushop.stepsdone.add('obsmarkers') + markers = _obsmarkersdiscovery(pushop) + if not markers: + obsexcmsg(repo.ui, "no marker to push\n") + obsexcmsg(repo.ui, "DONE\n") + return + obsdata = pushobsmarkerStringIO() + _encodemarkersstream(obsdata, markers) + obsdata.seek(0) + obsdata.ui = repo.ui + obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n" + % (len(markers), len(obsdata.getvalue())), + True) + bundler.newpart('EVOLVE:B2X:OBSMARKERV1', data=obsdata) + def callback(op): + obsexcprg(repo.ui, None) + obsexcmsg(repo.ui, "DONE\n") + return callback + bundle2partsgenerators.append(_pushb2phases) + bundle2partsgenerators.append(_pushb2obsmarker) + + +def _obsmarkersdiscovery(pushop): + """return the list of marker that needs to be pushed to the server + + When used before (or at the same time) the changegroup have been pushed, it + returns the value as if the planned changegroup was succesful. Othewise it + use te actual common heads to decide whats needs to be pushed. + """ + repo = pushop.repo + remote = pushop.remote + unfi = repo.unfiltered() + cl = unfi.changelog + commonheads = pushop.commonheads + if commonheads is None: + if pushop.revs is None: + commonheads = pushop.outgoing.commonheads + sch = set(commonheads) + commonheads.extend(h for h in pushop.outgoing.missingheads + if h not in sch) + else: + commonheads = pushop.outgoing.missingheads + if (obsolete._enabled and repo.obsstore and + 'obsolete' in remote.listkeys('namespaces')): + obsexcmsg(repo.ui, "computing relevant nodes\n") + revs = unfi.revs('::%ln', commonheads) + common = [] + if remote.capable('_evoext_obshash_0'): + obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" + % len(revs)) + common = findcommonobsmarkers(pushop.ui, unfi, remote, revs) + revs = list(unfi.revs('%ld - (::%ln)', revs, common)) + nodes = [cl.node(r) for r in revs] + if nodes: + obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n" + % len(nodes)) + markers = repo.obsstore.relevantmarkers(nodes) + else: + obsexcmsg(repo.ui, "markers already in sync\n") + markers = [] + return markers @eh.wrapfunction(exchange, '_pushobsolete') def _pushobsolete(orig, pushop): """utility function to push obsolete markers to a remote""" + stepsdone = getattr(pushop, 'stepsdone', None) + if stepsdone is not None: + if 'obsmarkers' in stepsdone: + return + stepsdone.add('obsmarkers') pushop.ui.debug('try to push obsolete markers to remote\n') repo = pushop.repo remote = pushop.remote @@ -2266,31 +2484,17 @@ cl = unfi.changelog if (obsolete._enabled and repo.obsstore and 'obsolete' in remote.listkeys('namespaces')): - repo.ui.status("OBSEXC: computing relevant nodes\n") - revs = unfi.revs('::%ln', pushop.commonheads) - common = [] - if remote.capable('_evoext_obshash_0'): - repo.ui.status("OBSEXC: looking for common markers in %i nodes\n" - % len(revs)) - common = findcommonobsmarkers(pushop.ui, repo, remote, revs) - revs = list(unfi.revs('%ld - (::%ln)', revs, common)) - nodes = [cl.node(r) for r in revs] - if nodes: - repo.ui.status("OBSEXC: computing markers relevant to %i nodes\n" - % len(nodes)) - markers = repo.obsstore.relevantmarkers(nodes) - else: - repo.ui.status("OBSEXC: markers already in sync\n") - markers = [] + markers = _obsmarkersdiscovery(pushop) if not markers: - repo.ui.status("OBSEXC: no marker to push\n") + obsexcmsg(repo.ui, "no marker to push\n") elif remote.capable('_evoext_b2x_obsmarkers_0'): obsdata = pushobsmarkerStringIO() _encodemarkersstream(obsdata, markers) obsdata.seek(0) obsdata.ui = repo.ui - repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n" - % (len(markers), len(obsdata.getvalue()))) + obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n" + % (len(markers), len(obsdata.getvalue())), + True) bundler = bundle2.bundle20(pushop.ui, {}) capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob)) @@ -2305,35 +2509,37 @@ op = bundle2.processbundle(pushop.repo, reply) except bundle2.UnknownPartError, exc: raise util.Abort('missing support for %s' % exc) - repo.ui.progress('OBSEXC', None) + obsexcprg(repo.ui, None) elif remote.capable('_evoext_pushobsmarkers_0'): obsdata = pushobsmarkerStringIO() _encodemarkersstream(obsdata, markers) obsdata.seek(0) obsdata.ui = repo.ui - repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n" - % (len(markers), len(obsdata.getvalue()))) + obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n" + % (len(markers), len(obsdata.getvalue())), + True) remote.evoext_pushobsmarkers_0(obsdata) - repo.ui.progress('OBSEXC', None) + obsexcprg(repo.ui, None) else: rslts = [] remotedata = _pushkeyescape(markers).items() totalbytes = sum(len(d) for k,d in remotedata) sentbytes = 0 - repo.ui.status("OBSEXC: pushing %i markers in %i pushkey payload (%i bytes)\n" - % (len(markers), len(remotedata), totalbytes)) + obsexcmsg(repo.ui, "pushing %i obsolescence markers in %i pushkey payload (%i bytes)\n" + % (len(markers), len(remotedata), totalbytes), + True) for key, data in remotedata: - repo.ui.progress('OBSEXC', sentbytes, item=key, unit="bytes", - total=totalbytes) + obsexcprg(repo.ui, sentbytes, item=key, unit="bytes", + total=totalbytes) rslts.append(remote.pushkey('obsolete', key, '', data)) sentbytes += len(data) - repo.ui.progress('OBSEXC', sentbytes, item=key, unit="bytes", - total=totalbytes) - repo.ui.progress('OBSEXC', None) + obsexcprg(repo.ui, sentbytes, item=key, unit="bytes", + total=totalbytes) + obsexcprg(repo.ui, None) if [r for r in rslts if not r]: msg = _('failed to push some obsolete markers!\n') repo.ui.warn(msg) - repo.ui.status("OBSEXC: DONE\n") + obsexcmsg(repo.ui, "DONE\n") @eh.addattr(wireproto.wirepeer, 'evoext_pushobsmarkers_0') @@ -2391,13 +2597,13 @@ length = int(length) data = StringIO() current = 0 - op.ui.progress('OBSEXC', current, unit="bytes", total=length) + obsexcprg(op.repo.ui, current, unit="bytes", total=length) while current < length: readsize = min(length-current, 4096) data.write(inpart.read(readsize)) current += readsize - op.ui.progress('OBSEXC', current, unit="bytes", total=length) - op.ui.progress('OBSEXC', None) + obsexcprg(op.repo.ui, current, unit="bytes", total=length) + obsexcprg(op.repo.ui, None) obsdata = data.getvalue() totalsize = len(obsdata) old = len(op.repo.obsstore._all) @@ -2418,8 +2624,8 @@ revs = unfi.revs('::%ln', pullop.pulledsubset) common = [nullid] if remote.capable('_evoext_obshash_0'): - repo.ui.status("OBSEXC: looking for common markers in %i nodes\n" - % len(revs)) + obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" + % len(revs)) common = findcommonobsmarkers(repo.ui, repo, remote, revs) return {'heads': pullop.pulledsubset, 'common': common} @@ -2464,8 +2670,12 @@ return None # remote opted out of obsolescence marker exchange tr = None ui = pullop.repo.ui - ui.status("OBSEXC: pull obsolescence markers\n") boundaries = _buildpullobsmerkersboundaries(pullop) + if not set(boundaries['heads']) - set(boundaries['common']): + obsexcmsg(ui, "nothing to pull\n") + return None + + obsexcmsg(ui, "pull obsolescence markers\n", True) new = 0 if b2xpull: @@ -2487,27 +2697,27 @@ bytes += entry.get('bytes', 0) new += entry.get('new', 0) if 5 < bytes: - ui.status("OBSEXC: merging obsolescence markers (%i bytes)\n" + obsexcmsg(ui, "merging obsolescence markers (%i bytes)\n" % bytes) - ui.status("OBSEXC: %i markers added\n" % new) + obsexcmsg(ui, "%i obsolescence markers added\n" % new, True) tr = op.gettransaction() else: - ui.status("OBSEXC: no unknown remote markers\n") - ui.status("OBSEXC: DONE\n") + obsexcmsg(ui, "no unknown remote markers\n") + obsexcmsg(ui, "DONE\n") elif wirepull: obsdata = pullop.remote.evoext_pullobsmarkers_0(**boundaries) obsdata = obsdata.read() if len(obsdata) > 5: - ui.status("OBSEXC: merging obsolescence markers (%i bytes)\n" + obsexcmsg(ui, "merging obsolescence markers (%i bytes)\n" % len(obsdata)) tr = pullop.gettransaction() old = len(pullop.repo.obsstore._all) pullop.repo.obsstore.mergemarkers(tr, obsdata) new = len(pullop.repo.obsstore._all) - old - ui.status("OBSEXC: %i markers added\n" % new) + obsexcmsg(ui, "%i obsolescence markers added\n" % new, True) else: - ui.status("OBSEXC: no unknown remote markers\n") - ui.status("OBSEXC: DONE\n") + obsexcmsg(ui, "no unknown remote markers\n") + obsexcmsg(ui, "DONE\n") if new: pullop.repo.invalidatevolatilesets() return tr @@ -2551,13 +2761,13 @@ current = 0 data = StringIO() ui = self.ui - ui.progress('OBSEXC', current, unit="bytes", total=length) + obsexcprg(ui, current, unit="bytes", total=length) while current < length: readsize = min(length-current, chunk) data.write(f.read(readsize)) current += readsize - ui.progress('OBSEXC', current, unit="bytes", total=length) - ui.progress('OBSEXC', None) + obsexcprg(ui, current, unit="bytes", total=length) + obsexcprg(ui, None) data.seek(0) return data diff -r acc2b590edd9 -r a585353a816b tests/_exc-util.sh --- a/tests/_exc-util.sh Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/_exc-util.sh Fri Aug 08 23:14:00 2014 -0700 @@ -8,6 +8,8 @@ logtemplate ="{node|short} ({phase}): {desc}\n" [phases] publish=False +[experimental] +verbose-obsolescence-exchange=true [extensions] hgext.strip= hgext.rebase= diff -r acc2b590edd9 -r a585353a816b tests/test-amend.t --- a/tests/test-amend.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-amend.t Fri Aug 08 23:14:00 2014 -0700 @@ -1,6 +1,4 @@ $ cat >> $HGRCPATH < [defaults] - > amend=-d "0 0" > [extensions] > hgext.rebase= > hgext.graphlog= @@ -17,12 +15,12 @@ $ hg ci -Am adda adding a -Test amend captures branches +Test that amend captures branches $ hg branch foo marked working directory as branch foo (branches are permanent and global, did you want a bookmark?) - $ hg amend + $ hg amend -d '0 0' $ hg debugobsolete 07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 {'date': '* *', 'user': 'test'} (glob) b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {'date': '* *', 'user': 'test'} (glob) @@ -35,7 +33,7 @@ Test no-op - $ hg amend + $ hg amend -d '0 0' nothing changed [1] $ glog @@ -44,7 +42,7 @@ Test forcing the message to the same value, no intermediate revision. - $ hg amend -m 'adda' + $ hg amend -d '0 0' -m 'adda' nothing changed [1] $ glog @@ -80,4 +78,22 @@ | o 2@foo(draft) adda +Specify precise commit date with -d + $ hg amend -d '2001-02-03 04:05:06 +0700' + $ hg parents --template '{rev} {date|date}\n' + 5 Sat Feb 03 04:05:06 2001 +0700 +Specify "now" as commit date with -D + $ before=`date +%s` + $ hg amend -D + $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'` + $ after=`date +%s` + $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s + \d+ (re) + \d+ 0 rev6 (re) + \d+ (re) + +Specify current user as committer with -U + $ HGUSER=newbie hg amend -U + $ hg parents --template '{rev} {author}\n' + 7 newbie diff -r acc2b590edd9 -r a585353a816b tests/test-corrupt.t --- a/tests/test-corrupt.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-corrupt.t Fri Aug 08 23:14:00 2014 -0700 @@ -111,10 +111,7 @@ adding manifests adding file changes added 1 changesets with 2 changes to 2 files - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 4 nodes - OBSEXC: pushing 2 markers (147 bytes) - OBSEXC: DONE + pushing 2 obsolescence markers (147 bytes) $ hg -R ../other verify checking changesets checking manifests diff -r acc2b590edd9 -r a585353a816b tests/test-evolve.t --- a/tests/test-evolve.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-evolve.t Fri Aug 08 23:14:00 2014 -0700 @@ -341,6 +341,27 @@ $ hg commit --amend -m 'dansk!' 2 new unstable changesets +(ninja test for the {trouble} template: + + $ hg log -G --template '{rev} {troubles}\n' + @ 13 + | + | o 11 unstable + | | + | o 10 unstable + | | + | x 9 + |/ + o 7 + | + o 6 + | + o 0 + + + +(/ninja) + $ hg evolve --all --traceback move:[10] dansk 2! atop:[13] dansk! @@ -385,9 +406,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - OBSEXC: pull obsolescence markers - OBSEXC: no unknown remote markers - OBSEXC: DONE + pull obsolescence markers $ cd alpha $ cat << EOF > A @@ -444,10 +463,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (171 bytes) - OBSEXC: 2 markers added - OBSEXC: DONE + pull obsolescence markers + 2 obsolescence markers added (run 'hg update' to get a working copy) $ hg up 2 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -593,26 +610,35 @@ $ rm *.orig $ hg fold - no revision to fold + abort: no revisions specified + [255] + $ hg fold . + single revision specified, nothing to fold [1] - $ hg fold 6 --rev 10 - abort: cannot specify both --rev and a target revision + $ hg fold 0::10 --rev 1 --exact + abort: cannot fold non-linear revisions (multiple heads given) + [255] + $ hg fold -r 4 -r 6 --exact + abort: cannot fold non-linear revisions (multiple roots given) [255] - $ hg fold 6 # want to run hg fold 6 - 2 changesets folded + $ hg fold 10 1 + abort: cannot fold non-linear revisions + (given revisions are unrelated to parent of working directory) + [255] + $ hg phase --public 0 + $ hg fold -r 0 + abort: cannot fold public revisions + [255] + $ hg fold -r 5 + 3 changesets folded 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ glog - @ 11:dd4682c1a481@default(draft) add 1 - | - o 5:0b9e50c35132@default(draft) add 3 - | - o 4:ce341209337f@default(draft) add 4 - | - | o 1:73d38bb17fd7@default(draft) add 1 - |/ - o 0:8685c6d34325@default(draft) add 0 + $ hg fold 6 # want to run hg fold 6 + abort: unknown revision '6'! + [255] + $ hg log -r 11 --template '{desc}\n' + add 3 - $ hg log -r 11 --template '{desc}\n' + add 1 @@ -624,15 +650,15 @@ $ hg up 4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg fold --rev 4::11 --user victor - 3 changesets folded + $ hg fold --rev 4::11 --user victor --exact + 2 changesets folded 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ glog @ 12:d26d339c513f@default(draft) add 4 | | o 1:73d38bb17fd7@default(draft) add 1 |/ - o 0:8685c6d34325@default(draft) add 0 + o 0:8685c6d34325@default(public) add 0 $ hg log --template '{rev}: {author}\n' 12: victor @@ -656,8 +682,7 @@ $ hg olog 4 : add 4 - test - 5 : add 3 - test - 11 : add 1 - test + 11 : add 3 - test Test obsstore stat diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A1.t --- a/tests/test-exchange-A1.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A1.t Fri Aug 08 23:14:00 2014 -0700 @@ -54,8 +54,8 @@ $ cp -r A.1.1 A.1.1.b -Variante a: push -r A ---------------------- +Variant a: push -r A +-------------------- $ dotest A.1.1.a A ## Running testcase A.1.1.a @@ -74,7 +74,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -91,7 +91,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -105,8 +105,8 @@ -Variante b: push ---------------------- +Variant b: push +--------------- $ dotest A.1.1.b ## Running testcase A.1.1.b @@ -124,7 +124,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -141,7 +141,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -213,8 +213,8 @@ $ cp -r A.1.2 A.1.2.b -Variante a: push -r A ---------------------- +Variant a: push -r A +-------------------- $ dotest A.1.2.a B ## Running testcase A.1.2.a @@ -233,7 +233,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -250,7 +250,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -261,8 +261,8 @@ # obstore: pulldest aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'} -Variante b: push ---------------------- +Variant b: push +--------------- $ dotest A.1.2.b ## Running testcase A.1.2.b @@ -280,7 +280,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -297,7 +297,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A2.t --- a/tests/test-exchange-A2.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A2.t Fri Aug 08 23:14:00 2014 -0700 @@ -82,7 +82,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -100,7 +100,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A3.t --- a/tests/test-exchange-A3.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A3.t Fri Aug 08 23:14:00 2014 -0700 @@ -73,8 +73,8 @@ $ cd .. $ cd .. -Actual Test for first version (changeset unknown remotly) ---------------------------------------------------------- +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- $ dotest A.3.a A1 ## Running testcase A.3.a @@ -94,7 +94,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -112,7 +112,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -125,8 +125,8 @@ 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {'date': '', 'user': 'test'} -other variant: changeset know remotly -------------------------------------------- +other variant: changeset known in remote +---------------------------------------- $ setuprepos A.3.b creating test repo for test case A.3.b @@ -164,8 +164,8 @@ $ cd .. $ cd .. -Actual Test for first version (changeset unknown remotly) ---------------------------------------------------------- +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- check it complains about multiple heads @@ -198,7 +198,7 @@ added 1 changesets with 1 changes to 1 files (+1 heads) OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -216,7 +216,7 @@ added 1 changesets with 1 changes to 2 files (+1 heads) OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg heads' to see heads, 'hg merge' to merge) 1 new unstable changesets diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A4.t --- a/tests/test-exchange-A4.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A4.t Fri Aug 08 23:14:00 2014 -0700 @@ -66,8 +66,8 @@ $ cd .. $ cd .. -Actual Test for first version (changeset unknown remotly) ---------------------------------------------------------- +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- $ dotest A.4 B -f ## Running testcase A.4 @@ -87,7 +87,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -105,7 +105,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A5.t --- a/tests/test-exchange-A5.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A5.t Fri Aug 08 23:14:00 2014 -0700 @@ -94,7 +94,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -113,7 +113,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-A6.t --- a/tests/test-exchange-A6.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-A6.t Fri Aug 08 23:14:00 2014 -0700 @@ -42,7 +42,7 @@ $ mkcommit A1 created new head -make both changeset known remotly +make both changeset known in remote $ hg push -qf ../pushdest $ hg push -qf ../pulldest @@ -82,7 +82,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -95,7 +95,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main @@ -106,7 +106,7 @@ 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {'date': '', 'user': 'test'} Actual Test (bare push version) ------------------------------------ +------------------------------- $ dotest A.6.b ## Running testcase A.6.b @@ -121,7 +121,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 1 markers (62 bytes) + OBSEXC: pushing 1 obsolescence markers (62 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -135,7 +135,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (62 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B1.t --- a/tests/test-exchange-B1.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B1.t Fri Aug 08 23:14:00 2014 -0700 @@ -3,7 +3,7 @@ $ . $TESTDIR/_exc-util.sh -=== B.1 Prune on non targeted common changeset === +=== B.1 Prune on non-targeted common changeset === .. {{{ .. ⊗ B @@ -53,7 +53,7 @@ $ cp -r B.1 B.1.a $ cp -r B.1 B.1.b -Actual Test (explicite push version) +Actual Test (explicit push version) ----------------------------------- $ dotest B.1.a A @@ -73,7 +73,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -90,7 +90,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -120,7 +120,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -137,7 +137,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B2.t --- a/tests/test-exchange-B2.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B2.t Fri Aug 08 23:14:00 2014 -0700 @@ -3,7 +3,7 @@ $ . $TESTDIR/_exc-util.sh -=== B.2 Pruned changeset on head. nothing pushed === +=== B.2 Pruned changeset on head: nothing pushed === .. {{{ .. ⊗ A @@ -48,7 +48,7 @@ $ cp -r B.2 B.2.a $ cp -r B.2 B.2.b -Actual Test (explicite push version) +Actual Test (explicit push version) ----------------------------------- $ dotest B.2.a O @@ -65,7 +65,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -78,7 +78,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main @@ -104,7 +104,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -118,7 +118,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B4.t --- a/tests/test-exchange-B4.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B4.t Fri Aug 08 23:14:00 2014 -0700 @@ -74,7 +74,7 @@ $ cp -r B.4 B.4.a $ cp -r B.4 B.4.b -Actual Test (explicite push version) +Actual Test (explicit push version) ----------------------------------- $ dotest B.4.a O @@ -91,7 +91,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -104,7 +104,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main @@ -130,7 +130,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 1 markers (89 bytes) + OBSEXC: pushing 1 obsolescence markers (89 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -144,7 +144,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (89 bytes) - OBSEXC: 1 markers added + OBSEXC: 1 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B5.t --- a/tests/test-exchange-B5.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B5.t Fri Aug 08 23:14:00 2014 -0700 @@ -72,8 +72,8 @@ $ cp -r B.5 B.5.a $ cp -r B.5 B.5.b -Actual Test (explicite push version) -------------------------------------- +Actual Test (explicit push version) +----------------------------------- $ dotest B.5.a B -f ## Running testcase B.5.a @@ -93,7 +93,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -112,7 +112,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) 1 new unstable changesets @@ -148,7 +148,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 3 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -167,7 +167,7 @@ added 2 changesets with 2 changes to 2 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) 1 new unstable changesets diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B6.t --- a/tests/test-exchange-B6.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B6.t Fri Aug 08 23:14:00 2014 -0700 @@ -77,7 +77,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -92,7 +92,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-B7.t --- a/tests/test-exchange-B7.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-B7.t Fri Aug 08 23:14:00 2014 -0700 @@ -4,7 +4,7 @@ $ . $TESTDIR/_exc-util.sh -=== B.7 Prune on non targeted common changeset === +=== B.7 Prune on non-targeted common changeset === .. .. {{{ .. ⊗ B diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-C1.t --- a/tests/test-exchange-C1.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-C1.t Fri Aug 08 23:14:00 2014 -0700 @@ -54,8 +54,8 @@ $ cp -r C.1 C.1.a $ cp -r C.1 C.1.b -Actual Test (explicite push) -------------------------------------- +Actual Test (explicit push) +--------------------------- $ dotest C.1.a O ## Running testcase C.1.a @@ -72,7 +72,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (177 bytes) + OBSEXC: pushing 2 obsolescence markers (177 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -87,7 +87,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (177 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main @@ -117,7 +117,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (177 bytes) + OBSEXC: pushing 2 obsolescence markers (177 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -133,7 +133,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (177 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-C2.t --- a/tests/test-exchange-C2.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-C2.t Fri Aug 08 23:14:00 2014 -0700 @@ -61,8 +61,8 @@ $ cp -r C.2 C.2.a $ cp -r C.2 C.2.b -Actual Test (explicite push) -------------------------------------- +Actual Test (explicit push) +--------------------------- $ dotest C.2.a A1 ## Running testcase C.2.a @@ -82,7 +82,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -101,7 +101,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state @@ -135,7 +135,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -154,7 +154,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-C3.t --- a/tests/test-exchange-C3.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-C3.t Fri Aug 08 23:14:00 2014 -0700 @@ -66,8 +66,8 @@ $ cp -r C.3 C.3.a $ cp -r C.3 C.3.b -Actual Test (explicite push) -------------------------------------- +Actual Test (explicit push) +--------------------------- $ dotest C.3.a O ## Running testcase C.3.a @@ -85,7 +85,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 3 markers (238 bytes) + OBSEXC: pushing 3 obsolescence markers (238 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -102,7 +102,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (238 bytes) - OBSEXC: 3 markers added + OBSEXC: 3 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main @@ -136,7 +136,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 3 markers (238 bytes) + OBSEXC: pushing 3 obsolescence markers (238 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -154,7 +154,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (238 bytes) - OBSEXC: 3 markers added + OBSEXC: 3 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-C4.t --- a/tests/test-exchange-C4.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-C4.t Fri Aug 08 23:14:00 2014 -0700 @@ -92,7 +92,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -108,7 +108,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-D1.t --- a/tests/test-exchange-D1.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-D1.t Fri Aug 08 23:14:00 2014 -0700 @@ -3,7 +3,7 @@ $ . $TESTDIR/_exc-util.sh -=== D.1 Pruned changeset based on a missing precursors of something we miss === +=== D.1 Pruned changeset based on missing precursor of something not present === .. {{{ .. B ⊗ @@ -76,7 +76,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -95,7 +95,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-D2.t --- a/tests/test-exchange-D2.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-D2.t Fri Aug 08 23:14:00 2014 -0700 @@ -69,7 +69,7 @@ no changes found OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (150 bytes) + OBSEXC: pushing 2 obsolescence markers (150 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -85,7 +85,7 @@ no changes found OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (150 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE ## post pull state # obstore: main diff -r acc2b590edd9 -r a585353a816b tests/test-exchange-D4.t --- a/tests/test-exchange-D4.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-exchange-D4.t Fri Aug 08 23:14:00 2014 -0700 @@ -68,8 +68,8 @@ $ cd .. $ cd .. -Actual Test for first version (changeset unknown remotly) ---------------------------------------------------------- +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- $ dotest A.3.a A1 ## Running testcase A.3.a @@ -91,7 +91,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: computing relevant nodes OBSEXC: computing markers relevant to 2 nodes - OBSEXC: pushing 2 markers (123 bytes) + OBSEXC: pushing 2 obsolescence markers (123 bytes) OBSEXC: DONE ## post push state # obstore: main @@ -112,7 +112,7 @@ added 1 changesets with 1 changes to 1 files OBSEXC: pull obsolescence markers OBSEXC: merging obsolescence markers (123 bytes) - OBSEXC: 2 markers added + OBSEXC: 2 obsolescence markers added OBSEXC: DONE (run 'hg update' to get a working copy) ## post pull state diff -r acc2b590edd9 -r a585353a816b tests/test-import.t --- a/tests/test-import.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-import.t Fri Aug 08 23:14:00 2014 -0700 @@ -1,6 +1,6 @@ This feature requires mercurial 3.0 -(and the `only(` revset is 3.0 specific) +(and the `only()` revset is 3.0 specific) $ (hg help revset | grep '"only(' > /dev/null) || exit 80 diff -r acc2b590edd9 -r a585353a816b tests/test-obsolete.t --- a/tests/test-obsolete.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-obsolete.t Fri Aug 08 23:14:00 2014 -0700 @@ -65,7 +65,7 @@ 2 - 4538525df7e2 -Test that obsolete parent a properly computed +Test that obsolete precursors are properly computed $ qlog -r 'precursors(.)' --hidden 2 @@ -85,13 +85,13 @@ @@ -0,0 +1,1 @@ +obsol_c -Test that obsolete successors a properly computed +Test that obsolete successors are properly computed $ qlog -r 'successors(2)' --hidden 3 - 0d3f46688ccc -test obsolete changeset with no-obsolete descendant +test obsolete changeset with non-obsolete descendant $ hg up 1 -q $ mkcommit "obsol_c'" # 4 (on 1) created new head @@ -181,10 +181,7 @@ adding manifests adding file changes added 5 changesets with 5 changes to 5 files (+1 heads) - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 2 markers (123 bytes) - OBSEXC: DONE + pushing 2 obsolescence markers (123 bytes) $ hg -R ../other-new verify checking changesets checking manifests @@ -238,10 +235,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 3 markers (184 bytes) - OBSEXC: DONE + pushing 3 obsolescence markers (184 bytes) $ qlog -R ../other-new 5 - 95de7fc6918d @@ -257,16 +251,13 @@ 2 - 0d3f46688ccc -Pushing again does not advertise extinct changeset +Pushing again does not advertise extinct changesets $ hg push ../other-new pushing to ../other-new searching for changes no changes found - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 3 markers (184 bytes) - OBSEXC: DONE + pushing 3 obsolescence markers (184 bytes) [1] $ hg up --hidden -q .^ # 3 @@ -282,10 +273,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (245 bytes) - OBSEXC: 1 markers added - OBSEXC: DONE + pull obsolescence markers + 1 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) $ qlog -R ../other-new 6 @@ -299,9 +288,9 @@ 0 - 1f0dee641bb7 -pushing to stuff that doesn't support obsolete +pushing to stuff that doesn't support obsolescence -DISABLED. the _enable switch it global :-/ +DISABLED. the _enable switch is global :-/ .. $ hg init ../other-old .. > # XXX I don't like this but changeset get published otherwise @@ -375,10 +364,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (306 bytes) - OBSEXC: 1 markers added - OBSEXC: DONE + pull obsolescence markers + 1 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) $ hg up -q 7 # to check rollback update behavior @@ -464,7 +451,7 @@ 0 - 1f0dee641bb7 -Check that auto update ignore hidden changeset +Check that auto update ignores hidden changeset $ hg up 0 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg up @@ -472,7 +459,7 @@ $ hg id -n 8 -Check that named update do too +Check that named update does too $ hg update default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -495,33 +482,36 @@ o 0 - 1f0dee641bb7 add a - $ hg log -G --template='{rev} - {node|short}\n' --hidden - x 9 - 83b5778897ad + $ hg log -G --template='{rev} - {node|short} {desc}\n' --hidden + x 9 - 83b5778897ad add toto - o 8 - 159dfc9fa5d3 + o 8 - 159dfc9fa5d3 add obsol_d'' | - | x 7 - 909a0fb57e5d + | x 7 - 909a0fb57e5d add obsol_d' |/ - | x 6 - 95de7fc6918d + | x 6 - 95de7fc6918d add obsol_d |/ - | x 5 - a7a6f2b5d8a5 + | x 5 - a7a6f2b5d8a5 add d |/ - | o 4 - 725c380fe99b + | o 4 - 725c380fe99b add obsol_c' | | - x | 3 - 0d3f46688ccc + x | 3 - 0d3f46688ccc add obsol_c |/ - | x 2 - 4538525df7e2 + | x 2 - 4538525df7e2 add c |/ - o 1 - 7c3bad9141dc + o 1 - 7c3bad9141dc add b | - o 0 - 1f0dee641bb7 + o 0 - 1f0dee641bb7 add a -should not rebase extinct changeset +should not rebase extinct changesets #excluded 'whole rebase set is extinct and ignored.' message not in core $ hg rebase -b '3' -d 4 --traceback 2 new divergent changesets + $ hg --hidden log -q -r 'successors(3)' + 4:725c380fe99b + 10:2033b4e49474 $ hg up tip ? files updated, 0 files merged, 0 files removed, 0 files unresolved (glob) $ hg log -G --template='{rev} - {node|short} {desc}\n' @@ -537,7 +527,7 @@ Does not complain about new head if you obsolete the old one -(re necesarry when we start runnind discovery on unfiltered repo in core) +(re necessary when we start running discovery on unfiltered repo in core) $ hg push ../other-new --traceback pushing to ../other-new @@ -546,10 +536,7 @@ adding manifests adding file changes added 2 changesets with 1 changes to [12] files (re) - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 7 markers (452 bytes) - OBSEXC: DONE + pushing 7 obsolescence markers (452 bytes) $ hg up -q 10 $ mkcommit "obsol_d'''" created new head @@ -561,10 +548,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 8 markers (513 bytes) - OBSEXC: DONE + pushing 8 obsolescence markers (513 bytes) $ cd .. check bumped detection diff -r acc2b590edd9 -r a585353a816b tests/test-prune.t --- a/tests/test-prune.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-prune.t Fri Aug 08 23:14:00 2014 -0700 @@ -46,7 +46,7 @@ $ hg debugobsolete 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '314064000 0', ('p1': '47d2a3944de8b013de3be9578e8e344ea2e6c097', )?'user': 'blah'} (re) -prune leaving unstability behind +prune leaving instability behind $ hg prune 1 1 changesets pruned diff -r acc2b590edd9 -r a585353a816b tests/test-sharing.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-sharing.t Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,311 @@ +Test script based on sharing.rst: ensure that all scenarios in that +document work as advertised. + +Setting things up + + $ cat >> $HGRCPATH < [alias] + > shortlog = log --template '{rev}:{node|short} {phase} {desc|firstline}\n' + > [extensions] + > rebase = + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + $ hg init public + $ hg clone -q public test-repo + $ hg clone -q test-repo dev-repo + $ cat >> test-repo/.hg/hgrc < [phases] + > publish = false + > EOF + +To start things off, let's make one public, immutable changeset:: + + $ cd test-repo + $ echo 'my new project' > file1 + $ hg add file1 + $ hg commit -m'create new project' + $ hg push -q + +and pull that into the development repository:: + + $ cd ../dev-repo + $ hg pull -q -u + +Let's commit a preliminary change and push it to ``test-repo`` for +testing. :: + + $ echo 'fix fix fix' > file1 + $ hg commit -m'prelim change' + $ hg push -q ../test-repo + +Figure SG01 (roughly) + $ hg shortlog -G + @ 1:f6490818a721 draft prelim change + | + o 0:0dc9c9f6ab91 public create new project + +Now let's switch to test-repo to test our change and amend:: + $ cd ../test-repo + $ hg update -q + $ echo 'Fix fix fix.' > file1 + $ hg amend -m'fix bug 37' + +Figure SG02 + $ hg shortlog --hidden -G + @ 3:60ffde5765c5 draft fix bug 37 + | + | x 2:2a039763c0f4 draft temporary amend commit for f6490818a721 + | | + | x 1:f6490818a721 draft prelim change + |/ + o 0:0dc9c9f6ab91 public create new project + +Pull into dev-repo: obsolescence markers are transferred, but not +the new obsolete changeset. + $ cd ../dev-repo + $ hg pull -q -u + +Figure SG03 + $ hg shortlog --hidden -G + @ 2:60ffde5765c5 draft fix bug 37 + | + | x 1:f6490818a721 draft prelim change + |/ + o 0:0dc9c9f6ab91 public create new project + +Amend again in dev-repo + $ echo 'Fix, fix, and fix.' > file1 + $ hg amend + $ hg push -q + +Figure SG04 (dev-repo) + $ hg shortlog --hidden -G + @ 4:de6151c48e1c draft fix bug 37 + | + | x 3:ad19d3570adb draft temporary amend commit for 60ffde5765c5 + | | + | x 2:60ffde5765c5 draft fix bug 37 + |/ + | x 1:f6490818a721 draft prelim change + |/ + o 0:0dc9c9f6ab91 public create new project + +Figure SG04 (test-repo) + $ cd ../test-repo + $ hg update -q + $ hg shortlog --hidden -G + @ 4:de6151c48e1c draft fix bug 37 + | + | x 3:60ffde5765c5 draft fix bug 37 + |/ + | x 2:2a039763c0f4 draft temporary amend commit for f6490818a721 + | | + | x 1:f6490818a721 draft prelim change + |/ + o 0:0dc9c9f6ab91 public create new project + +This bug fix is finished. We can push it to the public repository. + $ hg push + pushing to $TESTTMP/public + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + pushing 4 obsolescence markers (341 bytes) + +Figure SG05 + $ hg -R ../public shortlog -G + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + +Oops, still have draft changesets in dev-repo. + $ cd ../dev-repo + $ hg shortlog -r 'draft()' + 4:de6151c48e1c draft fix bug 37 + $ hg pull -q -u + $ hg shortlog -r 'draft()' + +Sharing by Alice and Bob to demonstrate bumped and divergent changesets. +First, setup repos for them. + + $ cd .. + $ hg clone -q public alice + $ hg clone -q public bob + $ cat >> alice/.hg/hgrc < [phases] + > publish = false + > EOF + $ cp alice/.hg/hgrc bob/.hg/hgrc + +Alice commits a bug fix. + $ cd alice + $ echo 'fix' > file2 + $ hg commit -q -A -u alice -m 'fix bug 15' + +Bob pulls and amends Alice's fix. + $ cd ../bob + $ hg pull -q -u ../alice + $ echo 'Fix.' > file2 + $ hg amend -q -A -u bob -m 'fix bug 15 (amended)' + +Figure SG06: Bob's repository after amending Alice's fix. +(Nothing new here; we could have seen this in the user guide. + $ hg --hidden shortlog -G + @ 4:fe884dfac355 draft fix bug 15 (amended) + | + | x 3:0376cac226f8 draft temporary amend commit for e011baf925da + | | + | x 2:e011baf925da draft fix bug 15 + |/ + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + + +But in the meantime, Alice decides the fix is just fine and publishes it. + $ cd ../alice + $ hg push -q + +Which means that Bob now has an formerly obsolete changeset that is +also public (2:6e83). As soon as he pulls its phase change, he's got +trouble: the successors of that formerly obsolete changeset are +bumped. + + $ cd ../bob + $ hg --hidden shortlog -r 'obsolete()' + 2:e011baf925da draft fix bug 15 + 3:0376cac226f8 draft temporary amend commit for e011baf925da + $ hg pull -q -u + 1 new bumped changesets + $ hg --hidden shortlog -r 'obsolete()' + 3:0376cac226f8 draft temporary amend commit for e011baf925da + $ hg shortlog -r 'bumped()' + 4:fe884dfac355 draft fix bug 15 (amended) + +Figure SG07: Bob's repo with one bumped changeset (rev 4:c02d) + $ hg --hidden shortlog -G + @ 4:fe884dfac355 draft fix bug 15 (amended) + | + | x 3:0376cac226f8 draft temporary amend commit for e011baf925da + | | + | o 2:e011baf925da public fix bug 15 + |/ + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + + +Bob gets out of trouble by evolving the repository. + $ hg evolve --all + recreate:[4] fix bug 15 (amended) + atop:[2] fix bug 15 + computing new diff + committed as 227d860d9ad0 + +Figure SG08 + $ hg --hidden shortlog -G + @ 5:227d860d9ad0 draft bumped update to e011baf925da: + | + | x 4:fe884dfac355 draft fix bug 15 (amended) + | | + +---x 3:0376cac226f8 draft temporary amend commit for e011baf925da + | | + o | 2:e011baf925da public fix bug 15 + |/ + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + + +Throw away Bob's messy repo and start over. + $ cd .. + $ rm -rf bob + $ cp -rp alice bob + +Bob commits a pretty good fix that both he and Alice will amend, +leading to divergence. + $ cd bob + $ echo 'pretty good fix' >> file1 + $ hg commit -u bob -m 'fix bug 24 (v1)' + +Alice pulls Bob's fix and improves it. + $ cd ../alice + $ hg pull -q -u ../bob + $ echo 'better (alice)' >> file1 + $ hg amend -u alice -m 'fix bug 24 (v2 by alice)' + +Likewise, Bob amends his own fix. Now we have an obsolete changeset +with two successors, although the successors are in different repos. + $ cd ../bob + $ echo 'better (bob)' >> file1 + $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' + +Bob pulls from Alice's repo and discovers the trouble: divergent changesets! + $ hg pull -q -u ../alice + not updating: not a linear update + (merge or update --check to force update) + 2 new divergent changesets + $ hg shortlog -r 'divergent()' + 5:fc16901f4d7a draft fix bug 24 (v2 by bob) + 6:694fd0f6b503 draft fix bug 24 (v2 by alice) + +Figure SG09 + $ hg --hidden shortlog -G + o 6:694fd0f6b503 draft fix bug 24 (v2 by alice) + | + | @ 5:fc16901f4d7a draft fix bug 24 (v2 by bob) + |/ + | x 4:162612d3335b draft temporary amend commit for fe81d904ed08 + | | + | x 3:fe81d904ed08 draft fix bug 24 (v1) + |/ + o 2:e011baf925da public fix bug 15 + | + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + +Merge the trouble away. + $ hg merge --tool internal:local + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg commit -m merge + $ hg shortlog -G + @ 7:b1d30ba26e44 draft merge + |\ + | o 6:694fd0f6b503 draft fix bug 24 (v2 by alice) + | | + o | 5:fc16901f4d7a draft fix bug 24 (v2 by bob) + |/ + o 2:e011baf925da public fix bug 15 + | + o 1:de6151c48e1c public fix bug 37 + | + o 0:0dc9c9f6ab91 public create new project + + $ hg log -q -r 'divergent()' + 5:fc16901f4d7a + 6:694fd0f6b503 + +# XXX hg evolve does not solve this trouble! bug in evolve? +#Evolve the trouble away. +# $ hg evolve --all --tool=internal:local +# merge:[5] fix bug 24 (v2 by bob) +# with: [6] fix bug 24 (v2 by alice) +# base: [3] fix bug 24 (v1) +# 0 files updated, 1 files merged, 0 files removed, 0 files unresolved +# $ hg status +# $ hg shortlog -G +# o 6:694fd0f6b503 draft fix bug 24 (v2 by alice) +# | +# | @ 5:fc16901f4d7a draft fix bug 24 (v2 by bob) +# |/ +# o 2:e011baf925da public fix bug 15 +# | +# o 1:de6151c48e1c public fix bug 37 +# | +# o 0:0dc9c9f6ab91 public create new project +# +# $ hg --hidden shortlog -G diff -r acc2b590edd9 -r a585353a816b tests/test-simple4server.t --- a/tests/test-simple4server.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-simple4server.t Fri Aug 08 23:14:00 2014 -0700 @@ -50,10 +50,6 @@ pulling from http://localhost:$HGPORT/ searching for changes no changes found - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in 2 nodes - OBSEXC: no unknown remote markers - OBSEXC: DONE $ hg pull -R ../other pulling from http://localhost:$HGPORT/ requesting all changes @@ -61,10 +57,7 @@ adding manifests adding file changes added 2 changesets with 2 changes to 2 files - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in 2 nodes - OBSEXC: no unknown remote markers - OBSEXC: DONE + pull obsolescence markers (run 'hg update' to get a working copy) $ hg push -R ../other pushing to http://localhost:$HGPORT/ @@ -98,20 +91,11 @@ remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files (+1 heads) - OBSEXC: computing relevant nodes - OBSEXC: looking for common markers in 2 nodes - OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (171 bytes) - OBSEXC: DONE + pushing 2 obsolescence markers (171 bytes) $ hg push pushing to http://localhost:$HGPORT/ searching for changes no changes found - OBSEXC: computing relevant nodes - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: markers already in sync - OBSEXC: no marker to push - OBSEXC: DONE [1] Pull @@ -124,20 +108,13 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: merging obsolescence markers (171 bytes) - OBSEXC: 2 markers added - OBSEXC: DONE + pull obsolescence markers + 2 obsolescence markers added (run 'hg heads' to see heads) $ hg -R ../other pull pulling from http://localhost:$HGPORT/ searching for changes no changes found - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: no unknown remote markers - OBSEXC: DONE $ cd .. diff -r acc2b590edd9 -r a585353a816b tests/test-stabilize-conflict.t --- a/tests/test-stabilize-conflict.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-stabilize-conflict.t Fri Aug 08 23:14:00 2014 -0700 @@ -1,6 +1,6 @@ -================================================================= -This files test the proper behavior of evo during merge conflict. -================================================================= +========================================================= +Test the proper behavior of evolve during merge conflict. +========================================================= Initial setup @@ -186,8 +186,8 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: babar count up to five -proper behavior with conflict using an external merge tools ------------------------------------------------------------ +proper behavior with conflict using an external merge tool +---------------------------------------------------------- $ safesed 's/merge=.*/merge=touch/' $HGRCPATH $ safesed 's/touch.gui=.*/touch.gui=false/' $HGRCPATH @@ -209,7 +209,7 @@ $ hg amend 1 new unstable changesets $ safesed 's/interactive=.*/interactive=true/' $HGRCPATH - $ HGMERGE=touch hg evolve < n > EOF move:[8] babar count up to fifteen diff -r acc2b590edd9 -r a585353a816b tests/test-stabilize-order.t --- a/tests/test-stabilize-order.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-stabilize-order.t Fri Aug 08 23:14:00 2014 -0700 @@ -85,7 +85,7 @@ o 0:c471ef929e6a@default(draft) addroot -Test stabilizing a descendant predecessors child +Test stabilizing a descendant predecessor's child $ hg up 7 0 files updated, 0 files merged, 1 files removed, 0 files unresolved diff -r acc2b590edd9 -r a585353a816b tests/test-stabilize-result.t --- a/tests/test-stabilize-result.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-stabilize-result.t Fri Aug 08 23:14:00 2014 -0700 @@ -29,9 +29,10 @@ $ echo a >> a $ hg amend -m changea 1 new unstable changesets - $ hg evolve -v + $ hg evolve -v --confirm move:[2] changea atop:[4] changea + perform evolve? [Ny] y hg rebase -r cce2c55b8965 -d fb9d051ec0a4 resolving manifests $ glog --hidden @@ -99,10 +100,10 @@ $ hg evolve --continue grafting revision 5 -Stabilize of late comer with different parent -================================================== +Stabilize latecomer with different parent +========================================= -(the same parent case is handled in test-evolve.t) +(the same-parent case is handled in test-evolve.t) $ glog @ 8:1cf0aacfd363@default(draft) bk:[] newer a @@ -148,7 +149,7 @@ o 0:07f494440405@default(public) bk:[] adda -Stabilize ! +Stabilize! $ hg evolve --any --dry-run recreate:[12] newer a @@ -157,9 +158,10 @@ hg update 1cf0aacfd363; hg revert --all --rev (73b15c7566e9|d5c7ef82d003); (re) hg commit --msg "bumped update to %s" (no-eol) - $ hg evolve --any + $ hg evolve --any --confirm recreate:[12] newer a atop:[8] newer a + perform evolve? [Ny] y rebasing to destination parent: 66719795a494 computing new diff committed as (a7cabd7bd9c2|671b9d7eeaec) (re) @@ -175,8 +177,8 @@ o 0:07f494440405@default(public) bk:[] adda -Stabilize divergenent changesets with same parent -================================================= +Stabilize divergent changesets with same parent +=============================================== $ rm a.orig $ hg up 9 @@ -230,9 +232,13 @@ o 0:07f494440405@default(public) bk:[] adda -Stabilize It +Stabilize it - $ hg evolve -qn --traceback + $ hg evolve -qn --traceback --confirm + merge:[19] More addition + with: [17] More addition + base: [15] More addition + perform evolve? [Ny] y hg update -c eacc9c8240fe && hg merge d2f173e25686 && hg commit -m "auto merge resolving conflict between eacc9c8240fe and d2f173e25686"&& diff -r acc2b590edd9 -r a585353a816b tests/test-tutorial.t --- a/tests/test-tutorial.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-tutorial.t Fri Aug 08 23:14:00 2014 -0700 @@ -224,9 +224,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - OBSEXC: pull obsolescence markers - OBSEXC: no unknown remote markers - OBSEXC: DONE + pull obsolescence markers (run 'hg heads' to see heads, 'hg merge' to merge) I now have a new heads. Note that this remote head is immutable @@ -405,10 +403,7 @@ adding manifests adding file changes added 3 changesets with 3 changes to 1 files - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 5 nodes - OBSEXC: pushing 6 markers (487 bytes) - OBSEXC: DONE + pushing 6 obsolescence markers (487 bytes) for simplicity sake we get the bathroom change in line again @@ -473,21 +468,24 @@ The tutorial part is not written yet but can use `hg fold`: $ hg help fold - hg fold rev + hg fold [OPTION]... [-r] REV aliases: squash - Fold multiple revisions into a single one + fold multiple revisions into a single one - The revisions from your current working directory to the given one are - folded into a single successor revision. + Folds a set of revisions with the parent of the working directory. All + revisions linearly between the given revisions and the parent of the + working directory will also be folded. - you can alternatively use --rev to explicitly specify revisions to be - folded, ignoring the current working directory parent. + Use --exact for folding only the specified revisions while ignoring the + parent of the working directory. In this case, the given revisions must + form a linear unbroken chain. options: - -r --rev VALUE [+] explicitly specify the full set of revision to fold + -r --rev VALUE [+] revision to fold + --exact only fold specified revisions -m --message TEXT use text as commit message -l --logfile FILE read commit message from file -d --date DATE record the specified date as commit date @@ -495,7 +493,7 @@ [+] marked option can be specified multiple times - use "hg -v help fold" to show the global options + use "hg -v help fold" to show more complete help and the global options ----------------------- @@ -523,10 +521,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (560 bytes) - OBSEXC: 1 markers added - OBSEXC: DONE + pull obsolescence markers + 1 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 75954b8cd933 (public): bathroom stuff @@ -583,10 +579,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (560 bytes) - OBSEXC: 1 markers added - OBSEXC: DONE + pull obsolescence markers + 1 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 75954b8cd933 (draft): bathroom stuff @@ -646,10 +640,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (560 bytes) - OBSEXC: 0 markers added - OBSEXC: DONE + pull obsolescence markers + 0 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) 1 new unstable changesets @@ -738,10 +730,7 @@ adding manifests adding file changes added 2 changesets with 2 changes to 1 files (+1 heads) - OBSEXC: computing relevant nodes - OBSEXC: computing markers relevant to 7 nodes - OBSEXC: pushing 10 markers (803 bytes) - OBSEXC: DONE + pushing 10 obsolescence markers (803 bytes) remote get a warning that current working directory is based on an obsolete changeset @@ -750,10 +739,8 @@ pulling from $TESTTMP/local searching for changes no changes found - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (803 bytes) - OBSEXC: 0 markers added - OBSEXC: DONE + pull obsolescence markers + 0 obsolescence markers added working directory parent is obsolete! now let's see where we are, and update to the successor @@ -783,10 +770,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - OBSEXC: pull obsolescence markers - OBSEXC: merging obsolescence markers (803 bytes) - OBSEXC: 0 markers added - OBSEXC: DONE + pull obsolescence markers + 0 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 99f039c5ec9e (draft): SPAM SPAM SPAM diff -r acc2b590edd9 -r a585353a816b tests/test-uncommit.t --- a/tests/test-uncommit.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-uncommit.t Fri Aug 08 23:14:00 2014 -0700 @@ -152,6 +152,7 @@ $ hg uncommit abort: nothing to uncommit + (use --all to uncommit all files) [255] $ hg bookmarks * touncommit-bm 3:5eb72dbe0cb4 @@ -162,6 +163,7 @@ $ hg uncommit --include nothere abort: nothing to uncommit + (use --all to uncommit all files) [255] Enjoy uncommit diff -r acc2b590edd9 -r a585353a816b tests/test-userguide.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-userguide.t Fri Aug 08 23:14:00 2014 -0700 @@ -0,0 +1,316 @@ +ensure that all the scenarios in the user guide work as documented + +basic repo + $ hg init t + $ cd t + $ touch file1.c file2.c + $ hg -q commit -A -m init + +example 1: commit creates a changeset in draft phase +(this is nothing to do with evolve, but it's mentioned in the user guide) + $ echo 'feature Y' >> file1.c + $ hg commit -u alice -d '0 0' -m 'implement feature X' + $ hg phase -r . + 1: draft + $ hg identify -in + 6e725fd2be6f 1 + +example 2: unsafe amend with plain vanilla Mercurial: the original +commit is stripped + $ hg commit --amend -u alice -d '1 0' -m 'implement feature Y' + saved backup bundle to $TESTTMP/t/.hg/strip-backup/6e725fd2be6f-amend-backup.hg + $ hg log -r 23fe4ac6d3f1 + abort: unknown revision '23fe4ac6d3f1'! + [255] + $ hg identify -in + fe0ecd3bd2a4 1 + +enable evolve for safe history modification + $ cat >> $HGRCPATH < [alias] + > shortlog = log --template '{rev}:{node|short} {phase} {desc|firstline}\n' + > [extensions] + > rebase = + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + +example 3: safe amend with "hg commit --amend" (figure 2) + $ echo 'tweak feature Y' >> file1.c + $ hg commit --amend -u alice -d '2 0' -m 'implement feature Y' + $ hg shortlog -q -r fe0ecd3bd2a4 + abort: unknown revision 'fe0ecd3bd2a4'! + [255] + $ hg --hidden shortlog -G + @ 3:934359450037 draft implement feature Y + | + | x 2:6c5f78d5d467 draft temporary amend commit for fe0ecd3bd2a4 + | | + | x 1:fe0ecd3bd2a4 draft implement feature Y + |/ + o 0:08c4b6f4efc8 draft init + +example 3 redux: repeat safe amend, this time with "hg amend" + $ hg rollback -q + $ hg amend -u alice -d '2 0' -m 'implement feature Y' + $ hg --hidden shortlog -G + @ 3:934359450037 draft implement feature Y + | + | x 2:6c5f78d5d467 draft temporary amend commit for fe0ecd3bd2a4 + | | + | x 1:fe0ecd3bd2a4 draft implement feature Y + |/ + o 0:08c4b6f4efc8 draft init + +example 4: prune at head (figure 3) + $ echo 'debug hack' >> file1.c + $ hg commit -m 'debug hack' + $ hg prune . + 1 changesets pruned + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + working directory now at 934359450037 + $ hg parents --template '{rev}:{node|short} {desc|firstline}\n' + 3:934359450037 implement feature Y + $ hg --hidden shortlog -G -r 3: + x 4:a3e0ef24aaf0 draft debug hack + | + @ 3:934359450037 draft implement feature Y + | + +example 5: uncommit files at head (figure 4) + $ echo 'relevant' >> file1.c + $ echo 'irrelevant' >> file2.c + $ hg commit -u dan -d '10 0' -m 'fix bug 234' + $ hg uncommit file2.c + $ hg status + M file2.c + $ hg --hidden shortlog -G -r 'descendants(3) - 4' + @ 6:c8defeecf7a4 draft fix bug 234 + | + | x 5:da4331967f5f draft fix bug 234 + |/ + o 3:934359450037 draft implement feature Y + | + $ hg parents --template '{rev}:{node|short} {desc|firstline}\n{files}\n' + 6:c8defeecf7a4 fix bug 234 + file1.c + $ hg revert --no-backup file2.c + +example 6: fold multiple changesets together into one (figure 5) + $ echo step1 >> file1.c + $ hg commit -m 'step 1' + $ echo step2 >> file1.c + $ hg commit -m 'step 2' + $ echo step3 >> file2.c + $ hg commit -m 'step 3' + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' -r 7:: + 7:05e61aab8294 step 1 + 8:be6d5bc8e4cc step 2 + 9:35f432d9f7c1 step 3 + $ hg fold -d '0 0' -m 'fix bug 64' -r 7:: + 3 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --hidden shortlog -G -r 6:: + @ 10:171c6a79a27b draft fix bug 64 + | + | x 9:35f432d9f7c1 draft step 3 + | | + | x 8:be6d5bc8e4cc draft step 2 + | | + | x 7:05e61aab8294 draft step 1 + |/ + o 6:c8defeecf7a4 draft fix bug 234 + | + $ hg --hidden log -q -r 'successors(7) | successors(8) | successors(9)' + 10:171c6a79a27b + $ hg --hidden log -q -r 'precursors(10)' + 7:05e61aab8294 + 8:be6d5bc8e4cc + 9:35f432d9f7c1 + $ hg diff -c 10 -U 0 + diff -r c8defeecf7a4 -r 171c6a79a27b file1.c + --- a/file1.c Thu Jan 01 00:00:10 1970 +0000 + +++ b/file1.c Thu Jan 01 00:00:00 1970 +0000 + @@ -3,0 +4,2 @@ + +step1 + +step2 + diff -r c8defeecf7a4 -r 171c6a79a27b file2.c + --- a/file2.c Thu Jan 01 00:00:10 1970 +0000 + +++ b/file2.c Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +step3 + +setup for example 7: amend an older changeset + $ echo 'fix fix oops fix' > file2.c + $ hg commit -u bob -d '3 0' -m 'fix bug 17' + $ echo 'cleanup' >> file1.c + $ hg commit -u bob -d '4 0' -m 'cleanup' + $ echo 'new feature' >> file1.c + $ hg commit -u bob -d '5 0' -m 'feature 23' + $ hg --hidden shortlog -G -r 10:: + @ 13:dadcbba2d606 draft feature 23 + | + o 12:debd46bb29dc draft cleanup + | + o 11:3e1cb8f70c02 draft fix bug 17 + | + o 10:171c6a79a27b draft fix bug 64 + | + +example 7: amend an older changeset (figures 6, 7) + $ hg update -q 11 + $ echo 'fix fix fix fix' > file2.c + $ hg amend -u bob -d '6 0' + 2 new unstable changesets + $ hg shortlog -r 'obsolete()' + 11:3e1cb8f70c02 draft fix bug 17 + $ hg shortlog -r 'unstable()' + 12:debd46bb29dc draft cleanup + 13:dadcbba2d606 draft feature 23 + $ hg --hidden shortlog -G -r 10:: + @ 15:395cbeda3a06 draft fix bug 17 + | + | x 14:f7fab707e247 draft temporary amend commit for 3e1cb8f70c02 + | | + | | o 13:dadcbba2d606 draft feature 23 + | | | + | | o 12:debd46bb29dc draft cleanup + | |/ + | x 11:3e1cb8f70c02 draft fix bug 17 + |/ + o 10:171c6a79a27b draft fix bug 64 + | + $ hg evolve -q --all + $ hg shortlog -G -r 10:: + @ 17:91b4b0f8b5c5 draft feature 23 + | + o 16:fe8858bd9bc2 draft cleanup + | + o 15:395cbeda3a06 draft fix bug 17 + | + o 10:171c6a79a27b draft fix bug 64 + | + +setup for example 8: prune an older changeset (figure 8) + $ echo 'useful' >> file1.c + $ hg commit -u carl -d '7 0' -m 'useful work' + $ echo 'debug' >> file2.c + $ hg commit -u carl -d '8 0' -m 'debug hack' + $ echo 'more useful' >> file1.c + $ hg commit -u carl -d '9 0' -m 'more work' + $ hg shortlog -G -r 17:: + @ 20:ea8fafca914b draft more work + | + o 19:b23d06b457a8 draft debug hack + | + o 18:1f33e68b18b9 draft useful work + | + o 17:91b4b0f8b5c5 draft feature 23 + | + +example 8: prune an older changeset (figures 8, 9) + $ hg prune 19 + 1 changesets pruned + 1 new unstable changesets + $ hg --hidden shortlog -G -r 18:: + @ 20:ea8fafca914b draft more work + | + x 19:b23d06b457a8 draft debug hack + | + o 18:1f33e68b18b9 draft useful work + | + $ hg evolve -q --all + $ hg --hidden shortlog -G -r 18:: + @ 21:4393e5877437 draft more work + | + | x 20:ea8fafca914b draft more work + | | + | x 19:b23d06b457a8 draft debug hack + |/ + o 18:1f33e68b18b9 draft useful work + | + +example 9: uncommit files from an older changeset (discard changes) +(figure 10) + $ echo 'this fixes bug 53' >> file1.c + $ echo 'debug hack' >> file2.c + $ hg commit -u dan -d '11 0' -m 'fix bug 53' + $ echo 'and this handles bug 67' >> file1.c + $ hg commit -u dan -d '12 0' -m 'fix bug 67' + $ hg update 22 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg shortlog -G -r 21:: + o 23:4db2428c8ae3 draft fix bug 67 + | + @ 22:f84357446753 draft fix bug 53 + | + o 21:4393e5877437 draft more work + | + $ hg uncommit file2.c + 1 new unstable changesets + $ hg status + M file2.c + $ hg revert file2.c + $ hg evolve --all + move:[23] fix bug 67 + atop:[24] fix bug 53 + $ hg --hidden shortlog -G -r 21:: + @ 25:0d972d6888e6 draft fix bug 67 + | + o 24:71bb83d674c5 draft fix bug 53 + | + | x 23:4db2428c8ae3 draft fix bug 67 + | | + | x 22:f84357446753 draft fix bug 53 + |/ + o 21:4393e5877437 draft more work + | + $ rm file2.c.orig + +example 10: uncommit files from an older changeset (keep changes) +(figures 11, 12) + $ echo 'fix a bug' >> file1.c + $ echo 'useful but unrelated' >> file2.c + $ hg commit -u dan -d '11 0' -m 'fix a bug' + $ echo 'new feature' >> file1.c + $ hg commit -u dan -d '12 0' -m 'new feature' + $ hg update 26 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --hidden shortlog -G -r 25:: + o 27:fbb3c6d50427 draft new feature + | + @ 26:5b31a1239ab9 draft fix a bug + | + o 25:0d972d6888e6 draft fix bug 67 + | + $ hg uncommit file2.c + 1 new unstable changesets + $ hg status + M file2.c + $ hg commit -m 'useful tweak' + $ hg --hidden shortlog -G -r 25:: + @ 29:51e0d8c0a922 draft useful tweak + | + o 28:2594e98553a9 draft fix a bug + | + | o 27:fbb3c6d50427 draft new feature + | | + | x 26:5b31a1239ab9 draft fix a bug + |/ + o 25:0d972d6888e6 draft fix bug 67 + | + $ hg evolve --all + move:[27] new feature + atop:[28] fix a bug + $ hg --hidden shortlog -G -r 25:: + @ 30:166c1c368ab6 draft new feature + | + | o 29:51e0d8c0a922 draft useful tweak + |/ + o 28:2594e98553a9 draft fix a bug + | + | x 27:fbb3c6d50427 draft new feature + | | + | x 26:5b31a1239ab9 draft fix a bug + |/ + o 25:0d972d6888e6 draft fix bug 67 + | diff -r acc2b590edd9 -r a585353a816b tests/test-wireproto.t --- a/tests/test-wireproto.t Fri Aug 08 15:50:26 2014 -0700 +++ b/tests/test-wireproto.t Fri Aug 08 23:14:00 2014 -0700 @@ -23,10 +23,6 @@ $ hg clone ssh://user@dummy/server client no changes found - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in 0 nodes - OBSEXC: no unknown remote markers - OBSEXC: DONE updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cp -r client other @@ -48,10 +44,6 @@ pulling from ssh://user@dummy/server searching for changes no changes found - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in 2 nodes - OBSEXC: no unknown remote markers - OBSEXC: DONE $ hg pull -R ../other pulling from ssh://user@dummy/server requesting all changes @@ -59,10 +51,7 @@ adding manifests adding file changes added 2 changesets with 2 changes to 2 files - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in 2 nodes - OBSEXC: no unknown remote markers - OBSEXC: DONE + pull obsolescence markers (run 'hg update' to get a working copy) $ hg push -R ../other pushing to ssh://user@dummy/server @@ -78,11 +67,7 @@ $ hg push pushing to ssh://user@dummy/server searching for changes - OBSEXC: computing relevant nodes - OBSEXC: looking for common markers in 2 nodes - OBSEXC: computing markers relevant to 1 nodes - OBSEXC: pushing 2 markers (171 bytes) - OBSEXC: DONE + pushing 2 obsolescence markers (171 bytes) remote: adding changesets remote: adding manifests remote: adding file changes @@ -91,11 +76,6 @@ pushing to ssh://user@dummy/server searching for changes no changes found - OBSEXC: computing relevant nodes - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: markers already in sync - OBSEXC: no marker to push - OBSEXC: DONE [1] Pull @@ -108,20 +88,13 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: merging obsolescence markers (171 bytes) - OBSEXC: 2 markers added - OBSEXC: DONE + pull obsolescence markers + 2 obsolescence markers added (run 'hg heads' to see heads) $ hg -R ../other pull pulling from ssh://user@dummy/server searching for changes no changes found - OBSEXC: pull obsolescence markers - OBSEXC: looking for common markers in [23] nodes (re) - OBSEXC: no unknown remote markers - OBSEXC: DONE $ cd ..