# HG changeset patch # User Pierre-Yves David # Date 1435103393 25200 # Node ID 8a20b2774a659615ef00337e7111e3e730c376a5 # Parent c0ac4fccee3385fe3d29ec34eb6dc94952194cd2# Parent eccfd01aec569a33c704750087ab0a1963918491 merge with inactive compat branch diff -r eccfd01aec56 -r 8a20b2774a65 .hgtags --- a/.hgtags Tue Jun 23 16:47:47 2015 -0700 +++ b/.hgtags Tue Jun 23 16:49:53 2015 -0700 @@ -13,5 +13,26 @@ b1bdcb4506defef0e857e2710633f7686d8034a5 1.0.2 5559e5a4b656978c592d364f242edc62369d7e84 1.0.2 c062edbcaf13135d0312fd2039deca74573ff4f0 1.1.0 -c062edbcaf13135d0312fd2039deca74573ff4f0 1.1.0 22cacfce2a65ab965c6179ae862b148f4abc7d8a 1.1.0 +d43e80504e55db9ad4826e860e50530103a27b0f 2.0.0 +f9d305deeff3dba782e65faf4ef3fd1569995859 2.1.0 +862b6b71a35836e81f090ba7229c2888e8ed2f9f 3.0.0 +cdb52bbbe5b8770d5e68943b7e73bee4ba136ecc 3.1.0 +c3ba8a965a7a173e388d84819e936ea9bae9797f 3.2.0 +83882f2fbecba0b7e7f7e5d490b57db93bd7fa22 3.3.0 +fc04758ea9f549684989ee673b04d9724756dc85 3.3.1 +a03ea39aca2a66ea36817512d586dcbc99dbfe9b 3.3.2 +0304fc2bab158658df53a8f4edd5aa300a9497d2 4.0.0 +e914884fb7210d6350d94909cb25ebc602359680 4.0.1 +4d5d101e878f6d6264a8e036b11afdf922c4ef94 4.1.0 +c13b408c00066af78cda88734909c6f2f3505f76 5.0.0 +51e1e962172c0178394cd36652d90181319f5416 5.0.1 +51e1e962172c0178394cd36652d90181319f5416 5.0.1 +0f30907852831f818bd0d01141b4ab7d8d71b821 5.0.1 +dbd0733e584073d6a7b6dea933767853e9cfe845 5.0.2 +bfe9be352453640233371cc7deb409a09decacf9 5.1.0 +9b8628e0a142e0e094e27430c388e3c12ceba513 5.1.1 +e886bc501796d53e0a19e608c6e5a6071191819e 5.1.2 +c52c15100fb2d85c3525d6d085b3663ec4f90fe6 5.1.3 +891c3ce894fa879532299910735bcc2a968245b1 5.1.4 +1377f6a7f9ecb25e9b8885fce8f6f42e0d6f3f12 5.1.5 diff -r eccfd01aec56 -r 8a20b2774a65 MANIFEST.in --- a/MANIFEST.in Tue Jun 23 16:47:47 2015 -0700 +++ b/MANIFEST.in Tue Jun 23 16:49:53 2015 -0700 @@ -7,10 +7,15 @@ include docs/static/*.svg include hgext/__init__.py include hgext/evolve.py +include hgext/pushexperiment.py +include hgext/simple4server.py include setup.py include README include COPYING include tests/*.t include tests/*.py +include tests/_exc-util.sh +include tests/dummyssh exclude tests/test-oldconvert.t exclude tests/test-qsync.t +exclude tests/test-drop.t diff -r eccfd01aec56 -r 8a20b2774a65 README --- a/README Tue Jun 23 16:47:47 2015 -0700 +++ b/README Tue Jun 23 16:49:53 2015 -0700 @@ -2,49 +2,236 @@ Mutable History For Mercurial ============================= - -Extends Mercurial feature related to Changeset Evolution - -This extension provides several commands to mutate history and deal with -issues it may raise. +This package supplies the ``evolve`` extension for Mercurial, which +provides several commands to mutate history and deal with the +resulting issues. It also: - - enables the "Changeset Obsolescence" feature of mercurial, - - alters core commands and extensions that rewrite history to use - this feature, - - improves some aspect of the early implementation in 2.3 + - enables the "changeset obsolescence" feature of Mercurial + - issues several warning messages when trouble appears in your repository -**These extensions are experimental and are not meant for production.** +**This extension is experimental and not yet meant for production.** -You can quicky enable it by adding the line below to the extensions -section of you hgrc:: +You can enable it by adding the line below to the ``extensions`` +section of your hgrc:: - evolve=PATH/TO/evolve.py - -But it's recommended to look at the doc in the first place. + evolve = PATH/TO/mutable-history/hgext/evolve.py -See doc/ directory for details. +We recommend reading the documentation first. An online version is +available here: -Online version of the doc is available: + http://evolution.experimentalworks.net/doc/ - http://hg-lab.logilab.org/doc/mutable-history/html/ +Or see the ``doc/`` directory for a local copy. Contribute -================== +========== -The simplest way to contribute is to issue a pull request on bitbucket. +Bugs are to be reported on the mercurial's bug tracker: http://bz.selenic.com/ +Use the the "evolution" component. + +Please 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: -However, some cutting edge change may be found in a mutable repository hosted -by logilab before they are published. + 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. - http://hg-lab.logilab.org/wip/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: -Make sure to check lastest draft changeset before submitting new changeset. + cd tests + python run-tests.py --with-hg=/path/to/hg Changelog -================== +========= + +5.1.5 -- 2015-06-23 + +- minor documentation cleanup +- support -i option for `hg amend` if commit supports it (3.4) +- fix the `debugrecordpruneparents` utility +- fix some possible crash during command abort (release non-existant transaction) +- fix simple4server bug tracker URL +- compatibility with bookmark API change in future Mercurial 3.5 +- prune no longer move the active bookmark for no reason (issue4559) +- evolve: stop reporting divergence base as missing when we actually have it +- significant performance improvement for all revsets. + +5.1.4 -- 2015-04-23 + +- significant documentation update +- fix issue4616: pulling with bundle2 would crash if common marker when + discovered on non-served changesets. +- fix the debugobsrelsethashtree command + +5.1.3 -- 2015-04-20 + +- discovery: fix misbehaving discovery accros python version +- pull: properly install the bundle2 par generator + (avoid sending all markers for each pull) +- commit: avoid potential deadlock (acquires wlock before lock) +- graft: avoid potential deadlock (acquires wlock before lock) + +5.1.2 -- 2015-04-01 + +- evolve: prevent a crash in httpclient_pushobsmarkers() when pushing + +5.1.1 -- 2015-03-05 + +- debugobsconvert: fix invalid markers during conversion +- discovery: cache some of the obs hash computation to improve performance (issue4518) +- revset: fix some crash with (issue4515) + +5.1 -- 2015-01-30 + +- evolve: explicitly disable bookmark on evolve (issue4432) +- evolve: don't abort Mercurial on version mismatch +- comptatibility with mercurial 3.3 + +5.0.2 -- 2014-12-14 + +- evolve: remove dependency to the rebase extension + +5.0.1 -- 2014-11-25 + +- amend: fix --logfile argument +- evolve: preserve branch change when evolving +- evolve: fix potential crash while solving `bumped` changesets. +- uncommit: abort when rev specifies the current changeset +- evolve: various message improvement +- evolve: fix selection of changeset to evolve from the middle of a stack (issue4434) +- evolve: make next/prev only move bookmarks optionally +- evolve: tell user which "base of divergent changeset" is not found + + + +5.0.0 -- 2014-10-22 + +- drop compat with Mercurial pre 3.2 +- uncommit: add a --rev argument +- evolve: add a `working directory now at xxxxxxxxxx` message +- evolve: automatically translate obsolete hashes when evolving +- properly skip marker creating if patch apply cleanly +- prune: work around a massive slowdown from lazy revset +- grab: "fix" the grab alias on window + +- fix an issue where prune performance were quadratic with the number of + changesets pruned. +- pull: use discovery to pull less obsmarkers through bundle2 + + +4.1.0 -- 2014-08-08 + +- amend: add -D/--current-date option +- amend: add -U/--current-user option +- evolve: add a --tool option +- evolve: add a --confirm option +- mark "commit -o", "graft -o" and "graft -O" as deprecated since they are + unlikely to eventually make it into core. +- push obsmarkers and phases in the same transaction than changesets + (when using hg >= 3.1 and bundle2-exp is enabled) +- hide message about the obsolescence marker exchange behind a + `experimental.verbose-obsolescence-exchange` variable (default to False). + +4.0.1 -- 2014-08-08 + +- createmarkers() accept an iterable (for compat with other extension) + +4.0.0 -- 2014-06-03 + +- require Mercurial version 3.0.1 or above +- some compatibility fixes with future 3.1.0 +- deprecated `gup` and `gdown` in favor of prev and next +- record parent of pruned parent at prune time +- added a `debugobsstorestat` command to gather data on obsmarker content. +- added a `debugrecordpruneparents` command to upgrade existing prune marker + with parent information. Please run it once per repo after upgrading. +- improvement to obsolescence marker exchange: + - added progress when pushing obsmarkers + - added multiple output during obsolescence markers exchange + - only push markers relevant to pushed subset + - add a new experimental way to exchange marker (when server support): + - added progress when pulling obsmarkers + - only pull markers relevant to pulled subset + - avoid exchanging common markers in some case + - use bundle2 as transport when available. + - add a hook related to the new commands + +3.3.2 -- 2014-05-14 + +- fix a bug where evolve were creating changeset with 2 parents on windows + (fix issues #16, #35 and #42) +- adds a --obsolete flag to import (requieres Mercurial 3.0) +- prune: update to successor rather than parent when pruning '.' with -s +- fold: add missing --message and --logfile option +- fold: add squash as an alias + +3.3.1 -- 2014-04-23 + +- various language fix +- active bookmark now move when using prev/next (#37) +- fix some preservation of rename information on evolve (#33) +- abort when evolve tries to move a node on top of itself (will helps on the #35 front) +- fold: enable --date and --user options + +3.3.0 -- 2014-03-04 + +- raise Mercurial's minimal requirement to 2.7 +- drop `latercomer` and `conflicting` compatibility. Those old alias are + deprecated for a long time now. +- add verbose hint about how to handle corner case by hand. + This should help people until evolve is able to to it itself. +- removed the qsync extension. The only user I knew about (logilab) is not + using it anymore. It not compatible with coming Mercurial version 2.9. +- add progress indicator for long evolve command +- report troubles creation from `hg import` + +3.2.0 -- 2013-11-15 + +- conform to the Mercurial custom of lowercase messages +- added a small extension to experiment with obsolescence marker push +- amend: drop the deprecated note option +- amend: use core mechanism for amend (fix multiple bugs) +- parents command: add "working directory parent is obsolete" message +- evolve command: allow updating to the successor if the parent is + obsolete +- gdown and gup commands: add next and previous alias, respectively +- make grab aliases compatible with Mercurial 2.8 +- Tested with 2.6, 2.7 and 2.8 + +3.1.0 -- 2013-02-11 + +- amend: drop deprecated --change option for amend +- alias: add a grab aliast to be used instead of graft -O +- touch: add a --duplicate option to *not* obsolete the old version +- touch: fix touching multiple revision at the same time +- evolve: add a --all option +- prune: various minor improvements +- prune: add option to prune a specific bookmark +- prune: add -u and -d option to control metadata + +3.0.0 -- 2013-02-02 + +- compatibility with 2.5 + +2.2.0 -- + +- make evolve smarter at picking next troubled to solved without --any + +2.1.0 -- 2012-12-03 + +- qsync fixes +- have qfold ask for commit message + +2.0.0 -- 2012-10-26 + +- compat with mercurial 2.4 1.1.0 -- 2012-10-26 @@ -126,7 +313,6 @@ 0.3.0 -- 2012-06-27 -- - obsolete: Add "latecomer" error detection (stabilize does not handle resolution yet) - evolve: Introduce a new `uncommit` command to remove change from a changeset - rebase: allow the use of --keep again diff -r eccfd01aec56 -r 8a20b2774a65 debian/changelog --- a/debian/changelog Tue Jun 23 16:47:47 2015 -0700 +++ b/debian/changelog Tue Jun 23 16:49:53 2015 -0700 @@ -1,3 +1,67 @@ +mercurial-evolve (5.1.5-1) UNRELEASED; urgency=medium + + * New upstream release. + + -- Pierre-Yves David Tue, 23 Jun 2015 15:30:07 -0700 + +mercurial-evolve (5.1.3-1) unstable; urgency=medium + + * new upstream release + + -- Julien Cristau Mon, 20 Apr 2015 14:44:45 +0200 + +mercurial-evolve (5.0.2-1) unstable; urgency=medium + + * new upstream release + + -- Pierre-Yves David Sun, 14 Dec 2014 12:43:28 -0800 + +mercurial-evolve (5.0.1-1) unstable; urgency=medium + + * New upstream release. + + -- Faheem Mitha Wed, 12 Nov 2014 11:24:28 +0530 + +mercurial-evolve (5.0.0+-1) UNRELEASED; urgency=low + + * new upstream snapshot + + -- Julien Cristau Mon, 17 Nov 2014 15:44:32 +0100 + +mercurial-evolve (4.1.0-1) unstable; urgency=medium + + * new upstream release + + -- Pierre-Yves David Fri, 08 Aug 2014 23:15:11 -0700 + +mercurial-evolve (4.0.1-1) unstable; urgency=medium + + * new upstream release + + -- Pierre-Yves David Fri, 08 Aug 2014 15:50:09 -0700 + +mercurial-evolve (4.0.0-1) unstable; urgency=low + + [ Julien Cristau ] + * New upstream release. + + [ Pierre-Yves David ] + * new upstream release + + -- Pierre-Yves David Fri, 08 Aug 2014 15:48:16 -0700 + +mercurial-evolve (3.1.0-1) UNRELEASED; urgency=low + + * New upstream release. + + -- Pierre-Yves David Mon, 04 Mar 2013 18:02:15 +0100 + +mercurial-evolve (2.1.0-1) UNRELEASED; urgency=low + + * New upstream release + + -- Pierre-Yves David Mon, 03 Dec 2012 15:19:19 +0100 + mercurial-evolve (1.1.0-1) UNRELEASED; urgency=low * New upstream release. diff -r eccfd01aec56 -r 8a20b2774a65 debian/control --- a/debian/control Tue Jun 23 16:47:47 2015 -0700 +++ b/debian/control Tue Jun 23 16:49:53 2015 -0700 @@ -7,13 +7,13 @@ Pierre-Yves David , Standards-Version: 3.9.3 Build-Depends: - mercurial (>= 2.3~), - mercurial (<<2.4), + mercurial (>= 3.4~), python, debhelper (>= 8), python-sphinx (>= 1.0.8), imagemagick, librsvg2-bin, + wget, Python-Version: >= 2.6 Homepage: https://bitbucket.org/marmoute/mutable-history @@ -22,8 +22,7 @@ Depends: ${python:Depends}, ${misc:Depends}, - mercurial (>= 2.3~), - mercurial (<<2.4), + mercurial (>= 3.3~), Description: evolve extension for Mercurial This package provides the experimental "evolve" extension for the Mercurial DVCS. diff -r eccfd01aec56 -r 8a20b2774a65 debian/docs --- a/debian/docs Tue Jun 23 16:47:47 2015 -0700 +++ b/debian/docs Tue Jun 23 16:49:53 2015 -0700 @@ -1,1 +1,2 @@ html +README diff -r eccfd01aec56 -r 8a20b2774a65 debian/rules --- a/debian/rules Tue Jun 23 16:47:47 2015 -0700 +++ b/debian/rules Tue Jun 23 16:49:53 2015 -0700 @@ -1,18 +1,28 @@ #!/usr/bin/make -f +#export DH_VERBOSE=1 %: dh $@ --with python2 --buildsystem=python_distutils -build: - dh build --with python2 --buildsystem=python_distutils +override_dh_auto_build: + dh_auto_build $(MAKE) -C docs -.PHONY: build - +ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS))) override_dh_auto_test: - cd tests && python run-tests.py --with-hg=`which hg` + cd tests && python run-tests.py --with-hg=`which hg` --blacklist=$(CURDIR)/debian/test-blacklist +endif override_dh_python2: # avoid conflict with mercurial's own hgext/__init__.py find debian -name __init__.py -delete dh_python2 + +override_dh_auto_clean: clean-docs + dh_auto_clean + rm -f tests/*.err + +clean-docs: + rm -rf html + rm -f docs/static/logo-evolve.ico + rm -f docs/tutorials/tutorial.rst diff -r eccfd01aec56 -r 8a20b2774a65 debian/source/format --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debian/source/format Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,1 @@ +3.0 (quilt) diff -r eccfd01aec56 -r 8a20b2774a65 debian/test-blacklist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debian/test-blacklist Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,3 @@ +test-drop.t +test-simple4server.t +tests/test-simple4server-bundle2.t diff -r eccfd01aec56 -r 8a20b2774a65 docs/concepts.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/concepts.rst Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/conf.py --- a/docs/conf.py Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/conf.py Tue Jun 23 16:49:53 2015 -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. @@ -73,7 +73,7 @@ # The name of an image file (within the static path) to place at the top of # the sidebar. -html_logo = 'logo-evolve.svg' +#html_logo = 'logo-evolve.svg' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff -r eccfd01aec56 -r 8a20b2774a65 docs/evolve-collaboration.rst --- a/docs/evolve-collaboration.rst Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - ------------------------------------------------- -Collaboration Using Evolve: A user story ------------------------------------------------- - - -After having written some code for ticket #42, Alice starts a patch -(this will be kind of like a 'work-in-progress' checkpoint -initially):: - - $ hg ci -m '[entities] remove magic' - -Instant patch ! Note how the default phase of this changeset is (still) -in "draft" state. - -This is easily checkable:: - - $ hg phase tip - 827: draft - -See? Until the day it becomes a "public" changeset, this can be -altered to no end. How? It happens with an explicit:: - - $ hg phase --public - -In practice, pushing to a "publishing" repository can also turn draft -changesets into public ones. Older Mercurial releases are automatically -"publishing" since they do not have the notion of non-public changesets -(or mutable history). - -During the transition from older mercurial servers to new ones, this will -happen often, so be careful. - -Now let's come back to our patch. Next hour sees good progress and Alice -wants to complete the patch with the recent stuff (all that's shown by -an "hg diff") to share with a co-worker, Bob:: - - $ hg amend -m '[entities] fix frobulator (closes #42)' - -Note that we also fix the commit message. (For recovering mq users: this -is just like "hg qrefresh -m"). - -Before leaving, let's push to the central shared repository. That will -give Bob the signal that something is ripe for review / further amendments:: - - $ hg push # was done with a modern mercurial, draft phase is preserved - -The next day, Bob, who arrives very early, can immediately work out -some glitches in the patch. - -He then starts two others, for ticket #43 and #44 and finally commits them. -Then, as original worker arrives, he pushes his stuff. - -Alice, now equipped with enough properly sugared coffee to survive the -next two hours:: - - $ hg pull - -Then:: - - $ hg up "tip ~ 2" - -brings her to yesterday's patch. Indeed the patch serial number has -increased (827 still exists but has been obsoleted). - -She understands that his original patch has been altered. But how did it -evolve? - -The enhanced hgview shows the two patches. By default only the most -recent version of a patch is shown. - -Now, when Alice installed the mutable-history extensions, she got an alias -that allows her to see the diff between two amendments, defined like this:: - - odiff=diff --rev 'limit(obsparents(.),1)' --rev . - -She can see exactly how Bob amended her work. - -* odiff - - -Amend ... Stabilize --------------------- - -Almost perfect ! Alice just needs to fix a half dozen grammar oddities in -the new docstrings and it will be publishable. - -Then, another round of: - - $ hg amend - -and a quick look at hgview ... shows something strange (at first). - -Ticket #42 yesterday's version is still showing up, with two descendant lineages: - -* the next version, containing grammar fixes, - -* the two stacked changesets for tickets #43 .. 44 committed by Bob. - -Indeed, since this changeset still has non-obsolete descendant -changesets it cannot be hidden. This branch (old version of #42 and -the two descendants by C.W.) is said to be _unstable_. - -Why would one want such a state? Why not auto-stabilize each time "hg -amend" is typed out? - -Alice for one, wouldn't want to merge each time she amends something that -might conflict with the descendant changesets. Remember she is -currently updating the very middle of an history! - -Being now done with grammar and typo fixes, Alice decides it is time to -stabilize again the tree. She does:: - - $ hg evolve - -two times, one for each unstable descendant. The last time, hgview -shows her a straight line again. Wow! that feels a bit like a -well-planned surgical operation. At the end, the patient tree has -been properly trimmed and any conflict properly handled. - -Of course nothing fancy really happened: each "stablilize" can be -understood in terms of a rebase of the next unstable descendant to the -newest version of its parent (including the possible manual conflict -resolution intermission ...). - -Except that rebase is a destructive (it removes information from the -repository), unrecoverable operation, and the "evolve + obsolete" -combo, using changeset copy and obsolescence marker, provide evolution -semantics by only adding new information to the repository (but more -on that later). - -She pushes again. - diff -r eccfd01aec56 -r 8a20b2774a65 docs/evolve-faq.rst --- a/docs/evolve-faq.rst Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/evolve-faq.rst Tue Jun 23 16:49:53 2015 -0700 @@ -1,102 +1,84 @@ .. Copyright 2011 Pierre-Yves David .. Logilab SA ---------------------------------------------------------------------- +------------- Evolve How To ---------------------------------------------------------------------- +------------- Add a changeset: ``commit`` ------------------------------------------------------------- +--------------------------- Just use commit as usual. New changesets will be in the `draft` phase. -Rewrite a changeset: ``amend`` ------------------------------------------------------------- +Rewrite a changeset: ``commit --amend`` +--------------------------------------- -A new command ``hg amend`` is added by the extension. It writes a new -changeset combining working-directory parent changes and parent. It -will work on any `draft` or `secret` changeset. It will not work on -`public` changesets. +It writes a new changeset combining working-directory parent changes and parent. +It will work on any `draft` or `secret` changeset. It will not work on `public` +changesets. To understand what the result of amend will be I use the two following aliases [#]_:: - # diff what amend will look likes + # diff what amend will look like pdiff=diff --rev .^ - # status what amend will look likes + # status what amend will look like pstatus=status --rev .^ -It takes various options to pick an author, a date and the branch of the -result... (see ``hg help amend`` for details). - -This command can even be invoked on changesets with children (provided -none is public) ! - -.. note:: the amend command is very similar to mq's ``qrefresh``, a ``refresh`` - alias for amend is also available. But note that contrary to - ``qrefresh``, ``amend`` does not exclude changes on file not specified - on the command line. - - XXX add idank example - +This command can even be invoked on changesets with children, provided +none are public. .. [#] (defined by the evolve extension for you) -Move a changeset: ``graft`` ------------------------------------------------------------- - -The graft command introduced in 2.0 allows to "copy changes from other -branches onto the current branch". +Move a changeset: ``grab`` +-------------------------- -The graft command has been altered to allow the creation of an -obsolete marker indicating both the result cset and its source -(actually recording changeset movements). +You can use ``hg grab `` to move a rev at your current location, making the +old version obsolete. -This is achieved using a new flag `-O` (or `old-obsolete`) [#]_. +.. note:: grab is an alias for ``hg rebase --dest . --rev $@; hg up `` -XXX example - -.. warning:: when using graft --continue after conflict resolution you **MUST** - pass `-O` or `-o` flag again because they are not saved for now - - -.. [#] add this `-O` to graft instead of a dedicated command is probably - abusive. But this was very convenient for experimental purposes. - This will likely change in non experimental release. - Delete a changeset: ``prune`` ------------------------------------------------------------- +----------------------------- A new ``prune`` command allows removing a changeset. Just use ``hg prune ``. -Moving within the history: ``up`` ``gdown`` and ``gup`` ------------------------------------------------------------- + +Moving within the history: ``gdown`` and ``gup`` +------------------------------------------------ While working on mutable part of the history you often need to move between -mutable commit. +mutable commits. You just need to use standard update to work with evolve. For convenience, you -can use ``hg gup`` to move to children commit or ``hg gdown`` to move to working -directory parent commit. +can use ``hg gup`` to move to the child commit or ``hg gdown`` to move to the parent commit. -.. note:: those command only exist for the convenience of getting qpush and qpop +Those command have ``previous`` and ``next`` alias. + +.. note:: Those commands only exist for the convenience of getting qpush and qpop feeling back. Collapse changesets: ``fold`` ------------------------------------------------------------- +----------------------------- + +You can use ``hg fold`` to collapse multiple changesets in a single one. -you can use ``hg fold`` to collapse multiple changesets in a single one. +It takes two forms: + +``hg fold `` folds everything from you current changeset to `` + +``hg fold -r `` fold everything changeset matching the revset together. Getting changes out of a commit ------------------------------------------------------------- +------------------------------- The ``hg uncommit`` command lets you rewrite the parent commit without selected changed files. Target files content is not altered and @@ -112,11 +94,11 @@ M celestine Split a changeset ------------------------ +----------------- To split on file boundaries, just use ``uncommit`` command. -If you need fine-grained split, there is no official command for that yet. +If you need a fine-grained split, there is no official command for that yet. However, it is easily achieved by manual operation:: ### you want to split changeset A: 42 @@ -132,14 +114,18 @@ # current changeset (.) and previous one (.^) replace A (42) $ hg prune --new . --new .^ 42 +For more complexe scenario we recommend the use of the histedit_ extension. -Update my current work in progess after a pull ----------------------------------------------- +.. _histedit: http://mercurial.selenic.com/wiki/HisteditExtension + -Whenever you are working on some changesets, it is more likely that a pull +Update my current work in progress after a pull +----------------------------------------------- + +Whenever you are working on some changesets, it is more likely that a pull will, eventually, import new changesets in your tree. -And it is likely that you will want your work in progress changsets to be +And it is likely that you will want your work in progress changesets to be rebased on the top of this newly imported subtree. Doing so is only a matter of rebasing. @@ -147,15 +133,15 @@ Move multiple changesets: ``rebase`` ------------------------------------------------------------- +------------------------------------ You can still use rebase to move a whole segment of the changeset graph together. -.. warning:: Beware that rebasing obsolete changesets will result in - conflicting versions of the changesets. +.. warning:: Beware that rebasing changesets already obsolete will likely result in + divergent versions of the changesets. Resolve history troubles: ``evolve`` ------------------------------------------------------------- +------------------------------------ When you rewrite (amend) a changeset with children without rewriting those children you create *unstable* changesets and *suspended @@ -163,35 +149,31 @@ When you are finished amending a given changeset, you will want to declare it stable, in other words rebase its former descendants on its -newest version. This is not done automatically to avoid the -proliferation of useless hidden changesets. +newest version. + +You can also use evolve to solve `bumped` and `divergent` changeset/ Fix my history afterward: ``prune -n`` ------------------------------------------------------------- +-------------------------------------- Sometimes you need to create an obsolete marker by hand. This may happen when upstream has applied some of your patches for example. -you can use ``hg prune --new `` to add obsolete +you can use ``hg prune --succ `` to add obsolete marker. -Export to mq: ``synchronize`` ------------------------------------------------------------- - -Another extension allows to export your changes to mq. - View diff from the last amend ------------------------------------------------------------- +----------------------------- An ``odiff`` alias have been added by ``enable.sh`` -:: +:: [alias] odiff = diff --rev 'limit(precursors(.),1)' --rev . View obsolete markers ------------------------------------------------------------- +--------------------- hgview_ is the only viewer that currently supports this feature. You need version 1.6.2 @@ -211,16 +193,18 @@ Important Note -===================================================================== +============== View change to your file ------------------------------------------------------------- +------------------------ Extinct changesets are hidden using the *hidden* feature of mercurial. -Only ``hg log``, ``hg glog`` and ``hgview`` support it, other +Only ``hg log`` and ``hgview`` support it, other graphical viewer do not. +You can use ``hg log --graph --hidden`` from the command line + @@ -229,4 +213,3 @@ - diff -r eccfd01aec56 -r 8a20b2774a65 docs/evolve-good-practice.rst --- a/docs/evolve-good-practice.rst Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/evolve-good-practice.rst Tue Jun 23 16:49:53 2015 -0700 @@ -2,11 +2,11 @@ .. Logilab SA ----------------------------------------- -Good pratice for (early) user of evolve +Good practice for (early) users of evolve ----------------------------------------- Avoid unstability --------------------------------- +----------------- The less unstability you have the less you need to resolve. @@ -14,25 +14,25 @@ not ready neither. Branch as much as possible --------------------------------- +-------------------------- -This is not MQ, you are not constrainted to linear history. +This is not MQ; you are not constrained to linear history. Making a branch per independent branch will help you avoid unstability and conflict. -Rewrite you change only ------------------------------------------------- +Rewrite your changes only +------------------------- There is no descent conflict detection and handling right now. Rewriting other people's changesets guarantees that you will get conflicts. Communicate with your fellow developers before trying to touch other people's work (which is a good pratice in any case). -Using multiple branch will help you to achieve this goal. +Using multiple branches will help you to achieve this goal. -Prefer pushing unstability than touching other people changeset ------------------------------------------------------------------- +Prefer pushing unstability to touching other people changesets +-------------------------------------------------------------- If you have children changesets from other people that you don't really care @@ -40,7 +40,7 @@ Do not get too confident ---------------------------- +------------------------ This is an experimental extension and a complex concept. This is beautiful, powerful and robust on paper, but the tool and your mind may not be prepared for diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/edit-is-rewrite-step1.svg --- a/docs/figures/edit-is-rewrite-step1.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,509 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - ";Alice;Babar"19b08111 - - - - "19b08111;Alice;Babar,Celeste"925d8319 - - - - "6fcdd7fe;Bob;Babar"⟶ebc2b5a1 - - - - "925d8319;Alice;Babar,Celeste,flore"6fcdd7fe - - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/edit-is-rewrite-step2.svg --- a/docs/figures/edit-is-rewrite-step2.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,832 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - ";Alice;Babar"19b08111 - - - - "19b08111;Alice;Babar,Celeste"925d8319 - - - - "6fcdd7fe;Bob;Babar"⟶ebc2b5a1 - - - - "925d8319;Alice;Babar,Celeste,flore"6fcdd7fe - - - - - - - "19b08111;Bob;Babar,Celeste"1a25964c - - - - "6d9e1549;Bob;Babar"dda72e36 - - - - "1a25964c;Alice;Babar,Celeste,Flore"6d9e1549 - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/error-conflicting.svg --- a/docs/figures/error-conflicting.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-18 23:47ZCanvas 1Layer 1A’AA’’Conflicting diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/error-extinct.svg --- a/docs/figures/error-extinct.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-18 23:47ZCanvas 1Layer 1ABBAA'CC'CObsoleteUnstableextinctsuspended diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/error-obsolete.svg --- a/docs/figures/error-obsolete.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-18 23:47ZCanvas 1Layer 1ACBB’C’Obsolete diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/error-unstable.svg --- a/docs/figures/error-unstable.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-18 23:47ZCanvas 1Layer 1ABAA'ObsoleteUnstableB diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/example-1-update.svg --- a/docs/figures/example-1-update.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-21 08:32ZCanvas 1Layer 1AA’A diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/example-2-split.svg --- a/docs/figures/example-2-split.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-21 08:32ZCanvas 1Layer 1AA1A2A diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-concurrent-10-solution.svg --- a/docs/figures/explain-troubles-concurrent-10-solution.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,929 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - B'' - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - B'' - - - - - - - - - - - - B - - - - B' - - - - B'' - - - - B* - - - - - - - - B* - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-concurrent-10-sumup.svg --- a/docs/figures/explain-troubles-concurrent-10-sumup.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1451 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - Local - Distant - final = divergent - - - - - initial - - - - B - - - - A - - - - Z - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - - - - - B - - - - A - - - - Z - - - - - - B'' - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - B'' - - - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-latecomer-10-sumup.svg --- a/docs/figures/explain-troubles-latecomer-10-sumup.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1039 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - Local - Distant - final = tardif - - - - - - - - A - - - - Z - - - - - - - A - - - - Z - - - - - A' - - - - - initial - - - - v4.2 - - - - A - - - - Z - - - - - - A' - - - - - - - - v4.2 - - - - A - - - - Z - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-latecomer-15-solution.svg --- a/docs/figures/explain-troubles-latecomer-15-solution.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,994 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - v4.2 - - - - A - - - - Z - - - - - - A' - - - - - - - - - v4.2 - - - - A - - - - Z - - - - - - A' - - Aᵟ - - - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-unstable-10-sumup.svg --- a/docs/figures/explain-troubles-unstable-10-sumup.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - - Local - - - - - - B - - - - A - - - - Z - - - - - - C - - - - Distant - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - - - C - - - - final = instable - - - - - - B - - - - A - - - - Z - - - - - initial - - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/explain-troubles-unstable-15-solution.svg --- a/docs/figures/explain-troubles-unstable-15-solution.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1006 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - - - C - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - - - C - - - - - C' - - - - - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug01.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug01.svg Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 0 + + + + 1 + + + hg commit --amend + + + + + + + + 0 + + + + 1' + + + + poof! + + + + (destructive, not using evolve) + diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug02.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug02.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug03.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug03.svg Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + 3 + + + + 4 + + + + + hg prune . + + + + + + + + + + + 3 + + + + 4 + + + obsolete,hidden,no successors + working dir + working dir + + + + diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug04.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug04.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug05.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug05.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug06.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug06.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug07.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug07.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug08.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug08.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug09.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug09.svg Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + hg evolve --all + + + + + + + + + + 18 + + + + 19 + + + + 20 + + + + + + 21 + + + + obsolete, hidden + successor,working dir + + + + + diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug10.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug10.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug11.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug11.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/figure-ug12.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-ug12.svg Tue Jun 23 16:49:53 2015 -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 eccfd01aec56 -r 8a20b2774a65 docs/figures/git.svg --- a/docs/figures/git.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,863 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - - - - - - - B - - - - A - - - - Z - - - - - - B' - - - - A' - - - - - - C - - - - - feature-babar - other/feature-babar - feature-babar - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/simple-3-merge.svg --- a/docs/figures/simple-3-merge.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-21 08:32ZCanvas 1Layer 1AABBC diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/simple-4-reorder.svg --- a/docs/figures/simple-4-reorder.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-21 08:32ZCanvas 1Layer 1AABBA'B' diff -r eccfd01aec56 -r 8a20b2774a65 docs/figures/simple-5-delete.svg --- a/docs/figures/simple-5-delete.svg Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - - -2012-03-21 08:32ZCanvas 1Layer 1AA diff -r eccfd01aec56 -r 8a20b2774a65 docs/from-mq.rst --- a/docs/from-mq.rst Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/from-mq.rst Tue Jun 23 16:49:53 2015 -0700 @@ -1,12 +1,12 @@ .. Copyright 2011 Pierre-Yves David .. Logilab SA -------------------------------------------- +----------------------------------- From MQ To Evolve, The Refugee Book -------------------------------------------- +----------------------------------- Cheat sheet -------------- +----------- ============================== ============================================ mq command new equivalent @@ -14,12 +14,13 @@ qseries ``log`` qnew ``commit`` qrefresh ``amend`` +qrefresh --exclude ``uncommit`` qpop ``update`` or ``gdown`` qpush ``update`` or ``gup`` sometimes ``evolve`` qrm ``prune`` qfold ``fold`` qdiff ``odiff`` -qrecord ``/qrecord`` +qrecord ``record`` qfinish -- qimport -- @@ -27,10 +28,10 @@ Replacement details ---------------------- +------------------- hg qseries -``````````` +`````````` All your work in progress is now in real changesets all the time. @@ -38,17 +39,17 @@ phase revset to display unfinished work only, and use templates to have the same kind of compact that the output of qseries has. -This will result in something like that:: +This will result in something like:: [alias] wip = log -r 'not public()' --template='{rev}:{node|short} {desc|firstline}\n' hg qnew -```````` +``````` With evolve you handle standard changesets without an additional overlay. -Standard changeset are created using hg commit as usual.:: +Standard changeset are created using hg commit as usual:: $ hg commit @@ -56,7 +57,7 @@ set your changeset in the secret phase using the phase command. Note that you only need it for the first commit you want to be secret. Later -commits will inherit their parents phase. +commits will inherit their parent's phase. If you always want your new commit to be in the secret phase, your should consider updating your configuration: @@ -65,7 +66,7 @@ new-commit=secret hg qref -```````` +``````` A new command from evolution will allow you to rewrite the changeset you are currently on. Just call: @@ -86,20 +87,20 @@ .. $ hg record babar.py .. $ hg amend -c .^ # .^ refer to "working directoy parent, here 'feature A' -note: refresh is an alias for amend +.. note: refresh is an alias for amend -hg qref -X -```````````` +hg qref --exclude +````````````````` -To remove changes from you current commit use:: +To remove changes from your current commit use:: $ hg uncommit not-ready.txt hg qpop -````````` +``````` -The following command emulate the behavior of hg qpop: +The following command emulates the behavior of hg qpop: $ hg gdown @@ -107,17 +108,17 @@ $ hg update -.. note:: gdown and update allow movement with working directory changes applied - and gracefully merge them. +.. note:: gdown and update allow movement with working directory + changes applied, and gracefully merge them. hg qpush ```````` When you rewrite changesets, descendants of rewritten changesets are marked as -"out of sync". You need to rewrite them on top of the new version of their +"unstable". You need to rewrite them on top of the new version of their ancestor. -The evolution extension adds a command to rewrite the "out of sync" +The evolution extension adds a command to rewrite "unstable" changesets::: $ hg evolve @@ -135,21 +136,14 @@ hg qrm -``````` +`````` evolution introduce a new command to mark a changeset as "not wanted anymore".:: $ hg prune -hg qrm -``````` - -:: - - $ hg fold :: - hg qfold -````````` +```````` :: @@ -157,22 +151,22 @@ $ hg fold first::last hg qdiff -````````` +```````` -``pdiff`` is an alias for `hg diff -r .^` it works as qdiff, but outside mq. +``pdiff`` is an alias for `hg diff -r .^` It works like qdiff, but outside MQ. hg qfinish and hg qimport -```````````````````````````` +````````````````````````` -These are not necessary anymore. If you want to control exchange and -mutability of changesets, see the phase feature +These are not necessary anymore. If you want to control the +mutability of changesets, see the phase feature. hg qcommit -``````````````` +`````````` If you really need to send patches through versioned mq patches, you should look at the qsync extension. diff -r eccfd01aec56 -r 8a20b2774a65 docs/index.rst --- a/docs/index.rst Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/index.rst Tue Jun 23 16:49:53 2015 -0700 @@ -1,161 +1,147 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - -======================================== -Safe Mutable History -======================================== +.. Copyright © 2014 Greg Ward - -Here are various materials on planned improvement to Mercurial regarding -rewriting history. - -First read about what challenge arise while rewriting history and how we plan to -solve them once and for all. +================================== +Changeset Evolution with Mercurial +================================== .. toctree:: :maxdepth: 2 - instability + user-guide + sharing + concepts + from-mq -The effort is split in two parts: +`evolve`_ is an experimental Mercurial extension for safe mutable history. + +.. _`evolve`: http://mercurial.selenic.com/wiki/EvolveExtension - * The **obsolescence marker** concept aims to provide an alternative to ``strip`` - to get rid of changesets. This concept have been partially implemented in - Mercurial 2.3. +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. + +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. + +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`` makes things better in a couple of ways: - * The **evolve** mercurial extension rewrites history using obsolete - *marker* under the hood. + * 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. + + * It provides a new way of modifying history that is roughly + equivalent to ``mq`` (but much nicer and safer). + +It helps to understand that ``evolve`` builds on infrastructure +already in core Mercurial: + + * *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``. -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. + * *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. -Evolve: A robust alternative to MQ -==================================== +Some of the things you can do with ``evolve`` are: + + * 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.) -Evolve is an experimental history rewriting extension that uses obsolete -markers. It is inspired from MQ and pbranch but have multiple advantages over -them: + * 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.” + + * 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.” + + * 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. -* Focus on your current work. + * 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. + +``evolve`` is experimental! +--------------------------- - You can focus your work on a single changeset and take care of adapting - descendent changeset later. +The long-term plan for ``evolve`` is to add it to core Mercurial. +However, it is not yet stable enough for that. In particular: + + * The UI is unstable: ``evolve``'s command names and command options + are not completely nailed down yet. They are subject to occasional + backwards-incompatible changes. If you write scripts that use + evolve commands, a future release could break your scripts. -* Handle **non-linear history with branches and merges** + * There are still some corner cases that aren't handled yet. If you + think you have found such a case, please check if it's already + described in the Mercurial bug tracker (http://bz.selenic.com). + Bugs in ``evolve`` are files under component "evolution": use + `this query`_ to view open bugs in ``evolve``. -* Rely internally on **robust merge** mechanism of mercurial. +.. _`this query`: http://bz.selenic.com/buglist.cgi?component=evolution&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=NEED_EXAMPLE + +Installation and setup +---------------------- + +To use ``evolve``, you must: + + #. Clone the ``evolve`` repository:: - Simple conflict are handled by real merge tools using appropriate ancestor. - Conflict are much rarer and much more user friendly. + cd ~/src + hg clone https://bitbucket.org/marmoute/mutable-history + + #. Configure the extension, either locally :: + + hg config --local + + or for all your repositories :: -* Mutable history **fully available all the time**. + hg config --edit + + Then add :: - always use 'hg update' and forget about (un)applying patches to access the - mutable part of your history. + evolve=~/src/mutable-history/hgext/evolve.py + + in the ``[extensions]`` section (adding the section if necessary). Use + the directory that you actually cloned to, of course. -* Use only **plain changeset** and forget about patches. Evole will create and - exchange real changesets. Mutable history can be used in all usual operations: - pull, push, log, diff, etc. - -* Allow **sharing and collaboration** mutable history without fear of duplicate - (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. - - 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 release or once integrated in - mercurial. It is still an immature extension, a lot of - features are still missing but there is no high risk of - repository corruption. - - Production ready version should hide such details to normal user. - -The evolve extension require mercurial 2.3 - -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.6.2 -or later is required. - -.. _hgview: http://www.logilab.org/project/hgview/ - -(The old version 0.7 of evolve works with mercurial 2.2 but have far less feature) - - - --- - -For more information see documents below: - -.. toctree:: - :maxdepth: 1 - - tutorials/tutorial - evolve-good-practice - evolve-faq - from-mq - evolve-collaboration - qsync +Next steps: +----------- -Smart changeset deletion: Obsolete Marker -========================================== - -Obsolete marker is a powerful concept that allow mercurial to safely handle -history rewriting operations. It is a new type of relation between Mercurial -changesets that track the result of history rewriting operations. - -This concept is simple to define and provides a very solid base to: - -- Very fast history rewriting operations, - -- auditable and reversible history rewriting process, - -- clean final history, - -- share and collaborate on mutable parts of the history, - -- gracefully handle history rewriting conflicts, - -- allow various history rewriting UI to collaborate with a underlying common API. - - --- - -For more information see documents below + * 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). -.. toctree:: - :maxdepth: 1 - - obs-concept - obs-terms - obs-implementation - - -Known limitation and bug -================================= - -Here is a list of know issue that will be fixed later: - - -* 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. - -* 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. ``hg head`` or other visual viewer don't. - -* hg heads show extinct changeset +.. _`user guide`: user-guide.html +.. _`sharing mutable history`: sharing.html +.. _`concepts`: concepts.html +.. _`MQ migration guide`: from-mq.html diff -r eccfd01aec56 -r 8a20b2774a65 docs/instability.rst --- a/docs/instability.rst Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - ------------------------------------ -The instability Principle ------------------------------------ - - - -An intrinsic contradiction ------------------------------------ - -XXX starts by talking about getting ride of changeset. - -DVCSes bring two new major concepts to the Version Control Scene: - - * History is organized as a robust DAG, - * History can be rewritten. - -However, the two concepts are in contradiction: - -To achieve a robust history, three key elements are gathered in *changesets*: - - * Full snapshot of the versioned content, - * Reference to the previous full snapshot used to build the new one, - * A description of the change who lead from the old content to the new old. - -All three elements are to compute a *unique* hash that identify the changeset -(with various other metadata). This identification is a key part of DVCS design. - -This is a very useful property because Changing B parent means -changing B content too. This requires the creation of **another** -changeset, which is semantically good. - -.. figure:: ./figures/edit-is-rewrite-step2.svg - - -To avoid duplication, the older changeset is usually discarded from accessible -history. I'm calling them *obsolete* changesets. - - -But rewriting a changeset with children does not change these -children's parent! And because children of the rewritten changeset -still **depend** on the older "dead" version of the changeset with -can not get rid of this dead version. - -:: - - Schema base, A and A' and B. - -I'm calling these children **unstable** because they are based on a -dead changeset and prevent people to get rid of it. - -This instability is an **unavoidable consequence** of the strict dependency of -changeset. History Rewriting history alway need to take it in account and -provide a way to rewrite the descendant on the new changeset to avoid -coexistence of the old and new version of a rewritten changeset. - - -Everybody is working around the issue ------------------------------------------------- - -I'm not claiming that rewriting history is impossible. People are successfully -doing for years. However they all need to work around *instability*. Several -work around strategy exists. - - -Rewriting all at once -`````````````````````````` - -The simplest way to avoid instability is to ensure rewriting -operations always end in a stable situation. This is achieved by -rewriting all affected changesets at the same time. - -Rewriting all descendants at the same time when rewriting a changeset. - -:: - - Schema! - -Several Mercurial commands apply it: rebase, collapse, histedit. -Mercurial also refuses to amend changeset with descendant. The git -branch design enforces such approach in git too. - - -However, DVCS are **Distributed**. This means that you do not control what -happen outside your repository. Once a changeset have been exchanged *outside*, -there is no way to be sure it does not have descendants somewhere else. -Therefore **if you rewrite changeset that exists elsewhere, you can't eradicate -the risk of instability.** - -Do not rewrite exchanged changeset -``````````````````````````````````` - -To work around the issue above, Mercurial introduced phases, which -prevent you from rewriting shared changesets and ensure others can't -pull certain changesets from you. But this is a very frustrating -limitation that prevents you to efficiently sharing, reviewing and -collaborating on mutable changesets. - -In the Git world, they use another approach to prevent instability. By -convention only a single developper works on a changeset contained in -a named branch. But once again this is a huge blocker for -collaborating. Moreover clueless people **will** mess up social -convention soon or later. - - -Loose the DAG robustness -```````````````````````````` - -The other approach in Mercurial is to keep the mutable part of the -history outside the DVCS constraint. This is the MQ approach of -sticking a quilt queue over Mercurial. - -This allow much more flexible workflow but two major feature are lost in the -process: - -:graceful merge: MQ use plain-patch to store changeset content and patch have - trouble to apply in changing context. Applying your queue - becomes very painful when context changes. - -:easy branching: A quilt queue is by definition a linear queue. Increasing risk - of conflict - -It is possible to collaborate over versioned mq! But you are going to -have a lot of troubles. - -Ignore conflicts -``````````````````````````````````` - -Another ignored issue is a conflicting rewrite of the same changeset. -If a changeset is rewritten two times we have two newer versions, -and duplicated history is complicated to merge. - -Mercurial work around by - -The "One set of mutable changset == One developer" mantra is also a way to work -around conflicting rewriting of changeset. If two different people are able to - -The git branch model allow to overwrite changeset version by another -one, but it does not care about divergent version. It is the equivalent -of "common ftp" source management for changesets. - -Facing The Danger Once And For All ------------------------------------------------- - -Above we saw that, the more effort you put to avoid instability, the more option -you deny. And even most restrictive work flow can't guarantee that instability -will never show up! - -Obsolete marker can handle the job -``````````````````````````````````` - -It is time to provide a full featured solution to deal with -instability and to stop working around the issue! This is why I -developing a new feature for mercurial called "Obsolete markers". -Obsolete markers have two key properties: - - -* Any "old" changeset we want to get ride of is **explicitly** marked - as "obsolete" by history rewriting operation. - - By explicitly marking the obsolete part of the history, we will be able to - easily detect instability situation. - -* Relations between old and new version of changesets are tracked by obsolete - markers. - - By Storing a meta-history of changeset evolution we are able to easily resolve - instability and edition conflict [#]_ . - -.. [#] edition conflict is another major obstable to collaboration. See the - section dedicated to obsolete marker for details. - -Improves robustness == improves simplicity -```````````````````````````````````````````````` - -This proposal should **first** be seen as a safety measure. - -It allow to detect instability as soon as possible - -:: - - $ hg pull - added 3 changeset - +2 unstable changeset - (do you want "hg evolve" ?) - working directory parent is obsolete! - $ hg push - outgoing unstable changesets - (use "hg evolve" or force the push) - -And should not not encourage people to create instability - -:: - - $ hg up 42 - $ hg commit --amend - changeset have descendant. - $ hg commit --amend -f - +5 unstable changeset - - $ hg rebase -D --rev 40::44 - rebasing already obsolete changeset 42:AAA will conflict with newer version 48:BBB - -While allowing powerful feature -```````````````````````````````````````````````` - - -* Help to automatically solve instability. - -* "prune" changeset remotely. - -* track resulting changeset when submitting patch//pull request. - -* Focus on what you do: - - I do not like the "all at once" model of history rewriting. I'm comfortable - with instability and obsolete marker offer all the tool to safely create and - handle instability locally. - - diff -r eccfd01aec56 -r 8a20b2774a65 docs/makefile --- a/docs/makefile Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/makefile Tue Jun 23 16:49:53 2015 -0700 @@ -1,8 +1,8 @@ -all: tutorial static/logo-evolve.ico +all: tutorials/tutorial.rst static/logo-evolve.ico sphinx-build . ../html/ -tutorial: +tutorials/tutorial.rst: tutorials/tutorial.t python test2rst.py tutorials/ static/logo-evolve.ico: static/logo-evolve.svg diff -r eccfd01aec56 -r 8a20b2774a65 docs/obs-concept.rst --- a/docs/obs-concept.rst Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,390 +0,0 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - ------------------------------------------------------------ -Why Do We Need a New Concept ------------------------------------------------------------ - -Current DVCSes are great tools for forging a series of flawless -changesets on your own. But they perform poorly when it comes to -**sharing** some work in progress and **collaborating** on such work -in progress. - -When people forge a new version of a changeset they actually create a -new changeset and get rid of the original changeset. Difficulties to -collaborate mostly came from the way old content is *removed* from -a repository. - -Mercurial Approach: Strip ------------------------------------------------------ - -With the current version of mercurial, every changeset that exists in -your repository is *visible* and *meaningful*. To delete old -(rewritten) changesets, mercurial removes them from the repository -storage with an operation called *strip*. After the *stripping*, the -repository looks as if the changeset never existed. - -This approach is simple and effective except for one big -drawback: you can remove changesets from **your repository only**. If -a stripped changeset exists in another repository it touches, it will -show up again. This is because a shared changeset becomes -part of a shared global history. Stripping a changeset from all -repositories is at best impractical and in most case impossible. - -As consequence, **you can not rewrite something once you exchange it with -others**. The old version will still exist along side the new one [#]_. - -Moreover stripping changesets creates backup bundles. This allows -restoration of the deleted changesets, but the process is painful. - -Finally, as the repository format is not optimized for deletion. stripping a -changeset may be slow in some situations. - -To sum up, the strip approach is very simple but does not handle -interaction with the outer world, which is very unfortunate for a -*Distributed* VCS. - -.. [#] various work around exists but they require their own workflows - which are distinct from the very elegant basic workflow of - Mercurial. - -Git Approach: Overwrite Reference ------------------------------------------------------ - -The Git approach to repository structure is a bit more complex: there -can be any amount of unrelated changesets in a repository, and **only -changesets referenced by a git branch** are *visible* and -*meaningful*. - - -.. figure:: ./figures/git.* - - -This simplifies the process of getting rid of old changesets. You can -just leave them in place and move the reference on the new one. You -can then propagate this change by moving the git-branch on remote host -with the newer version of the marker overwriting the older one. - -This approach goes a bit further but still has a major drawback: - -Because you **overwrite** the git-branch, you have no conflict -resolution. The last to act wins. This makes collaboration on multiple -changesets difficult because you can't merge concurrent updates on a -changeset. - -Every overwrite is a forced operation where the operator says, "yes I -want this to replace that". In highly distributed environments, a user -may end up with conflicting references and no proper way to choose. - -Because of this way to visualize a repository, git-branches are a core -part of git, which makes the user interface more complicated and -constrains moving through history. - -Finally, even if all older changesets still exist in the repository, -accesing them is still painful. - - ------------------------------------------------------ -The Obsolete Marker Concept ------------------------------------------------------ - - -As none of the concepts was powerful enough to fulfill the need of -safely rewriting history, including easy sharing and collaboration on -mutable history, we needed another one. - -Basic concept ------------------------------------------------------ - - -Every history rewriting operation stores the information that old rewritten -changeset is replaced by newer version in a given set of changesets. - -All basic history rewriting operation can create an appropriate obsolete marker. - - -.. figure:: ./figures/example-1-update.* - - *Updating* a changeset - - Create one obsolete marker: ``([A'] obsolete A)`` - - - -.. figure:: ./figures/example-2-split.* - - *Splitting* a changeset in multiple one - - Create one obsolete marker ``([B1, B2] obsolete B)]`` - - -.. figure:: ./figures/simple-3-merge.* - - *Merging* multiple changeset in a single one - - Create two obsolete markers ``([C] obsolete A), ([C] obsolete B)`` - -.. figure:: ./figures/simple-4-reorder.* - - *Moving* changeset around - - Reordering those two changesets need two obsolete markers: - ``([A'] obsolete A), ([B'] obsolete B)`` - - - -.. figure:: ./figures/simple-5-delete.* - - *Removing* a changeset: - - One obselete marker ``([] obsolete B)`` - - -To conclude, a single obsolete marker express a relation from **0..n** new -changesets to **1** old changeset. - -Basic Usage ------------------------------------------------------ - -Obsolete markers create a perpendicular history: **a versioned -changeset graph**. This means that offers the same features we have -for versioned files but applied to changeset: - -First: we can display a **coherent view** of the history graph in which only a -single version of your changesets is displayed by the UI. - -Second, because obsolete changeset content is still **available**. You can -you can - - * **browse** the content of your obsolete commits, - - * **compare** newer and older versions of a changeset, - - * **restore** content of previously obsolete changesets. - -Finally, the obsolete marker can be **exchanged between -repositories**. You are able to share the result on your history -rewriting operations with other prople and **collaborate on the -mutable part of the history**. - -Conflicting history rewriting operation can be detected and -**resolved** as easily as conflicting changes on a file. - - -Detecting and solving tricky situations ------------------------------------------------------ - -History rewriting can lead to complex situations. The obsolete marker -introduces a simple representation for this complex reality. But -people using complex workflows will one day or another have to face -the intrinsic complexity of some real-world situation. - -This section describes possible situations, defines precise sets of -changesets involved in such situations and explains how the error -cases can be resolved automatically using the available information. - - -Obsolete changesets -```````````````````` - -Old changesets left behind by obsolete operation are called **obsolete**. - -With the current version of mercurial, this *obsolete* part is stripped from the -repository before the end of every rewriting operation. - -.. figure:: ./figures/error-obsolete.* - - Rebasing `B` and `C` on `A` (as `B'`, `C'`) - - This rebase operation added two obsolete markers from new - changesets to old changesets. These two old changesets are now - part of the *obsolete* part of the history. - -In most cases, the obsolete set will be fully hidden to both the UI and -discovery, hence users do not have to care about them unless they want to -audit history rewriting operations. - -Unstable changesets -``````````````````` - -While exploring the possibilities of the obsolete marker a bit -further, you may end up with *obsolete* changesets which have -*non-obsolete* children. There is two common ways to achieve this: - -* Pull a changeset based of an old version of a changeset [#]_. - -* Use a partial rewriting operation. For example amend on a changeset with - children. - -*Non-obsolete* changeset based on *obsolete* one are called **unstable** - -.. figure:: ./figures/error-unstable.* - - Amend `A` into `A'` leaving `B` behind. - - In this situation we cannot consider `B` as *obsolete*. But we - have all the necessary data to detect `B` as an *unstable* branch - of the history because its parent `A` is *obsolete*. In addition, - we have enough data to automatically resolve this instability: we - know that the new version of `B` parent (`A`) is `A'`. We can - deduce that we should rebase `B` on `A'` to get a stable history - again. - -Proper warnings should be issued when part of the history becomes -unstable. The UI will be able to use the obsolete marker to -automatically suggest a resolution to the user of even carry them out -for them. - - -XXX details on automatic resolution for - -* movement - -* handling deletion - -* handling split on multiple head - - -.. [#] For this to happen one needs to explicitly enable exchange of draft - changesets. See phase help for details. - -The two parts of the obsolete set -`````````````````````````````````````` - -The previous section shows that there could be two kinds of *obsolete* -changesets: - -* an *obsolete* changeset with no or *obsolete* only descendants is called **extinct**. - -* an *obsolete* changeset with *unstable* descendants is called **suspended**. - - -.. figure:: ./figures/error-extinct.* - - Amend `A` and `C` leaving `B` behind. - - In this example we have two *obsolete* changesets: `C` with no *unstable* - children is *extinct*. `A` with *unstable* descendant (`B`) is *suspended*. - `B` is *unstable* as before. - - -Because nothing outside the obsolete set default on *extinct* -changesets, they can be safely hidden in the UI and even garbage -collected. *Suspended* changesets have to stay visible and available -until their unstable descendant are rewritten into stable version. - - -Conflicting rewrites -```````````````````` - -If people start to concurrently edit the same part of the history they will -likely meet conflicting situations when a changeset has been rewritten in two -different ways. - - -.. figure:: ./figures/error-conflicting.* - - Conflicting rewrite of `A` into `A'` and `A''` - -This kind of conflict is easy to detect with an obsolete marker -because an obsolete changeset can have more than one new version. It -may be seen as the multiple heads case. Mercurial warns you about this -on pull. It is resolved the same way by a merge of A' and A'' that -will keep the same parent than `A'` and `A''` with two obsolete -markers pointing to both `A` and `A'` - -.. figure:: ./figures/explain-troubles-concurrent-10-solution.* - -Allowing multiple new changesets to obsolete a single one allows to -distinguish a split changeset from a history rewriting conflict. - -Reliable history -`````````````````````` - -Obsolete markers help to smooth rewriting operation process. However -they do not change the fact that **you should only rewrite the mutable -part of the history**. The phase concept enforces this rule by -explicitly defining a public immutable set of changesets. Rewriting -operations refuse to work on public changesets, but there are still -some corner cases where previously rewritten changesets are made -public. - -Special rules apply for obsolete markers pointing to public changesets: - -* Public changesets are excluded from the obsolete set (public - changesets are never hidden or candidate to garbage collection) - -* *newer* version of a public changeset are called **bumped** and - highlighted as an error case. - -.. figure:: ./figures/explain-troubles-concurrent-10-sumup.* - -Solving such an error is easy. Because we know what changeset a -*bumped* tries to rewrite, we can easily compute a smaller -changeset containing only the change from the old *public* to the new -*bumped*. - -.. figure:: ./figures/explain-troubles-concurrent-15-solution.* - - -Conclusion ----------------- - -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 which tracks the result of history rewriting operations. - -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, - -- sharing and collaborating on the mutable part of the history, - -- gracefully handling history rewriting conflicts, - -- various history rewriting UI's collaborating with an underlying common API. - -.. list-table:: Comparison on solution [#]_ - :header-rows: 1 - - * - Solution - - Remove changeset locally - - Works on any point of your history - - Propagation - - Collaboration - - Speed - - Access to older version - - * - Strip - - `+` - - `+` - - \ - - \ - - \ - - `- -` - - * - Reference - - `+` - - \ - - `+` - - \ - - `+` - - `-` - - * - Obsolete - - `+` - - `+` - - `++` - - `++` - - `+` - - `+` - - - -.. [#] To preserve good tradition in comparison table, an overwhelming advantage - goes to the defended solution. diff -r eccfd01aec56 -r 8a20b2774a65 docs/obs-implementation.rst --- a/docs/obs-implementation.rst Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - ------------------------------------------------------ -Implementation of Obsolete Marker ------------------------------------------------------ -.. warning:: This document is still in heavy work in progress - -Main questions about Obsolete Marker Implementation ------------------------------------------------------ - - - - -How shall we exchange Marker over the Wire ? -````````````````````````````````````````````````````````` - -We can have a lot of markers. We do not want to exchange data for the one we -already know. Listkey() is not very appropriate there as you get everything. - -Moreover, we might want to only hear about Marker that impact changeset we are -pulling. - -pushkey is not batchable yet (could be fixed) - -A dedicated discovery and exchange protocol seems mandatory here. - - -Various technical details ------------------------------------------------------ - -Some stuff that worse to note. some may deserve their own section later. - -storing old changeset -`````````````````````` - -The new general delta format allows a very efficient storage of two very similar -changesets. Storing obsolete children using general delta takes no more place -than storing the obsolete diff. Reverted file will even we reused. The whole -operation will take much less space the strip backup. - - -Abstraction from history rewriting UI -``````````````````````````````````````````` - -How Mercurial handles obsolete marker is independent from what decides -to create them and what actual operation solves the error case. Any of -the existing history rewriting UI (rebase, mq, histedit) can lay -obsolete markers and resolve situation created by others. To go -further, a hook system of obsolete marker creation would allow each -mechanism to collaborate with other though a standard and central -mechanism. - - -Obsolete marker storage -``````````````````````````` - -The Obsolete marker will most likely be stored outside standard -history. They are multiple reasons for this: - -First, obsolete markers are really perpendicular to standard history -there is no strong reason to include it here other than convenience. - -Second, storing obsolete marker inside standard history means: - -* A changeset must be created every time an obsolete relation is added. Very - inconvenient for delete operation. - -* Obsolete marker must be forged at the creation of the new changeset. This - is very inconvenient for split operation. And in general it becomes - complicated to fix history afterward in particular when working with older - clients. - -Storing obsolete marker outside history have several pros: - -* It eases Exchange of obsolete markers without unnecessary obsolete - changeset contents. - -* It allows tuning the actual storage and protocol exchange while maintaining - compatibility with older clients through the wire (as we do the repository - format). - -* It eases the exchange of obsolete related information during - discovery to exchange obsolete changeset relevant to conflict - resolution. Exchanging such information deserves a dedicated - protocol. - -Persistent -``````````````````````` - -*Extinct* changeset and obsolete marker will most likely be garbage collected as -some point. However, archive server may decide to keep them forever in order to -keep a fully auditable history in its finest conception. - - -Current status ------------------------------------------------------ - -Obsolete marker are partialy in core. - -2.3: - -- storage over obsolete marker -- exchange suing pushkey -- extinct changeset are properly hidden -- extinct changeset are excluded from exchange diff -r eccfd01aec56 -r 8a20b2774a65 docs/obs-terms.rst --- a/docs/obs-terms.rst Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/obs-terms.rst Tue Jun 23 16:49:53 2015 -0700 @@ -1,12 +1,12 @@ .. Copyright 2011 Pierre-Yves David .. Logilab SA ------------------------------------------------------------ +----------------------------------- Terminology of the obsolete concept ------------------------------------------------------------ +----------------------------------- Obsolete markers ---------------------------------- +---------------- The mutable concept is based on **obsolete markers**. Creating an obsolete marker registers a relation between an old obsoleted changeset and its newer @@ -54,7 +54,7 @@ better distinction between *direct successors* and **any successors**. Possible changesets "type" ---------------------------------- +-------------------------- The following table describes names and behaviors of changesets affected by obsolete markers. The left column describes generic categories and the right @@ -182,7 +182,7 @@ Command and operation name ---------------------------------- +-------------------------- Existing terms @@ -196,7 +196,7 @@ Uncommit -````````````` +```````` Remove files from a commit (and leave them as dirty in the working directory) @@ -204,14 +204,14 @@ `rollback` usage. Fold -`````````` +```` Collapse multiple changesets into a unique one. The *evolve* extension will have a `fold` command. Prune -`````````` +````` Make a changeset obsolete without successors. @@ -223,7 +223,7 @@ - obsolete: too vague, too long and too generic. evolve -``````````````` +`````` Automatically resolve *troublesome* changesets (*unstable*, *bumped* and *divergent*) diff -r eccfd01aec56 -r 8a20b2774a65 docs/qsync.rst --- a/docs/qsync.rst Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -.. Copyright 2011 Pierre-Yves David -.. Logilab SA - ---------------------------------------------------------------------- -Qsync: Mercurial to MQ exporter ---------------------------------------------------------------------- - - -People may have tools or co-workers that export to receive mutable history using -a versioned mq repository. - -For this purpose you can use the ``qsync`` extension: - - -To enable the evolve extension use:: - - $ hg clone http://hg-dev.octopoid.net/hgwebdir.cgi/mutable-history/ - $ mutable-history/iqsync-enable.sh >> ~/.hgrc - $ hg help qsync diff -r eccfd01aec56 -r 8a20b2774a65 docs/sharing.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/sharing.rst Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,735 @@ +.. Copyright © 2014 Greg Ward + +------------------------------ +Evolve: Shared Mutable History +------------------------------ + +.. contents:: + +Once you have mastered the art of mutable history in a single +repository (see the `user guide`_), you can 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. + +.. _`user guide`: user-guide.html + +The simplest 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 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, +typically for code review. We'll cover this scenario later. But first, +single-user sharing. + +Sharing with a single developer +------------------------------- + +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 up +========== + +We'll work through 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 synchronize with the rest of your team. :: + + $ hg init public + +We'll need two clones where work gets done, ``test-repo`` and +``dev-repo``:: + + $ hg clone public test-repo + updating to branch default + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg clone test-repo dev-repo + updating to branch default + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +``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 shared mutable history is to make the target repository, in +this case ``test-repo``, non-publishing. And, of course, we have to +enable ``evolve`` in both ``test-repo`` and ``dev-repo``. + +First, edit the configuration for ``test-repo``:: + + $ hg -R test-repo config --edit --local + +and add :: + + [phases] + publish = false + + [extensions] + evolve = /path/to/mutable-history/hgext/evolve.py + +Then edit the configuration for ``dev-repo``:: + + $ hg -R dev-repo config --edit --local + +and add :: + + [extensions] + evolve = /path/to/mutable-history/hgext/evolve.py + +Keep in mind that in real life, these repositories would probably be +on separate computers, so you'd have to login to each one to configure +each repository. + +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 + [...] + added 1 changesets with 1 changes to 1 files + +and pull that into the development repository:: + + $ cd ../dev-repo + $ hg pull -u + [...] + added 1 changesets with 1 changes to 1 files + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Example 1: Amend 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: test-repo has rev 0:0dc9 public, rev 1:f649, 2:2a03 obsolete, rev 3:60ff draft; dev-repo same as in SG01] + +Let's resynchronize:: + + $ cd ../dev-repo + $ hg pull -u + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +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 hidden. Push and pull +transfer obsolesence markers between repositories, but they do not +transfer hidden 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. + +Example 2: 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 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +This time, all the tests pass, so no further amending 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 doesn't transfer +hidden changesets on push and pull. + +.. _`concept guide`: concepts.html + +So the picture in ``public`` is much simpler than in either +``dev-repo`` or ``test-repo``. Neither our missteps nor our amendments +are publicly visible, 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`` has been out-of-the-loop; +changeset de61 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 pushing up to +``dev-repo``:: + + $ hg push ../dev-repo + pushing to ../dev-repo + searching for changes + no changes found + +Even though no *changesets* were pushed, Mercurial still pushed +obsolescence markers and phase changes to ``dev-repo``. + +A final note: since this fix is now *public*, it is immutable. It's no +longer possible to amend it:: + + $ hg amend -m 'fix bug 37' + abort: cannot amend public changesets + +This is, after all, the whole point of Mercurial's phases: to prevent +rewriting history that has already been published. + +Sharing with multiple developers: code review +--------------------------------------------- + +Now that you know how to share your own mutable history across +multiple computers, you might be wondering if it makes sense to share +mutable history with others. It does, but you have to be careful, stay +alert, and *communicate* with your peers. + +Code review is a good use case for sharing mutable history across +multiple developers: Alice commits a draft changeset, submits it for +review, and amends her changeset until her reviewer is satisfied. +Meanwhile, Bob is also committing draft changesets for review, +amending until his reviewer is satisfied. Once a particular changeset +passes review, the respective author (Alice or Bob) pushes it to the +public (publishing) repository. + +Incidentally, the reviewers here can be anyone: maybe Bob and Alice +review each other's work; maybe the same third party reviews both; or +maybe they pick different experts to review their work on different +parts of a large codebase. Similarly, it doesn't matter if reviews are +conducted in person, by email, or by carrier pigeon. Code review is +outside of the scope of Mercurial, so all we're looking at here +is the mechanics of committing, amending, pushing, and pulling. + +Setting up +========== + +To demonstrate, let's start with the ``public`` repository as we left +it in the last example, with two immutable changesets (figure 5 +above). We'll clone a ``review`` repository from it, and then Alice +and Bob will both clone from ``review``. :: + + $ hg clone public review + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg clone review alice + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg clone review bob + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +We need to configure Alice's and Bob's working repositories to enable +``evolve``. First, edit Alice's configuration with :: + + $ hg -R alice config --edit --local + +and add :: + + [extensions] + evolve = /path/to/mutable-history/hgext/evolve.py + +Then edit Bob's repository configuration:: + + $ hg -R bob config --edit --local + +and add the same text. + +Example 3: Alice commits and amends a draft fix +=============================================== + +We'll follow Alice working on a bug fix. We're going to use bookmarks to +make it easier to understand multiple branch heads in the ``review`` +repository, so Alice starts off by creating a bookmark and committing +her first attempt at a fix:: + + $ hg bookmark bug15 + $ echo 'fix' > file2 + $ hg commit -A -u alice -m 'fix bug 15 (v1)' + adding file2 + +Note the unorthodox "(v1)" in the commit message. We're just using +that to make this tutorial easier to follow; it's not something we'd +recommend in real life. + +Of course Alice wouldn't commit unless her fix worked to her +satisfaction, so it must be time to solicit a code review. She does +this by pushing to the ``review`` repository:: + + $ hg push -B bug15 + [...] + added 1 changesets with 1 changes to 1 files + exporting bookmark bug15 + +(The use of ``-B`` is important to ensure that we only push the +bookmarked head, and that the bookmark itself is pushed. See this +`guide to bookmarks`_, especially the `Sharing Bookmarks`_ section, if +you're not familiar with bookmarks.) + +.. _`guide to bookmarks`: http://mercurial.aragost.com/kick-start/en/bookmarks/ +.. _`Sharing Bookmarks`: http://mercurial.aragost.com/kick-start/en/bookmarks/#sharing-bookmarks + +Some time passes, and Alice receives her code review. As a result, +Alice revises her fix and submits it for a second review:: + + $ echo 'Fix.' > file2 + $ hg amend -m 'fix bug 15 (v2)' + $ hg push + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + updating bookmark bug15 + +Figure 6 shows the state of the ``review`` repository at this point. + + [figure SG06: rev 2:fn1e is Alice's obsolete v1, rev 3:cbdf is her v2; both children of rev 1:de61] + +After a busy morning of bug fixing, Alice stops for lunch. Let's see +what Bob has been up to. + +Example 4: Bob implements and publishes a new feature +===================================================== + +Meanwhile, Bob has been working on a new feature. Like Alice, he'll +use a bookmark to track his work, and he'll push that bookmark to the +``review`` repository, so that reviewers know which changesets to +review. :: + + $ cd ../bob + $ echo 'stuff' > file1 + $ hg bookmark featureX + $ hg commit -u bob -m 'implement feature X (v1)' # rev 4:1636 + $ hg push -B featureX + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + exporting bookmark featureX + +When Bob receives his code review, he improves his implementation a +bit, amends, and submits the resulting changeset for review:: + + $ echo 'do stuff' > file1 + $ hg amend -m 'implement feature X (v2)' # rev 5:0eb7 + $ hg push + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + updating bookmark featureX + +Unfortunately, that still doesn't pass muster. Bob's reviewer insists +on proper capitalization and punctuation. :: + + $ echo 'Do stuff.' > file1 + $ hg amend -m 'implement feature X (v3)' # rev 6:540b + +On the bright side, the second review said, "Go ahead and publish once +you fix that." So Bob immediately publishes his third attempt:: + + $ hg push ../public + [...] + added 1 changesets with 1 changes to 1 files + +It's not enough just to update ``public``, though! Other people also +use the ``review`` repository, and right now it doesn't have Bob's +latest amendment ("v3", revision 6:540b), nor does it know that the +precursor of that changeset ("v2", revision 5:0eb7) is obsolete. Thus, +Bob pushes to ``review`` as well:: + + $ hg push ../review + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + updating bookmark featureX + +Figure 7 shows the result of Bob's work in both ``review`` and +``public``. + + [figure SG07: review includes Alice's draft work on bug 15, as well as Bob's v1, v2, and v3 changes for feature X: v1 and v2 obsolete, v3 public. public contains only the final, public implementation of feature X] + +Incidentally, it's important that Bob push to ``public`` *before* +``review``. If he pushed to ``review`` first, then revision 6:540b +would still be in *draft* phase in ``review``, but it would be +*public* in both Bob's local repository and the ``public`` repository. +That could lead to confusion at some point, which is easily avoided by +pushing first to ``public``. + +Example 5: Alice integrates and publishes +========================================= + +Finally, Alice gets back from lunch and sees that the carrier pigeon +with her second review has arrived (or maybe it's in her email inbox). +Alice's reviewer approved her amended changeset, so she pushes it to +``public``:: + + $ hg push ../public + [...] + remote has heads on branch 'default' that are not known locally: 540ba8f317e6 + abort: push creates new remote head cbdfbd5a5db2! + (pull and merge or see "hg help push" for details about pushing new heads) + +Oops! Bob has won the race to push first to ``public``. So Alice needs +to integrate with Bob: let's pull his changeset(s) and see what the +branch heads are. :: + + $ hg pull ../public + [...] + added 1 changesets with 1 changes to 1 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + $ hg log -G -q -r 'head()' --template '{rev}:{node|short} ({author})\n' + o 5:540ba8f317e6 (bob) + | + | @ 4:cbdfbd5a5db2 (alice) + |/ + +We'll assume Alice and Bob are perfectly comfortable with rebasing +changesets. (After all, they're already using mutable history in the +form of ``amend``.) So Alice rebases her changeset on top of Bob's and +publishes the result:: + + $ hg rebase -d 5 + $ hg push ../public + [...] + added 1 changesets with 1 changes to 1 files + $ hg push ../review + [...] + added 1 changesets with 0 changes to 0 files + updating bookmark bug15 + +The result, in both ``review`` and ``public`` repositories, is shown +in figure 8. + + [figure SG08: review shows v1 and v2 of Alice's fix, then v1, v2, v3 of Bob's feature, finally Alice's fix rebased onto Bob's. public just shows the final public version of each changeset] + +Getting into trouble with shared mutable history +------------------------------------------------ + +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 happen: *divergent* and *bumped* +changesets. Both are more likely with shared mutable history, +especially mutable history shared by multiple developers. + +Setting up +========== + +For these examples, we're going to use a slightly different workflow: +as before, Alice and Bob share a ``public`` repository. But this time +there is no ``review`` repository. Instead, Alice and Bob put on their +cowboy hats, throw good practice to the wind, and pull directly from +each other's working repositories. + +So we throw away everything except ``public`` and reclone:: + + $ rm -rf review alice bob + $ hg clone public alice + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg clone public bob + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Once again we have to configure their repositories: enable ``evolve`` +and (since Alice and Bob will be pulling directly from each other) +make their repositories non-publishing. Edit Alice's configuration:: + + $ hg -R alice config --edit --local + +and add :: + + [extensions] + rebase = + evolve = /path/to/mutable-history/hgext/evolve.py + + [phases] + publish = false + +Then edit Bob's repository configuration:: + + $ hg -R bob config --edit --local + +and add the same text. + +Example 6: Divergent changesets +=============================== + +When an obsolete changeset has two successors, those successors are +*divergent*. One way to get into such a situation is by failing to +communicate with your teammates. Let's see how that might happen. + +First, 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)' # rev 4:2fe6 + +Since Alice and Bob are now in cowboy mode, Alice pulls Bob's draft +changeset and amends it herself. :: + + $ cd ../alice + $ hg pull -u ../bob + [...] + added 1 changesets with 1 changes to 1 files + $ echo 'better fix (alice)' >> file1 + $ hg amend -u alice -m 'fix bug 24 (v2 by alice)' + +But Bob has no idea that Alice just did this. (See how important good +communication is?) So he implements a better fix of his own:: + + $ cd ../bob + $ echo 'better fix (bob)' >> file1 + $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' # rev 6:a360 + +At this point, the divergence exists, but only in theory: Bob's +original changeset, 4:2fe6, 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 Bob pulls from Alice's +repository (or vice-versa). :: + + $ hg pull ../alice + [...] + added 1 changesets with 1 changes to 2 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + 2 new divergent changesets + +Figure 9 shows the situation in Bob's repository. + + [figure SG09: Bob's repo with 2 heads for the 2 divergent changesets, 6:a360 and 7:e3f9; wc is at 6:a360; both are successors of obsolete 4:2fe6, hence divergence] + +Now we need to get out of trouble. As usual, the answer is to evolve +history. :: + + $ HGMERGE=internal:other hg evolve + merge:[6] fix bug 24 (v2 by bob) + with: [7] fix bug 24 (v2 by alice) + base: [4] fix bug 24 (v1) + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + +Figure 10 shows how Bob's repository looks now. + + [figure SG10: only one visible head, 9:5ad6, successor to hidden 6:a360 and 7:e3f9] + +We carefully dodged a merge conflict by specifying a merge tool +(``internal:other``) that will take Alice's changes over Bob's. (You +might wonder why Bob wouldn't prefer his own changes by using +``internal:local``. He's avoiding a `bug`_ in ``evolve`` that occurs +when evolving divergent changesets using ``internal:local``.) + +.. _`bug`: https://bitbucket.org/marmoute/mutable-history/issue/48/ + +** STOP HERE: WORK IN PROGRESS ** + +Bumped changesets: only one gets on the plane +============================================= + +If two people show up at the airport with tickets for the same seat on +the same plane, only one of them gets on the plane. The would-be +traveller left behind in the airport terminal is said to have been +*bumped*. + +Similarly, if Alice and Bob are collaborating on some mutable +changesets, it's possible to get into a situation where an otherwise +worthwhile changeset cannot be pushed to the public repository; it is +bumped by an alternative changeset that happened to get there first. +Let's demonstrate one way this could happen. + +It starts with Alice committing a bug fix. Right now, we don't yet +know if this bug fix is good enough to push to the public repository, +but it's good enough for Alice to commit. :: + + $ cd alice + $ echo 'fix' > file2 + $ hg commit -A -m 'fix bug 15' + adding file2 + +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 -u ../alice + [...] + added 1 changesets with 1 changes to 1 files + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo 'Fix.' > file2 + $ hg amend -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 + [...] + added 1 changesets with 1 changes to 1 files + +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] + +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 eccfd01aec56 -r 8a20b2774a65 docs/tutorials/tutorial.t --- a/docs/tutorials/tutorial.t Tue Jun 23 16:47:47 2015 -0700 +++ b/docs/tutorials/tutorial.t Tue Jun 23 16:49:53 2015 -0700 @@ -1,775 +1,1 @@ - -Initial setup -------------- - -This Mercurial configuration example is used for testing. -.. Various setup - - $ cat >> $HGRCPATH << EOF - > [ui] - > logtemplate ="{node|short} ({phase}): {desc}\n" - > [diff] - > git = 1 - > [alias] - > # "-d '0 0'" means that the new commit will be at January 1st 1970. - > # This is used for stable hash during test - > amend = amend -d '0 0' - > [extensions] - > hgext.graphlog= - > EOF - - $ hg init local - $ cat >> local/.hg/hgrc << EOF - > [paths] - > remote = ../remote - > other = ../other - > [ui] - > user = Babar the King - > EOF - - $ hg init remote - $ cat >> remote/.hg/hgrc << EOF - > [paths] - > local = ../local - > [ui] - > user = Celestine the Queen - > EOF - - $ hg init other - $ cat >> other/.hg/hgrc << EOF - > [ui] - > user = Princess Flore - > EOF - - -This tutorial use the following configuration for Mercurial: - -A compact log template with phase data: - - $ hg showconfig ui - ui.slash=True - ui.logtemplate="{node|short} ({phase}): {desc}\n" - -Improved git format diff: - - $ hg showconfig diff - diff.git=1 - -And the graphlog extension - $ hg showconfig extensions - extensions.hgext.graphlog= - -And of course, we anabled the experimental extensions for mutable history: - - $ $(dirname $TESTDIR)/enable.sh >> $HGRCPATH 2> /dev/null - - ------------------------ -Single Developer Usage ------------------------ - -This tutorial shows how to use evolution to rewrite history locally. - - -Fixing mistake with `hg amend` --------------------------------- - -We are versionning a shopping list - - $ cd local - $ cat >> shopping << EOF - > Spam - > Whizzo butter - > Albatross - > Rat (rather a lot) - > Jugged fish - > Blancmange - > Salmon mousse - > EOF - $ hg commit -A -m "Monthy Python Shopping list" - adding shopping - -Its first version is shared with the outside. - - $ hg push remote - pushing to $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - -Later I add additional item to my list - - $ cat >> shopping << EOF - > Egg - > Suggar - > Vinegar - > Oil - > EOF - $ hg commit -m "adding condiment" - $ cat >> shopping << EOF - > Bananos - > Pear - > Apple - > EOF - $ hg commit -m "adding fruit" - -This history is very linear - - $ hg glog - @ d85de4546133 (draft): adding fruit - | - o 4d5dc8187023 (draft): adding condiment - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -But a typo was made in Babanas! - - $ hg export tip - # HG changeset patch - # User test - # Date 0 0 - # Node ID d85de4546133030c82d257bbcdd9b1b416d0c31c - # Parent 4d5dc81870237d492284826e21840b2ca00e26d1 - adding fruit - - diff --git a/shopping b/shopping - --- a/shopping - +++ b/shopping - @@ -9,3 +9,6 @@ - Suggar - Vinegar - Oil - +Bananos - +Pear - +Apple - -The faulty changeset is in the "draft" phase because he was not exchanged with -the outside. The first one have been exchanged and is an immutable public -changeset. - - $ hg glog - @ d85de4546133 (draft): adding fruit - | - o 4d5dc8187023 (draft): adding condiment - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -hopefully. I can use hg amend to rewrite my faulty changeset! - - $ sed -i'' -e s/Bananos/Banana/ shopping - $ hg diff - diff --git a/shopping b/shopping - --- a/shopping - +++ b/shopping - @@ -9,6 +9,6 @@ - Suggar - Vinegar - Oil - -Bananos - +Banana - Pear - Apple - $ hg amend - -A new changeset with the right diff replace the wrong one. - - $ hg glog - @ 0cacb48f4482 (draft): adding fruit - | - o 4d5dc8187023 (draft): adding condiment - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - $ hg export tip - # HG changeset patch - # User test - # Date 0 0 - # Node ID 0cacb48f44828d2fd31c4e45e18fde32a5b2f07b - # Parent 4d5dc81870237d492284826e21840b2ca00e26d1 - adding fruit - - diff --git a/shopping b/shopping - --- a/shopping - +++ b/shopping - @@ -9,3 +9,6 @@ - Suggar - Vinegar - Oil - +Banana - +Pear - +Apple - -Getting Ride of branchy history ----------------------------------- - -While I was working on my list. someone help made a change remotly. - - $ cd ../remote - $ hg up -q - $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping - $ hg ci -m 'SPAM' - $ cd ../local - -I'll get this remote changeset when pulling - - $ hg pull remote - pulling from $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) - (run 'hg heads .' to see heads, 'hg merge' to merge) - -I now have a new heads. Note that this remote head is immutable - - $ hg log -G - o 9ca060c80d74 (public): SPAM - | - | @ 0cacb48f4482 (draft): adding fruit - | | - | o 4d5dc8187023 (draft): adding condiment - |/ - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -instead of merging my head with the new one. I'm going to rebase my work - - $ hg diff - $ hg rebase -d 9ca060c80d74 -s 4d5dc8187023 - merging shopping - merging shopping - - -My local work is now rebased on the remote one. - - $ hg log -G - @ 387187ad9bd9 (draft): adding fruit - | - o dfd3a2d7691e (draft): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -Removing changeset ------------------------- - -I add new item to my list - - $ cat >> shopping << EOF - > car - > bus - > plane - > boat - > EOF - $ hg ci -m 'transport' - $ hg log -G - @ d58c77aa15d7 (draft): transport - | - o 387187ad9bd9 (draft): adding fruit - | - o dfd3a2d7691e (draft): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -I have a new commit but I realize that don't want it. (transport shop list does -not fit well in my standard shopping list) - - $ hg prune . # . is for working directory parent - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory now at 387187ad9bd9 - -The silly changeset is gone. - - $ hg log -G - @ 387187ad9bd9 (draft): adding fruit - | - o dfd3a2d7691e (draft): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -Reordering changeset ------------------------- - - -We create two changesets. - - - $ cat >> shopping << EOF - > Shampoo - > Toothbrush - > ... More bathroom stuff to come - > Towel - > Soap - > EOF - $ hg ci -m 'bathroom stuff' -q # XXX remove the -q - - $ sed -i'' -e 's/Spam/Spam Spam Spam/g' shopping - $ hg ci -m 'SPAM SPAM' - $ hg log -G - @ c48f32fb1787 (draft): SPAM SPAM - | - o 8d39a843582d (draft): bathroom stuff - | - o 387187ad9bd9 (draft): adding fruit - | - o dfd3a2d7691e (draft): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -.. note: don't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are immutable. - -I now want to push to remote all my change but the bathroom one that i'm not -totally happy with yet. To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" not children of -"bathroom stuff" - -You can use 'rebase -r' or 'graft -O' for that: - - $ hg up 'p1(8d39a843582d)' # going on "bathroom stuff" parent - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg graft -O c48f32fb1787 # moving "SPAM SPAM" to the working directory parent - grafting revision 10 - merging shopping - $ hg log -G - @ a2fccc2e7b08 (draft): SPAM SPAM - | - | o 8d39a843582d (draft): bathroom stuff - |/ - o 387187ad9bd9 (draft): adding fruit - | - o dfd3a2d7691e (draft): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -We have a new SPAM SPAM version without the bathroom stuff - - $ grep Spam shopping # enouth spam - Spam Spam Spam Spam Spam Spam Spam Spam Spam - $ grep Toothbrush shopping # no Toothbrush - [1] - $ hg export . - # HG changeset patch - # User test - # Date 0 0 - # Node ID a2fccc2e7b08bbce6af7255b989453f7089e4cf0 - # Parent 387187ad9bd9d8f9a00a9fa804a26231db547429 - SPAM SPAM - - diff --git a/shopping b/shopping - --- a/shopping - +++ b/shopping - @@ -1,4 +1,4 @@ - -Spam Spam Spam - +Spam Spam Spam Spam Spam Spam Spam Spam Spam - Whizzo butter - Albatross - Rat (rather a lot) - -To make sure I do not push unready changeset by mistake I set the "bathroom -stuff" changeset in the secret phase. - - $ hg phase --force --secret 8d39a843582d - -we can now push our change: - - $ hg push remote - pushing to $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 3 changesets with 3 changes to 1 files - -for simplicity shake we get the bathroom change in line again - - $ hg rebase -r 8d39a843582d -d a2fccc2e7b08 - merging shopping - $ hg phase --draft . - $ hg log -G - @ 8a79ae8b029e (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - - -Splitting change ------------------- - -To be done (currently achieve with "two commit + debugobsolete") - -Collapsing change ------------------- - -To be done (currently achieve with "revert + debugobsolete" or "rebase --collapse") - - - - - - ------------------------ -Collaboration ------------------------ - - -sharing mutable changeset ----------------------------- - -To share mutable changeset with other just check that the repo you interact -with is "not publishing". Otherwise you will get the previously observe -behavior where exchanged changeset are automatically published. - - $ cd ../remote - $ hg -R ../local/ showconfig phases - -the localrepo does not have any specific configuration for `phases.publish`. It -is ``true`` by default. - - $ hg pull local - pulling from $TESTTMP/local - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - (run 'hg update' to get a working copy) - $ hg log -G - o 8a79ae8b029e (public): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - @ 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - - -We do not want to publish the "bathroom changeset". Let's rollback the last transaction - - $ hg rollback - repository tip rolled back to revision 4 (undo pull) - $ hg log -G - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - @ 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -Let's make the local repo "non publishing" - - $ echo '[phases]' >> ../local/.hg/hgrc - $ echo 'publish=false' >> ../local/.hg/hgrc - $ echo '[phases]' >> .hg/hgrc - $ echo 'publish=false' >> .hg/hgrc - $ hg showconfig phases - phases.publish=false - $ hg -R ../local/ showconfig phases - phases.publish=false - - -I can now exchange mutable changeset between "remote" and "local" repository. - - $ hg pull local - pulling from $TESTTMP/local - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - (run 'hg update' to get a working copy) - $ hg log -G - o 8a79ae8b029e (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - @ 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -Rebasing unstable change after pull ----------------------------------------------- - -Remotely someone add a new changeset on top of the mutable "bathroom" on. - - $ hg up 8a79ae8b029e -q - $ cat >> shopping << EOF - > Giraffe - > Rhino - > Lion - > Bear - > EOF - $ hg ci -m 'animals' - -But at the same time, locally, this same "bathroom changeset" was updated. - - $ cd ../local - $ hg up 8a79ae8b029e -q - $ sed -i'' -e 's/... More bathroom stuff to come/Bath Robe/' shopping - $ hg amend - $ hg log -G - @ ffa278c50818 (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - -When we pull from remote again we get an unstable state! - - - $ hg pull remote - pulling from $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) - (run 'hg heads .' to see heads, 'hg merge' to merge) - 1 new unstables changesets - - -The new changeset "animal" is based one an old changeset of "bathroom". You can -see both version showing up in the log. - - $ hg log -G - o 9ac5d0e790a2 (draft): animals - | - | @ ffa278c50818 (draft): bathroom stuff - | | - x | 8a79ae8b029e (draft): bathroom stuff - |/ - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -The older version 8a79ae8b029e never ceased to exist in the local repo. It was -jsut hidden and excluded from pull and push. - -.. note:: In hgview there is a nice doted relation highlighting ffa278c50818 as a new version of 8a79ae8b029e. this is not yet ported to graphlog. - -Their is **unstable** changeset in this history now. Mercurial will refuse to -share it with the outside: - - $ hg push other - pushing to $TESTTMP/other - searching for changes - abort: push includes an unstable changeset: 9ac5d0e790a2! - (use 'hg stabilize' to get a stable history or --force to ignore warnings) - [255] - - - - -To resolve this unstable state, you need to rebase 9ac5d0e790a2 onto -ffa278c50818 the "hg stabilize" command will make this for you. - -It has a --dry-run option to only suggest the next move. - - $ hg stabilize --dry-run - move:[15] animals - atop:[14] bathroom stuff - hg rebase -r 9ac5d0e790a2 -d ffa278c50818 - -Let's do it - - $ hg rebase -r 9ac5d0e790a2 -d ffa278c50818 - merging shopping - -The old version of bathroom is hidden again. - - $ hg log -G - @ 437efbcaf700 (draft): animals - | - o ffa278c50818 (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - -We can push this evolution to remote - - $ hg push remote - pushing to $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 2 changesets with 2 changes to 1 files (+1 heads) - -remote get a warning that current working directory is based on an obsolete changeset - - $ cd ../remote - $ hg pull local # we up again to trigger the warning. it was displayed during the push - pulling from $TESTTMP/local - searching for changes - no changes found - Working directory parent is obsolete - - $ hg up 437efbcaf700 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - -Relocating unstable change after prune ----------------------------------------------- - -The remote guy keep working - - $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping - $ hg commit -m "SPAM SPAM SPAM" - -I'm pulling its work locally. - - $ cd ../local - $ hg pull remote - pulling from $TESTTMP/remote - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - (run 'hg update' to get a working copy) - $ hg log -G - o ae45c0c3092a (draft): SPAM SPAM SPAM - | - @ 437efbcaf700 (draft): animals - | - o ffa278c50818 (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - -In the mean time I noticed you can't buy animals in a super market and I prune the animal changeset: - - $ hg prune 437efbcaf700 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory now at ffa278c50818 - 1 new unstables changesets - - -The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset -is neither dead or obsolete. My repository is in an unstable state again. - - $ hg log -G - o ae45c0c3092a (draft): SPAM SPAM SPAM - | - x 437efbcaf700 (draft): animals - | - @ ffa278c50818 (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - $ hg log -r 'unstable()' - ae45c0c3092a (draft): SPAM SPAM SPAM - -# XXX make prune stabilization works -# $ hg stabilize --any -# merging shopping - - $ hg graft -O ae45c0c3092a - grafting revision 17 - merging shopping - - $ hg log -G - @ 20de1fb1cec5 (draft): SPAM SPAM SPAM - | - o ffa278c50818 (draft): bathroom stuff - | - o a2fccc2e7b08 (public): SPAM SPAM - | - o 387187ad9bd9 (public): adding fruit - | - o dfd3a2d7691e (public): adding condiment - | - o 9ca060c80d74 (public): SPAM - | - o 7e82d3f3c2cb (public): Monthy Python Shopping list - - - -Handling Conflicting amend ----------------------------------------------- - -We can detect that multiple diverging//conflicting amend have been made. There -will be a "evol-merge" command to merge conflicting amend - -This command is not ready yet. +../../tests/test-tutorial.t \ No newline at end of file diff -r eccfd01aec56 -r 8a20b2774a65 docs/user-guide.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/user-guide.rst Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,601 @@ +.. 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 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. + + +Understanding revision numbers and hidden changesets +==================================================== + +As the name implies, hidden changesets are normally not visible. If +you run ``hg log`` on the repository from Figure 2, Mercurial will +show revisions 0 and 3, but not 1 and 2. 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 0 is followed by revision 3, that means there are two hidden +changesets, 1 and 2, in between. + +To see those hidden changesets, use the ``--hidden`` option:: + + $ hg --hidden log --graph --template '{rev}:{node|short} {desc|firstline}\n' + @ 3:934359450037 implement feature Y + | + | x 2:6c5f78d5d467 temporary amend commit for fe0ecd3bd2a4 + | | + | x 1:fe0ecd3bd2a4 implement feature Y + |/ + o 0:08c4b6f4efc8 init + +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. + + +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 +====================== + +So far, every obsolete changeset we have seen is also hidden. However, +these are *not* the same thing—that's why they have different names. +It's entirely possible to have obsolete changesets that are not +hidden. We'll see examples of that soon, when we create *unstable* +changesets. + +Note that all hidden changesets are obsolete: hidden is a subset of +obsolete. + + +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 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: you cannot fix it.) + +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 on 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 +========================================= + +Sometimes you might obsolete a changeset, and then change your mind. You'll +probably start looking for an “unobsolete” command to restore a changeset +to normal state. For complicated implementation reasons, that command +doesn't exist. (If you have already pushed an obsolescence marker to +another repo, then Mercurial would need a way to revoke that remote +obsolesence marker. That's a hard problem.) + +Instead, ``evolve`` provides a ``touch`` command to resurrect an +obsolete changeset. An unexpected quirk: you almost certainly need to +use ``--hidden``, since obsolete changesets tend to be hidden, and you +can't reference a hidden changeset otherwise. Typical usage thus looks +like :: + + $ hg --hidden touch REV + +This creates a new, normal changeset which is the same as ``REV``—except +with a different changeset ID. The new changeset will have the same parent +as ``REV``, and will be a successor of ``REV``. + +The current implementation of ``hg touch`` is not ideal, and is likely to +change in the future. Consider the history in Figure 12, where revision 27 +is obsolete and the child of 26, also obsolete. If we ``hg touch 27``, that +creates a new revision which is a non-obsolete child of 26—i.e., it is +unstable. It's also *divergent*, another type of trouble that we'll learn +about in the `next section`_. + +.. _`next section`: sharing.html diff -r eccfd01aec56 -r 8a20b2774a65 hgext/drophack.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/drophack.py Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,162 @@ +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +'''This extension add a hacky command to drop changeset during review + +This extension is intended as a temporary hack to allow Matt Mackall to use +evolve in the Mercurial review it self. You should probably not use it if your +name is not Matt Mackall. +''' + +import os +import time +import contextlib + +from mercurial.i18n import _ +from mercurial import cmdutil +from mercurial import repair +from mercurial import scmutil +from mercurial import lock as lockmod +from mercurial import util +from mercurial import commands + +cmdtable = {} +command = cmdutil.command(cmdtable) + + +@contextlib.contextmanager +def timed(ui, caption): + ostart = os.times() + cstart = time.time() + yield + cstop = time.time() + ostop = os.times() + wall = cstop - cstart + user = ostop[0] - ostart[0] + sys = ostop[1] - ostart[1] + comb = user + sys + ui.write("%s: wall %f comb %f user %f sys %f\n" + % (caption, wall, comb, user, sys)) + +def obsmarkerchainfrom(obsstore, nodes): + """return all marker chain starting from node + + Starting from mean "use as successors".""" + # XXX need something smarter for descendant of bumped changeset + seennodes = set(nodes) + seenmarkers = set() + pendingnodes = set(nodes) + precursorsmarkers = obsstore.precursors + while pendingnodes: + current = pendingnodes.pop() + new = set() + for precmark in precursorsmarkers.get(current, ()): + if precmark in seenmarkers: + continue + seenmarkers.add(precmark) + new.add(precmark[0]) + yield precmark + new -= seennodes + pendingnodes |= new + +def stripmarker(ui, repo, markers): + """remove from the repo obsstore + + The old obsstore content is saved in a `obsstore.prestrip` file + """ + repo = repo.unfiltered() + repo.destroying() + oldmarkers = list(repo.obsstore._all) + util.rename(repo.sjoin('obsstore'), + repo.join('obsstore.prestrip')) + del repo.obsstore # drop the cache + newstore = repo.obsstore + assert not newstore # should be empty after rename + newmarkers = [m for m in oldmarkers if m not in markers] + tr = repo.transaction('drophack') + try: + newstore.add(tr, newmarkers) + tr.close() + finally: + tr.release() + repo.destroyed() + + +@command('drop', [('r', 'rev', [], 'revision to update')], _('[-r] revs')) +def cmddrop(ui, repo, *revs, **opts): + """I'm hacky do not use me! + + This command strip a changeset, its precursors and all obsolescence marker + associated to its chain. + + There is no way to limit the extend of the purge yet. You may have to + repull from other source to get some changeset and obsolescence marker + back. + + This intended for Matt Mackall usage only. do not use me. + """ + revs = list(revs) + revs.extend(opts['rev']) + if not revs: + revs = ['.'] + # get the changeset + revs = scmutil.revrange(repo, revs) + if not revs: + ui.write_err('no revision to drop\n') + return 1 + # lock from the beginning to prevent race + wlock = lock = None + try: + wlock = repo.wlock() + lock = repo.lock() + # check they have no children + if repo.revs('%ld and public()', revs): + ui.write_err('cannot drop public revision') + return 1 + if repo.revs('children(%ld) - %ld', revs, revs): + ui.write_err('cannot drop revision with children') + return 1 + if repo.revs('. and %ld', revs): + newrevs = repo.revs('max(::. - %ld)', revs) + if newrevs: + assert len(newrevs) == 1 + newrev = newrevs.first() + else: + newrev = -1 + commands.update(ui, repo, newrev) + ui.status(_('working directory now at %s\n') % repo[newrev]) + # get all markers and successors up to root + nodes = [repo[r].node() for r in revs] + with timed(ui, 'search obsmarker'): + markers = set(obsmarkerchainfrom(repo.obsstore, nodes)) + ui.write('%i obsmarkers found\n' % len(markers)) + cl = repo.unfiltered().changelog + with timed(ui, 'search nodes'): + allnodes = set(nodes) + allnodes.update(m[0] for m in markers if cl.hasnode(m[0])) + ui.write('%i nodes found\n' % len(allnodes)) + cl = repo.changelog + visiblenodes = set(n for n in allnodes if cl.hasnode(n)) + # check constraint again + if repo.revs('%ln and public()', visiblenodes): + ui.write_err('cannot drop public revision') + return 1 + if repo.revs('children(%ln) - %ln', visiblenodes, visiblenodes): + ui.write_err('cannot drop revision with children') + return 1 + + if markers: + # strip them + with timed(ui, 'strip obsmarker'): + stripmarker(ui, repo, markers) + # strip the changeset + with timed(ui, 'strip nodes'): + repair.strip(ui, repo, list(allnodes), backup="all", topic='drophack') + + finally: + lockmod.release(lock, wlock) + + # rewrite the whole file. + # print data. + # - time to compute the chain + # - time to strip the changeset + # - time to strip the obs marker. diff -r eccfd01aec56 -r 8a20b2774a65 hgext/evolve.py --- a/hgext/evolve.py Tue Jun 23 16:47:47 2015 -0700 +++ b/hgext/evolve.py Tue Jun 23 16:49:53 2015 -0700 @@ -6,7 +6,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -'''Extends Mercurial feature related to Changeset Evolution +'''extends Mercurial feature related to Changeset Evolution This extension provides several commands to mutate history and deal with issues it may raise. @@ -16,31 +16,34 @@ - enables the "Changeset Obsolescence" feature of mercurial, - alters core commands and extensions that rewrite history to use this feature, - - improves some aspect of the early implementation in 2.3 + - improves some aspect of the early implementation in Mercurial core ''' -testedwith = '2.3 2.3.1 2.3.2' -buglink = 'https://bitbucket.org/marmoute/mutable-history/issues' - - +__version__ = '5.1.5' +testedwith = '3.3.3 3.4.1' +buglink = 'http://bz.selenic.com/' + +import sys, os import random - +from StringIO import StringIO +import struct +import re +import socket +import errno +sha1re = re.compile(r'\b[0-9a-f]{6,40}\b') + +import mercurial from mercurial import util try: from mercurial import obsolete if not obsolete._enabled: obsolete._enabled = True -except ImportError: - raise util.Abort('Evolve extension requires Mercurial 2.3 (or later)') - -try: - getattr(obsolete, 'getrevs') # 2.4 specific - raise util.Abort('Your version of Mercurial is too recent for this ' - 'version of evolve', - hint="upgrade your evolve") -except AttributeError: - pass + from mercurial import wireproto + gboptslist = getattr(wireproto, 'gboptslist', None) + gboptsmap = getattr(wireproto, 'gboptsmap', None) +except (ImportError, AttributeError): + gboptslist = gboptsmap = None from mercurial import bookmarks @@ -48,26 +51,46 @@ from mercurial import commands from mercurial import context from mercurial import copies -from mercurial import discovery from mercurial import error +from mercurial import exchange from mercurial import extensions +from mercurial import httppeer from mercurial import hg -from mercurial import localrepo from mercurial import lock as lockmod from mercurial import merge from mercurial import node from mercurial import phases +from mercurial import patch 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 - -import mercurial.hgweb.hgweb_mod - - - +from mercurial import wireproto +from mercurial import localrepo +from mercurial.hgweb import hgweb_mod + +cmdtable = {} +command = cmdutil.command(cmdtable) + +_pack = struct.pack + +if gboptsmap is not None: + memfilectx = context.memfilectx +elif gboptslist is not None: + oldmemfilectx = context.memfilectx + def memfilectx(repo, *args, **kwargs): + return oldmemfilectx(*args, **kwargs) +else: + raise ImportError('evolve needs version %s or above' % min(testedwith.split())) + +aliases, entry = cmdutil.findcmd('commit', commands.table) +hasinteractivemode = any(['interactive' in e for e in entry[1]]) +if hasinteractivemode: + interactiveopt = [['i', 'interactive', None, _('use interactive mode')]] +else: + interactiveopt = [] # This extension contains the following code # # - Extension Helper code @@ -76,7 +99,6 @@ # - Older format compat - ##################################################################### ### Extension helper ### ##################################################################### @@ -187,7 +209,7 @@ def setupcelestine(ui): print 'this is extsetup!' """ - self._uicallables.append(call) + self._extcallables.append(call) return call def reposetup(self, call): @@ -222,7 +244,7 @@ def templatekw(self, keywordname): - """Decorated function is a revset keyword + """Decorated function is a template keyword The name of the keyword must be given as the decorator argument. The symbol is added during `extsetup`. @@ -308,344 +330,29 @@ reposetup = eh.final_reposetup ##################################################################### -### Critical fix ### -##################################################################### - -@eh.wrapfunction(mercurial.obsolete, '_readmarkers') -def safereadmarkers(orig, data): - """safe maker wrapper to remove nullid succesors - - Nullid successors was created by older version of evolve. - """ - for marker in orig(data): - if nullid in marker[1]: - marker = (marker[0], - tuple(s for s in marker[1] if s != nullid), - marker[2], - marker[3]) - yield marker - - -##################################################################### -### Obsolescence Caching Logic ### +### experimental behavior ### ##################################################################### -# IN CORE fb72eec7efd8 - -# Obsolescence related logic can be very slow if we don't have efficient cache. -# -# This section implements a cache mechanism that did not make it into core for -# time reason. It stores meaningful set of revisions related to obsolescence -# (obsolete, unstable, etc.) -# -# Here is: -# -# - Computation of meaningful sets -# - Cache access logic, -# - Cache invalidation logic, -# - revset and ctx using this cache. -# - - -### Computation of meaningful set -# -# Most set can be computed with "simple" revset. - -#: { set name -> function to compute this set } mapping -#: function take a single "repo" argument. -#: -#: Use the `cachefor` decorator to register new cache function -try: - cachefuncs = obsolete.cachefuncs - cachefor = obsolete.cachefor - getobscache = obsolete.getobscache - clearobscaches = obsolete.clearobscaches -except AttributeError: - cachefuncs = {} - - def cachefor(name): - """Decorator to register a function as computing the cache for a set""" - def decorator(func): - assert name not in cachefuncs - cachefuncs[name] = func - return func - return decorator - - @cachefor('obsolete') - def _computeobsoleteset(repo): - """the set of obsolete revisions""" - obs = set() - nm = repo.changelog.nodemap - for prec in repo.obsstore.precursors: - rev = nm.get(prec) - if rev is not None: - obs.add(rev) - return set(repo.revs('%ld - public()', obs)) - - @cachefor('unstable') - def _computeunstableset(repo): - """the set of non obsolete revisions with obsolete parents""" - return set(repo.revs('(obsolete()::) - obsolete()')) - - @cachefor('suspended') - def _computesuspendedset(repo): - """the set of obsolete parents with non obsolete descendants""" - return set(repo.revs('obsolete() and obsolete()::unstable()')) - - @cachefor('extinct') - def _computeextinctset(repo): - """the set of obsolete parents without non obsolete descendants""" - return set(repo.revs('obsolete() - obsolete()::unstable()')) - - @eh.wrapfunction(obsolete.obsstore, '__init__') - def _initobsstorecache(orig, obsstore, *args, **kwargs): - """add a cache attribute to obsstore""" - obsstore.caches = {} - return orig(obsstore, *args, **kwargs) - -### Cache access - - def getobscache(repo, name): - """Return the set of revision that belong to the set - - Such access may compute the set and cache it for future use""" - if not repo.obsstore: - return () - if name not in repo.obsstore.caches: - repo.obsstore.caches[name] = cachefuncs[name](repo) - return repo.obsstore.caches[name] - -### Cache clean up -# -# To be simple we need to invalidate obsolescence cache when: -# -# - new changeset is added: -# - public phase is changed -# - obsolescence marker are added -# - strip is used a repo - - - def clearobscaches(repo): - """Remove all obsolescence related cache from a repo - - This remove all cache in obsstore is the obsstore already exist on the - repo. - - (We could be smarter here)""" - if 'obsstore' in repo._filecache: - repo.obsstore.caches.clear() - - @eh.wrapfunction(localrepo.localrepository, 'addchangegroup') # new changeset - @eh.wrapfunction(phases, 'retractboundary') # phase movement - @eh.wrapfunction(phases, 'advanceboundary') # phase movement - @eh.wrapfunction(localrepo.localrepository, 'destroyed') # strip - def wrapclearcache(orig, repo, *args, **kwargs): - try: - return orig(repo, *args, **kwargs) - finally: - # we are a bit wide here - # we could restrict to: - # advanceboundary + phase==public - # retractboundary + phase==draft - clearobscaches(repo) - - @eh.wrapfunction(obsolete.obsstore, 'add') # new marker - def clearonadd(orig, obsstore, *args, **kwargs): - try: - return orig(obsstore, *args, **kwargs) - finally: - obsstore.caches.clear() - -### Use the case -# Function in core that could benefic from the cache are overwritten by cache using version - -# changectx method - - @eh.addattr(context.changectx, 'unstable') - def unstable(ctx): - """is the changeset unstable (have obsolete ancestor)""" - if ctx.node() is None: - return False - return ctx.rev() in getobscache(ctx._repo, 'unstable') - - - @eh.addattr(context.changectx, 'extinct') - def extinct(ctx): - """is the changeset extinct by other""" - if ctx.node() is None: - return False - return ctx.rev() in getobscache(ctx._repo, 'extinct') - -# revset - - @eh.revset('obsolete') - def revsetobsolete(repo, subset, x): - """``obsolete()`` - Changeset is obsolete. - """ - args = revset.getargs(x, 0, 0, 'obsolete takes no argument') - obsoletes = getobscache(repo, 'obsolete') - return [r for r in subset if r in obsoletes] - - @eh.revset('unstable') - def revsetunstable(repo, subset, x): - """``unstable()`` - Unstable changesets are non-obsolete with obsolete ancestors. - """ - args = revset.getargs(x, 0, 0, 'unstable takes no arguments') - unstables = getobscache(repo, 'unstable') - return [r for r in subset if r in unstables] - - @eh.revset('extinct') - def revsetextinct(repo, subset, x): - """``extinct()`` - Obsolete changesets with obsolete descendants only. - """ - args = revset.getargs(x, 0, 0, 'extinct takes no arguments') - extincts = getobscache(repo, 'extinct') - return [r for r in subset if r in extincts] - -##################################################################### -### Complete troubles computation logic ### -##################################################################### - -# there is two kind of trouble not handled by core right now: -# - bumped: (successors for public changeset) -# - divergent: (two changeset try to succeed to the same precursors) -# -# This section add support for those two addition trouble -# -# - Cache computation -# - revset and ctx method -# - push warning - -### Cache computation -latediff = 1 # flag to prevent taking late comer fix into account - -@cachefor('bumped') -def _computebumpedset(repo): - """the set of rev trying to obsolete public revision""" - candidates = _allsuccessors(repo, repo.revs('public()'), - haltonflags=latediff) - query = '%ld - obsolete() - public()' - return set(repo.revs(query, candidates)) - -@cachefor('divergent') -def _computedivergentset(repo): - """the set of rev trying to obsolete public revision""" - divergent = set() - obsstore = repo.obsstore - newermap = {} - for ctx in repo.set('(not public()) - obsolete()'): - mark = obsstore.successors.get(ctx.node(), ()) - toprocess = set(mark) - while toprocess: - prec = toprocess.pop()[0] - if prec not in newermap: - successorssets(repo, prec, newermap) - newer = [n for n in newermap[prec] if n] - if len(newer) > 1: - divergent.add(ctx.rev()) - break - toprocess.update(obsstore.successors.get(prec, ())) - return divergent - -### changectx method - -@eh.addattr(context.changectx, 'latecomer') -@eh.addattr(context.changectx, 'bumped') -def bumped(ctx): - """is the changeset bumped (Try to succeed to public change)""" - if ctx.node() is None: - return False - return ctx.rev() in getobscache(ctx._repo, 'bumped') - -@eh.addattr(context.changectx, 'conflicting') -@eh.addattr(context.changectx, 'divergent') -def divergent(ctx): - """is the changeset divergent (Try to succeed to public change)""" - if ctx.node() is None: - return False - return ctx.rev() in getobscache(ctx._repo, 'divergent') - -### revset symbol - -@eh.revset('latecomer') -@eh.revset('bumped') -def revsetbumped(repo, subset, x): - """``bumped()`` - Changesets marked as successors of public changesets. +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. """ - args = revset.getargs(x, 0, 0, 'bumped takes no arguments') - lates = getobscache(repo, 'bumped') - return [r for r in subset if r in lates] - -@eh.revset('conflicting') -@eh.revset('divergent') -def revsetdivergent(repo, subset, x): - """``divergent()`` - Changesets marked as successors of a same changeset. - """ - args = revset.getargs(x, 0, 0, 'divergent takes no arguments') - conf = getobscache(repo, 'divergent') - return [r for r in subset if r in conf] - - - -### Discovery wrapping - -@eh.wrapfunction(discovery, 'checkheads') -def wrapcheckheads(orig, repo, remote, outgoing, *args, **kwargs): - """wrap mercurial.discovery.checkheads - - * prevent bumped and unstable to be pushed - """ - # do not push instability - for h in outgoing.missingheads: - # Checking heads is enough, obsolete descendants are either - # obsolete or unstable. - ctx = repo[h] - if ctx.bumped(): - raise util.Abort(_("push includes a bumped changeset: %s!") - % ctx) - if ctx.divergent(): - raise util.Abort(_("push includes a divergent changeset: %s!") - % ctx) - return orig(repo, remote, outgoing, *args, **kwargs) - -##################################################################### -### Filter extinct changesets from common operations ### -##################################################################### - -@eh.wrapfunction(merge, 'update') -def wrapmergeupdate(orig, repo, node, *args, **kwargs): - """ensure we don't automatically update on hidden changeset""" - if node is None: - # tip of current branch - branch = repo[None].branch() - node = repo.revs('last((.:: and branch(%s)) - hidden())', branch)[0] - return orig(repo, node, *args, **kwargs) - -@eh.wrapfunction(localrepo.localrepository, 'branchtip') -def obsbranchtip(orig, repo, branch): - """ensure "stable" reference does not end on a hidden changeset""" - if not getattr(repo, '_dofilterbranchtip', True): - return orig(repo, branch) - result = () - heads = repo.branchmap().get(branch, ()) - if heads: - result = list(repo.set('last(heads(branch(%n) - hidden()))', heads[0])) - if not result: - raise error.RepoLookupError(_("unknown branch '%s'") % branch) - return result[0].node() - - -@eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, '__init__') -@eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, 'refresh') -def nofilter(orig, hgweb, *args, **kwargs): - orig(hgweb, *args, **kwargs) - hgweb.repo._dofilterbranchtip = False - + # 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() + +getrevs = obsolete.getrevs ##################################################################### ### Additional Utilities ### @@ -659,45 +366,6 @@ # - function to travel throught the obsolescence graph # - function to find useful changeset to stabilize -### Marker Create -# NOW IN CORE f85816af6294 -try: - createmarkers = obsolete.createmarkers -except AttributeError: - def createmarkers(repo, relations, metadata=None, flag=0): - """Add obsolete markers between changeset in a repo - - must be an iterable of (, (, ...)) tuple. - `old` and `news` are changectx. - - Current user and date are used except if specified otherwise in the - metadata attribute. - - /!\ assume the repo have been locked by the user /!\ - """ - # prepare metadata - if metadata is None: - metadata = {} - if 'date' not in metadata: - metadata['date'] = '%i %i' % util.makedate() - if 'user' not in metadata: - metadata['user'] = repo.ui.username() - # check future marker - tr = repo.transaction('add-obsolescence-marker') - try: - for prec, sucs in relations: - if not prec.mutable(): - raise util.Abort("cannot obsolete immutable changeset: %s" % prec) - nprec = prec.node() - nsucs = tuple(s.node() for s in sucs) - if nprec in nsucs: - raise util.Abort("changeset %s cannot obsolete himself" % prec) - repo.obsstore.create(tr, nprec, nsucs, flag, metadata) - clearobscaches(repo) - tr.close() - finally: - tr.release() - ### Useful alias @@ -710,36 +378,33 @@ if ui.config('alias', 'olog', None) is None: ui.setconfig('alias', 'olog', "log -r 'precursors(.)' --hidden") if ui.config('alias', 'odiff', None) is None: - ui.setconfig('alias', 'odiff', "diff --rev 'limit(precursors(.),1)' --rev .") - -# - "troubles" method on changectx - -@eh.addattr(context.changectx, 'troubles') -def troubles(ctx): - """Return a tuple listing all the troubles that affect a changeset - - Troubles may be "unstable", "bumped" or "divergent". - """ - troubles = [] - if ctx.unstable(): - troubles.append('unstable') - if ctx.bumped(): - troubles.append('bumped') - if ctx.divergent(): - troubles.append('divergent') - return tuple(troubles) + ui.setconfig('alias', 'odiff', + "diff --hidden --rev 'limit(precursors(.),1)' --rev .") + if ui.config('alias', 'grab', None) is None: + if os.name == 'nt': + ui.setconfig('alias', 'grab', + "! " + util.hgexecutable() + " rebase --dest . --rev $@ && " + + util.hgexecutable() + " up tip") + else: + ui.setconfig('alias', 'grab', + "! $HG rebase --dest . --rev $@ && $HG up tip") + ### Troubled revset symbol @eh.revset('troubled') -def revsetbumped(repo, subset, x): +def revsettroubled(repo, subset, x): """``troubled()`` Changesets with troubles. """ - _ = revset.getargs(x, 0, 0, 'troubled takes no arguments') - return repo.revs('%ld and (unstable() + bumped() + divergent())', - subset) - + revset.getargs(x, 0, 0, 'troubled takes no arguments') + troubled = set() + troubled.update(getrevs(repo, 'unstable')) + troubled.update(getrevs(repo, 'bumped')) + troubled.update(getrevs(repo, 'divergent')) + troubled = revset.baseset(troubled) + troubled.sort() # set is non-ordered, enforce order + return subset & troubled ### Obsolescence graph @@ -749,19 +414,22 @@ """Precursor of a changeset""" cs = set() nm = repo.changelog.nodemap - markerbysubj = repo.obsstore.successors + markerbysubj = repo.obsstore.precursors + node = repo.changelog.node for r in s: - for p in markerbysubj.get(repo[r].node(), ()): + for p in markerbysubj.get(node(r), ()): pr = nm.get(p[0]) if pr is not None: cs.add(pr) + cs -= repo.changelog.filteredrevs # nodemap has no filtering return cs def _allprecursors(repo, s): # XXX we need a better naming """transitive precursors of a subset""" - toproceed = [repo[r].node() for r in s] + node = repo.changelog.node + toproceed = [node(r) for r in s] seen = set() - allsubjects = repo.obsstore.successors + allsubjects = repo.obsstore.precursors while toproceed: nc = toproceed.pop() for mark in allsubjects.get(nc, ()): @@ -775,19 +443,22 @@ pr = nm.get(p) if pr is not None: cs.add(pr) + cs -= repo.changelog.filteredrevs # nodemap has no filtering return cs def _successors(repo, s): """Successors of a changeset""" cs = set() + node = repo.changelog.node nm = repo.changelog.nodemap - markerbyobj = repo.obsstore.precursors + markerbyobj = repo.obsstore.successors for r in s: - for p in markerbyobj.get(repo[r].node(), ()): + for p in markerbyobj.get(node(r), ()): for sub in p[1]: sr = nm.get(sub) if sr is not None: cs.add(sr) + cs -= repo.changelog.filteredrevs # nodemap has no filtering return cs def _allsuccessors(repo, s, haltonflags=0): # XXX we need a better naming @@ -795,9 +466,10 @@ haltonflags allows to provide flags which prevent the evaluation of a marker. """ - toproceed = [repo[r].node() for r in s] + node = repo.changelog.node + toproceed = [node(r) for r in s] seen = set() - allobjects = repo.obsstore.precursors + allobjects = repo.obsstore.successors while toproceed: nc = toproceed.pop() for mark in allobjects.get(nc, ()): @@ -815,124 +487,9 @@ sr = nm.get(s) if sr is not None: cs.add(sr) + cs -= repo.changelog.filteredrevs # nodemap has no filtering return cs -nodemod = node -def successorssets(repo, initialnode, cache=None): - """Return the newer version of an obsolete changeset""" - - # prec -> markers mapping - markersfor = repo.obsstore.precursors - - # Stack of node need to know the last successors set - toproceed = [initialnode] - # set version of toproceed for fast loop detection - stackedset = set(toproceed) - if cache is None: - cache = {} - while toproceed: - # work on the last node of the stack - node = toproceed[-1] - if node in cache: - # We already have a value for it. - # Keep working on something else. - stackedset.remove(toproceed.pop()) - elif node not in markersfor: - # The node is not obsolete. - # This mean it is its own last successors. - if node in repo: - # We have a valid last successors. - cache[node] = [(node,)] - else: - # final obsolete version is unknown locally. - # Do not count that as a valid successors - cache[node] = [] - else: - # stand for Last Successors Sets - # it contains the list of all last successors for the current node. - lss = [] - for mark in markersfor[node]: - # stand for Marker Last Successors Sets - # it contains the list of last successors set introduced by - # this marker. - mlss = [[]] - # iterate over possible multiple successors - for suc in mark[1]: - if suc not in cache: - # We do not know the last successors of that yet. - if suc in stackedset: - # Loop detected! - # - # we won't be able to ever compute a proper last - # successors the naive and simple approve is to - # consider it killed - cache[suc] = [] - else: - # Add the successor to the stack and break the next - # iteration will work on this successors and the - # algorithm will eventually process the current - # node again. - toproceed.append(suc) - stackedset.add(suc) - break - # if we did not break, we can extend the possible set of - # last successors. - # - # I say "extends" because if the marker have multiple - # successors we have to generate - # - # if successors have multiple successors set (when ther are - # divergent themself), we do a cartesian product of - # possible successors set of already processed successors - # and newly obtains successors set. - newmlss = [] - for prefix in mlss: - for suffix in cache[suc]: - newss = list(prefix) - for part in suffix: - # do not duplicated entry in successors set. - # first entry win. - if part not in newss: - newss.append(part) - newmlss.append(newss) - mlss = newmlss - else: - # note: mlss is still empty if the marker was a bare killing - # of this changeset - # - # We extends the list of all possible successors sets with - # successors set continuted by this marker - lss.extend(mlss) - # we use continue here to skip the break right bellow - continue - # propagate "nested for" break. - # if the nested for exited on break, it did not ran the else - # clause and didn't "continue - break - else: - # computation was succesful for *all* marker. - # Add computed successors set to the cache - # (will be poped from to proceeed) on the new iteration - # - # We remove successors set that are subset of another one - # this fil - candsucset = sorted(((len(ss), set(ss), ss) for ss in lss), - reverse=True) - finalsucset = [] - for cl, cs, css in candsucset: - if not css: - # remove empty successors set - continue - for fs, fss in finalsucset: - if cs.issubset(fs): - break - else: - finalsucset.append((cs, css)) - finalsucset = [s[1] for s in finalsucset] - finalsucset.reverse() - cache[node] = finalsucset - return cache[initialnode] - @@ -944,25 +501,16 @@ # they are subject to changes -if 'hidden' not in revset.symbols: - # in 2.3+ - @eh.revset('hidden') - def revsethidden(repo, subset, x): - """``hidden()`` - Changeset is hidden. - """ - args = revset.getargs(x, 0, 0, 'hidden takes no argument') - return [r for r in subset if r in repo.hiddenrevs] - ### XXX I'm not sure this revset is useful @eh.revset('suspended') def revsetsuspended(repo, subset, x): """``suspended()`` Obsolete changesets with non-obsolete descendants. """ - args = revset.getargs(x, 0, 0, 'suspended takes no arguments') - suspended = getobscache(repo, 'suspended') - return [r for r in subset if r in suspended] + revset.getargs(x, 0, 0, 'suspended takes no arguments') + suspended = revset.baseset(getrevs(repo, 'suspended')) + suspended.sort() + return subset & suspended @eh.revset('precursors') @@ -970,9 +518,10 @@ """``precursors(set)`` Immediate precursors of changesets in set. """ - s = revset.getset(repo, range(len(repo)), x) - cs = _precursors(repo, s) - return [r for r in subset if r in cs] + s = revset.getset(repo, revset.fullreposet(repo), x) + s = revset.baseset(_precursors(repo, s)) + s.sort() + return subset & s @eh.revset('allprecursors') @@ -980,9 +529,10 @@ """``allprecursors(set)`` Transitive precursors of changesets in set. """ - s = revset.getset(repo, range(len(repo)), x) - cs = _allprecursors(repo, s) - return [r for r in subset if r in cs] + s = revset.getset(repo, revset.fullreposet(repo), x) + s = revset.baseset(_allprecursors(repo, s)) + s.sort() + return subset & s @eh.revset('successors') @@ -990,18 +540,20 @@ """``successors(set)`` Immediate successors of changesets in set. """ - s = revset.getset(repo, range(len(repo)), x) - cs = _successors(repo, s) - return [r for r in subset if r in cs] + s = revset.getset(repo, revset.fullreposet(repo), x) + s = revset.baseset(_successors(repo, s)) + s.sort() + return subset & s @eh.revset('allsuccessors') def revsetallsuccessors(repo, subset, x): """``allsuccessors(set)`` Transitive successors of changesets in set. """ - s = revset.getset(repo, range(len(repo)), x) - cs = _allsuccessors(repo, s) - return [r for r in subset if r in cs] + s = revset.getset(repo, revset.fullreposet(repo), x) + s = revset.baseset(_allsuccessors(repo, s)) + s.sort() + return subset & s ### template keywords # XXX it does not handle troubles well :-/ @@ -1011,7 +563,6 @@ """:obsolete: String. The obsolescence level of the node, could be ``stable``, ``unstable``, ``suspended`` or ``extinct``. """ - rev = ctx.rev() if ctx.obsolete(): if ctx.extinct(): return 'extinct' @@ -1021,6 +572,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 ### ##################################################################### @@ -1028,17 +586,19 @@ # This section take care of issue warning to the user when troubles appear @eh.wrapcommand("update") +@eh.wrapcommand("parents") @eh.wrapcommand("pull") def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): """Warn that the working directory parent is an obsolete changeset""" res = origfn(ui, repo, *args, **opts) if repo['.'].obsolete(): - ui.warn(_('Working directory parent is obsolete\n')) + ui.warn(_('working directory parent is obsolete!\n')) return res # XXX this could wrap transaction code # XXX (but this is a bit a layer violation) @eh.wrapcommand("commit") +@eh.wrapcommand("import") @eh.wrapcommand("push") @eh.wrapcommand("pull") @eh.wrapcommand("graft") @@ -1046,15 +606,22 @@ @eh.wrapcommand("unbundle") def warnobserrors(orig, ui, repo, *args, **kwargs): """display warning is the command resulted in more instable changeset""" - priorunstables = len(repo.revs('unstable()')) - priorbumpeds = len(repo.revs('bumped()')) - priordivergents = len(repo.revs('divergent()')) + # part of the troubled stuff may be filtered (stash ?) + # This needs a better implementation but will probably wait for core. + filtered = repo.changelog.filteredrevs + priorunstables = len(set(getrevs(repo, 'unstable')) - filtered) + priorbumpeds = len(set(getrevs(repo, 'bumped')) - filtered) + priordivergents = len(set(getrevs(repo, 'divergent')) - filtered) ret = orig(ui, repo, *args, **kwargs) # workaround phase stupidity - phases._filterunknown(ui, repo.changelog, repo._phasecache.phaseroots) - newunstables = len(repo.revs('unstable()')) - priorunstables - newbumpeds = len(repo.revs('bumped()')) - priorbumpeds - newdivergents = len(repo.revs('divergent()')) - priordivergents + #phases._filterunknown(ui, repo.changelog, repo._phasecache.phaseroots) + filtered = repo.changelog.filteredrevs + newunstables = \ + len(set(getrevs(repo, 'unstable')) - filtered) - priorunstables + newbumpeds = \ + len(set(getrevs(repo, 'bumped')) - filtered) - priorbumpeds + newdivergents = \ + len(set(getrevs(repo, 'divergent')) - filtered) - priordivergents if newunstables > 0: ui.warn(_('%i new unstable changesets\n') % newunstables) if newbumpeds > 0: @@ -1063,33 +630,22 @@ ui.warn(_('%i new divergent changesets\n') % newdivergents) return ret -@eh.reposetup -def _repostabilizesetup(ui, repo): +@eh.wrapfunction(mercurial.exchange, 'push') +def push(orig, repo, *args, **opts): """Add a hint for "hg evolve" when troubles make push fails """ - if not repo.local(): - return - - opush = repo.push - - class evolvingrepo(repo.__class__): - def push(self, remote, *args, **opts): - """wrapper around pull that pull obsolete relation""" - try: - result = opush(remote, *args, **opts) - except util.Abort, ex: - hint = _("use 'hg evolve' to get a stable history " - "or --force to ignore warnings") - if (len(ex.args) >= 1 - and ex.args[0].startswith('push includes ') - and ex.hint is None): - ex.hint = hint - raise - return result - repo.__class__ = evolvingrepo - -@eh.wrapcommand("summary") -def obssummary(orig, ui, repo, *args, **kwargs): + try: + return orig(repo, *args, **opts) + except util.Abort, ex: + hint = _("use 'hg evolve' to get a stable history " + "or --force to ignore warnings") + if (len(ex.args) >= 1 + and ex.args[0].startswith('push includes ') + and ex.hint is None): + ex.hint = hint + raise + +def summaryhook(ui, repo): def write(fmt, count): s = fmt % count if count: @@ -1097,148 +653,22 @@ else: ui.note(s) - ret = orig(ui, repo, *args, **kwargs) - nbunstable = len(getobscache(repo, 'unstable')) - nbbumped = len(getobscache(repo, 'bumped')) - nbdivergent = len(getobscache(repo, 'divergent')) + nbunstable = len(getrevs(repo, 'unstable')) + nbbumped = len(getrevs(repo, 'bumped')) + nbdivergent = len(getrevs(repo, 'divergent')) write('unstable: %i changesets\n', nbunstable) write('bumped: %i changesets\n', nbbumped) write('divergent: %i changesets\n', nbdivergent) - return ret + +@eh.extsetup +def obssummarysetup(ui): + cmdutil.summaryhooks.add('evolve', summaryhook) ##################################################################### ### Core Other extension compat ### ##################################################################### -# This section make official history rewritter create obsolete marker - - -### commit --amend -# make commit --amend create obsolete marker -# -# The precursor is still strip from the repository. - -# IN CORE 63e45aee46d4 - -if getattr(cmdutil, 'obsolete', None) is None: - @eh.wrapfunction(cmdutil, 'amend') - def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs): - oldnode = old.node() - new = orig(ui, repo, commitfunc, old, *args, **kwargs) - if new != oldnode: - lock = repo.lock() - try: - tr = repo.transaction('post-amend-obst') - try: - meta = { - 'date': '%i %i' % util.makedate(), - 'user': ui.username(), - } - repo.obsstore.create(tr, oldnode, [new], 0, meta) - tr.close() - clearobscaches(repo) - finally: - tr.release() - finally: - lock.release() - return new - -### rebase -# -# - ignore obsolete changeset -# - create obsolete marker *instead of* striping - -def buildstate(orig, repo, dest, rebaseset, *ags, **kws): - """wrapper for rebase 's buildstate that exclude obsolete changeset""" - - rebaseset = repo.revs('%ld - extinct()', rebaseset) - if not rebaseset: - repo.ui.warn(_('whole rebase set is extinct and ignored.\n')) - return {} - root = min(rebaseset) - if (not getattr(repo, '_rebasekeep', False) - and not repo[root].mutable()): - raise util.Abort(_("can't rebase immutable changeset %s") % repo[root], - hint=_('see hg help phases for details')) - return orig(repo, dest, rebaseset, *ags, **kws) - -def defineparents(orig, repo, rev, target, state, *args, **kwargs): - rebasestate = getattr(repo, '_rebasestate', None) - if rebasestate is not None: - repo._rebasestate = dict(state) - repo._rebasetarget = target - return orig(repo, rev, target, state, *args, **kwargs) - -def concludenode(orig, repo, rev, p1, *args, **kwargs): - """wrapper for rebase 's concludenode that set obsolete relation""" - newrev = orig(repo, rev, p1, *args, **kwargs) - rebasestate = getattr(repo, '_rebasestate', None) - if rebasestate is not None: - if newrev is not None: - nrev = repo[newrev].rev() - else: - nrev = p1 - repo._rebasestate[rev] = nrev - return newrev - -def cmdrebase(orig, ui, repo, *args, **kwargs): - - reallykeep = kwargs.get('keep', False) - kwargs = dict(kwargs) - kwargs['keep'] = True - repo._rebasekeep = reallykeep - - # We want to mark rebased revision as obsolete and set their - # replacements if any. Doing it in concludenode() prevents - # aborting the rebase, and is not called with all relevant - # revisions in --collapse case. Instead, we try to track the - # rebase state structure by sampling/updating it in - # defineparents() and concludenode(). The obsolete markers are - # added from this state after a successful call. - repo._rebasestate = {} - repo._rebasetarget = None - try: - l = repo.lock() - try: - res = orig(ui, repo, *args, **kwargs) - if not reallykeep: - # Filter nullmerge or unrebased entries - repo._rebasestate = dict(p for p in repo._rebasestate.iteritems() - if p[1] >= 0) - if not res and not kwargs.get('abort') and repo._rebasestate: - # Rebased revisions are assumed to be descendants of - # targetrev. If a source revision is mapped to targetrev - # or to another rebased revision, it must have been - # removed. - markers = [] - if kwargs.get('collapse'): - # collapse assume revision disapear because they are all - # in the created revision - newrevs = set(repo._rebasestate.values()) - newrevs.remove(repo._rebasetarget) - if newrevs: - # we create new revision. - # A single one by --collapse design - assert len(newrevs) == 1 - new = tuple(repo[n] for n in newrevs) - else: - # every body died. no new changeset created - new = (repo[repo._rebasetarget],) - for rev, newrev in sorted(repo._rebasestate.items()): - markers.append((repo[rev], new)) - else: - # no collapse assume revision disapear because they are - # contained in parent - for rev, newrev in sorted(repo._rebasestate.items()): - markers.append((repo[rev], (repo[newrev],))) - createmarkers(repo, markers) - return res - finally: - l.release() - finally: - delattr(repo, '_rebasestate') - delattr(repo, '_rebasetarget') @eh.extsetup def _rebasewrapping(ui): @@ -1246,17 +676,15 @@ try: rebase = extensions.find('rebase') if rebase: - incore = getattr(rebase, 'obsolete', None) is not None - if not incore: - extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase) extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) - if not incore: - extensions.wrapfunction(rebase, 'buildstate', buildstate) - extensions.wrapfunction(rebase, 'defineparents', defineparents) - extensions.wrapfunction(rebase, 'concludenode', concludenode) except KeyError: pass # rebase not found - + try: + histedit = extensions.find('histedit') + if histedit: + extensions.wrapcommand(histedit.cmdtable, 'histedit', warnobserrors) + except KeyError: + pass # rebase not found ##################################################################### ### Old Evolve extension content ### @@ -1267,11 +695,6 @@ ### util function ############################# -def noderange(repo, revsets): - """The same as revrange but return node""" - return map(repo.changelog.node, - scmutil.revrange(repo, revsets)) - ### changeset rewriting logic ############################# @@ -1286,205 +709,532 @@ 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 = context.memfilectx(fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) - return mctx - raise IOError() - if commitopts.get('message') and commitopts.get('logfile'): - raise util.Abort(_('options --message and --logfile are mutually' - ' exclusive')) - if commitopts.get('logfile'): - message= open(commitopts['logfile']).read() - elif commitopts.get('message'): - message = commitopts['message'] + return False else: - 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 - if created: - updatebookmarks(newid) - # add evolution metadata - markers = [(u, (new,)) for u in updates] - markers.append((old, (new,))) - createmarkers(repo, markers) - else: - # newid is an existing revision. It could make sense to - # replace revisions with existing ones but probably not by - # default. - pass - finally: - wlock.release() + 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 + return None + + 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 class MergeFailure(util.Abort): pass -def relocate(repo, orig, dest): +def relocate(repo, orig, dest, keepbranch=False): """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")) + + if not orig.p2().rev() == node.nullrev: + raise util.Abort( + 'no support for evolving merge changesets yet', + hint="Redo the merge and use `hg prune --succ ` to obsolete the old one") + destbookmarks = repo.nodebookmarks(dest.node()) + nodesrc = orig.node() + destphase = repo[nodesrc].phase() + commitmsg = orig.description() + + cache = {} + sha1s = re.findall(sha1re, commitmsg) + unfi = repo.unfiltered() + for sha1 in sha1s: + ctx = None + try: + ctx = unfi[sha1] + except error.RepoLookupError: + continue + + if not ctx.obsolete(): + continue + + successors = obsolete.successorssets(repo, ctx.node(), cache) + + # We can't make any assumptions about how to update the hash if the + # cset in question was split or diverged. + if len(successors) == 1 and len(successors[0]) == 1: + newsha1 = node.hex(successors[0][0]) + commitmsg = commitmsg.replace(sha1, newsha1[:len(sha1)]) + else: + repo.ui.note(_('The stale commit message reference to %s could ' + 'not be updated\n') % sha1) + + tr = repo.transaction('relocate') try: - rebase = extensions.find('rebase') - # dummy state to trick rebase node - assert orig.p2().rev() == node.nullrev, 'no support yet' - destbookmarks = repo.nodebookmarks(dest.node()) - cmdutil.duplicatecopies(repo, orig.node(), dest.node()) - nodesrc = orig.node() - destphase = repo[nodesrc].phase() try: - if rebase.rebasenode.func_code.co_argcount == 5: - # rebasenode collapse argument was introduced by - # d1afbf03e69a (2.3) - r = rebase.rebasenode(repo, orig.node(), dest.node(), - {node.nullrev: node.nullrev}, False) - else: - r = rebase.rebasenode(repo, orig.node(), dest.node(), - {node.nullrev: node.nullrev}) - if r[-1]: #some conflict + if repo['.'].rev() != dest.rev(): + merge.update(repo, dest, False, True, False) + if bmactive(repo): + repo.ui.status(_("(leaving bookmark %s)\n") % bmactive(repo)) + bmdeactivate(repo) + if keepbranch: + repo.dirstate.setbranch(orig.branch()) + r = merge.graft(repo, orig, orig.p1(), ['local', 'graft']) + if r[-1]: #some conflict raise util.Abort( 'unresolved merge conflicts (see hg help resolve)') - nodenew = rebase.concludenode(repo, orig.node(), dest.node(), - node.nullid) + if commitmsg is None: + commitmsg = orig.description() + extra = {'rebase_source': orig.hex()} + + backup = repo.ui.backupconfig('phases', 'new-commit') + try: + targetphase = max(orig.phase(), phases.draft) + repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') + # Commit might fail if unresolved files exist + nodenew = repo.commit(text=commitmsg, user=orig.user(), + date=orig.date(), extra=extra) + finally: + repo.ui.restoreconfig(backup) except util.Abort, exc: + repo.dirstate.beginparentchange() + repo.setparents(repo['.'].node(), nullid) + repo.dirstate.write() + # fix up dirstate for copies and renames + copies.duplicatecopies(repo, dest.rev(), orig.p1().rev()) + repo.dirstate.endparentchange() class LocalMergeFailure(MergeFailure, exc.__class__): pass exc.__class__ = LocalMergeFailure raise oldbookmarks = repo.nodebookmarks(nodesrc) if nodenew is not None: - phases.retractboundary(repo, destphase, [nodenew]) - createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) + phases.retractboundary(repo, tr, destphase, [nodenew]) + obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) for book in oldbookmarks: repo._bookmarks[book] = nodenew else: - createmarkers(repo, [(repo[nodesrc], ())]) + obsolete.createmarkers(repo, [(repo[nodesrc], ())]) # Behave like rebase, move bookmarks to dest for book in oldbookmarks: repo._bookmarks[book] = dest.node() for book in destbookmarks: # restore bookmark that rebase move repo._bookmarks[book] = dest.node() if oldbookmarks or destbookmarks: - bookmarks.write(repo) - return nodenew - except util.Abort: - # Invalidate the previous setparents - repo.dirstate.invalidate() - raise + repo._bookmarks.write() + tr.close() + finally: + tr.release() + return nodenew def _bookmarksupdater(repo, oldid): """Return a callable update(newid) updating the current bookmark and bookmarks bound to oldid to newid. """ - bm = bookmarks.readcurrent(repo) def updatebookmarks(newid): dirty = False - if bm: - repo._bookmarks[bm] = newid - dirty = True oldbookmarks = repo.nodebookmarks(oldid) if oldbookmarks: for b in oldbookmarks: repo._bookmarks[b] = newid dirty = True if dirty: - bookmarks.write(repo) + repo._bookmarks.write() return updatebookmarks +### bookmarks api compatibility layer ### +def bmdeactivate(repo): + try: + return bookmarks.deactivate(repo) + except AttributeError: + return bookmarks.unsetcurrent(repo) +def bmactivate(repo, book): + try: + return bookmarks.activate(repo, book) + except AttributeError: + return bookmarks.setcurrent(repo, book) + +def bmactive(repo): + try: + return repo._activebookmark + except AttributeError: + return repo._bookmarkcurrent + ### new command ############################# -cmdtable = {} -command = cmdutil.command(cmdtable) - -@command('^evolve|stabilize|evolve|solve', - [('n', 'dry-run', False, 'do not perform actions, print what to be done'), - ('A', 'any', False, 'evolve any troubled changeset'), - ('c', 'continue', False, 'continue an interrupted evolution'), ], +metadataopts = [ + ('d', 'date', '', + _('record the specified date in metadata'), _('DATE')), + ('u', 'user', '', + _('record the specified user in metadata'), _('USER')), +] + +@eh.uisetup +def _installimportobsolete(ui): + entry = cmdutil.findcmd('import', commands.table)[1] + entry[1].append(('', 'obsolete', False, + _('mark the old node as obsoleted by ' + 'the created commit'))) + +@eh.wrapfunction(mercurial.cmdutil, 'tryimportone') +def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): + extracted = patch.extract(ui, hunk) + expected = extracted[5] + if expected is not None: + expected = node.bin(expected) + oldextract = patch.extract + try: + patch.extract = lambda ui, hunk: extracted + ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs) + finally: + patch.extract = oldextract + created = ret[1] + if (opts['obsolete'] and None not in (created, expected) + and created != expected): + tr = repo.transaction('import-obs') + try: + metadata = {'user': ui.username()} + repo.obsstore.create(tr, expected, (created,), + metadata=metadata) + tr.close() + finally: + tr.release() + return ret + + +def _deprecatealias(oldalias, newalias): + '''Deprecates an alias for a command in favour of another + + Creates a new entry in the command table for the old alias. It creates a + wrapper that has its synopsis set to show that is has been deprecated. + The documentation will be replace with a pointer to the new alias. + If a user invokes the command a deprecation warning will be printed and + the command of the *new* alias will be invoked. + + This function is loosely based on the extensions.wrapcommand function. + ''' + aliases, entry = cmdutil.findcmd(newalias, cmdtable) + for alias, e in cmdtable.iteritems(): + if e is entry: + break + + synopsis = '(DEPRECATED)' + if len(entry) > 2: + fn, opts, _syn = entry + else: + fn, opts, = entry + deprecationwarning = _('%s have been deprecated in favor of %s\n' % ( + oldalias, newalias)) + def newfn(*args, **kwargs): + ui = args[0] + ui.warn(deprecationwarning) + util.checksignature(fn)(*args, **kwargs) + newfn.__doc__ = deprecationwarning + cmdwrapper = command(oldalias, opts, synopsis) + cmdwrapper(newfn) + +@eh.extsetup +def deprecatealiases(ui): + _deprecatealias('gup', 'next') + _deprecatealias('gdown', 'previous') + +@command('debugrecordpruneparents', [], '') +def cmddebugrecordpruneparents(ui, repo): + """add parents data to prune markers when possible + + This commands search the repo for prune markers without parent information. + If the pruned node is locally known, a new markers with parent data is + created.""" + pgop = 'reading markers' + + # lock from the beginning to prevent race + wlock = lock = tr = None + try: + wlock = repo.wlock() + lock = repo.lock() + tr = repo.transaction('recordpruneparents') + unfi = repo.unfiltered() + nm = unfi.changelog.nodemap + store = repo.obsstore + pgtotal = len(store._all) + for idx, mark in enumerate(list(store._all)): + if not mark[1]: + rev = nm.get(mark[0]) + if rev is not None: + ctx = unfi[rev] + parents = tuple(p.node() for p in ctx.parents()) + before = len(store._all) + store.create(tr, mark[0], mark[1], mark[2], marks[3], + parents=parents) + if len(store._all) - before: + ui.write('created new markers for %i\n' % rev) + ui.progress(pgop, idx, total=pgtotal) + tr.close() + ui.progress(pgop, None) + finally: + lockmod.release(tr, lock, wlock) + +@command('debugobsstorestat', [], '') +def cmddebugobsstorestat(ui, repo): + """print statistic about obsolescence markers in the repo""" + store = repo.obsstore + unfi = repo.unfiltered() + nm = unfi.changelog.nodemap + ui.write('markers total: %9i\n' % len(store._all)) + sucscount = [0, 0 , 0, 0] + known = 0 + parentsdata = 0 + metakeys = {} + # node -> cluster mapping + # a cluster is a (set(nodes), set(markers)) tuple + clustersmap = {} + # same data using parent information + pclustersmap= {} + for mark in store: + if mark[0] in nm: + known += 1 + nbsucs = len(mark[1]) + sucscount[min(nbsucs, 3)] += 1 + meta = mark[3] + for key, value in meta: + metakeys.setdefault(key, 0) + metakeys[key] += 1 + meta = dict(meta) + parents = [meta.get('p1'), meta.get('p2')] + parents = [node.bin(p) for p in parents if p is not None] + if parents: + parentsdata += 1 + # cluster handling + nodes = set() + nodes.add(mark[0]) + nodes.update(mark[1]) + c = (set(nodes), set([mark])) + + toproceed = set(nodes) + while toproceed: + n = toproceed.pop() + other = clustersmap.get(n) + if (other is not None + and other is not c): + other[0].update(c[0]) + other[1].update(c[1]) + for on in c[0]: + if on in toproceed: + continue + clustersmap[on] = other + c = other + clustersmap[n] = c + # same with parent data + nodes.update(parents) + c = (set(nodes), set([mark])) + toproceed = set(nodes) + while toproceed: + n = toproceed.pop() + other = pclustersmap.get(n) + if (other is not None + and other is not c): + other[0].update(c[0]) + other[1].update(c[1]) + for on in c[0]: + if on in toproceed: + continue + pclustersmap[on] = other + c = other + pclustersmap[n] = c + + # freezing the result + for c in clustersmap.values(): + fc = (frozenset(c[0]), frozenset(c[1])) + for n in fc[0]: + clustersmap[n] = fc + # same with parent data + for c in pclustersmap.values(): + fc = (frozenset(c[0]), frozenset(c[1])) + for n in fc[0]: + pclustersmap[n] = fc + ui.write(' for known precursors: %9i\n' % known) + ui.write(' with parents data: %9i\n' % parentsdata) + # successors data + ui.write('markers with no successors: %9i\n' % sucscount[0]) + ui.write(' 1 successors: %9i\n' % sucscount[1]) + ui.write(' 2 successors: %9i\n' % sucscount[2]) + ui.write(' more than 2 successors: %9i\n' % sucscount[3]) + # meta data info + ui.write(' available keys:\n') + for key in sorted(metakeys): + ui.write(' %15s: %9i\n' % (key, metakeys[key])) + + allclusters = list(set(clustersmap.values())) + allclusters.sort(key=lambda x: len(x[1])) + ui.write('disconnected clusters: %9i\n' % len(allclusters)) + + ui.write(' any known node: %9i\n' + % len([c for c in allclusters + if [n for n in c[0] if nm.get(n) is not None]])) + if allclusters: + nbcluster = len(allclusters) + ui.write(' smallest length: %9i\n' % len(allclusters[0][1])) + ui.write(' longer length: %9i\n' % len(allclusters[-1][1])) + median = len(allclusters[nbcluster//2][1]) + ui.write(' median length: %9i\n' % median) + mean = sum(len(x[1]) for x in allclusters) // nbcluster + ui.write(' mean length: %9i\n' % mean) + allpclusters = list(set(pclustersmap.values())) + allpclusters.sort(key=lambda x: len(x[1])) + ui.write(' using parents data: %9i\n' % len(allpclusters)) + ui.write(' any known node: %9i\n' + % len([c for c in allclusters + if [n for n in c[0] if nm.get(n) is not None]])) + if allpclusters: + nbcluster = len(allpclusters) + ui.write(' smallest length: %9i\n' % len(allpclusters[0][1])) + ui.write(' longer length: %9i\n' % len(allpclusters[-1][1])) + median = len(allpclusters[nbcluster//2][1]) + ui.write(' median length: %9i\n' % median) + mean = sum(len(x[1]) for x in allpclusters) // nbcluster + ui.write(' mean length: %9i\n' % mean) + +@command('^evolve|stabilize|solve', + [('n', 'dry-run', False, + 'do not perform actions, just print what would be done'), + ('', '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 - - - rebase unstable changeset to make it stable again, - - create proper diff from bumped changeset, - - merge divergent changeset. - - By default, take the first troubles changeset that looks relevant. - - (The logic is still a bit fuzzy) - - - For unstable, that mean the first which could be rebased as child of the - working directory parent revision or one of its descendants and rebase - it. - - - For divergent this mean "." if applicable. - - With --any, evolve pick any troubled changeset to solve + """solve trouble in your repository + + - rebase unstable changesets to make them stable again, + - create proper diffs from bumped changesets, + - merge divergent changesets, + - update to a successor if the working directory parent is + obsolete + + 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 + and rebasing it. + + - For divergent, this means taking "." if applicable. + + With --any, evolve picks any troubled changeset to repair. The working directory is updated to the newly created revision. """ contopt = opts['continue'] anyopt = opts['any'] + allopt = opts['all'] + dryrunopt = opts['dry_run'] + confirmopt = opts['confirm'] + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve') + + startnode = repo['.'] if contopt: if anyopt: - raise util.Abort('can not specify both "--any" and "--continue"') + raise util.Abort('cannot specify both "--any" and "--continue"') + if allopt: + raise util.Abort('cannot specify both "--all" and "--continue"') graftcmd = commands.table['graft'][0] return graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) - tr = _picknexttroubled(ui, repo, anyopt) - 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}) + successors = set() + + for successorsset in obsolete.successorssets(repo, repo['.'].node()): + for nodeid in successorsset: + successors.add(repo[nodeid]) + + if not successors: + ui.warn(_('parent is obsolete without successors; ' + + 'likely killed\n')) + return 2 + + elif len(successors) > 1: + ui.warn(_('parent is obsolete with multiple successors:\n')) + + for ctx in sorted(successors, key=lambda ctx: ctx.rev()): + displayer.show(ctx) + + return 2 + + else: + ctx = successors.pop() + + ui.status(_('update:')) + if not ui.quiet: + displayer.show(ctx) + + if dryrunopt: + return 0 + else: + res = hg.update(repo, ctx.rev()) + if ctx != startnode: + ui.status(_('working directory is now at %s\n') % ctx) + return res + troubled = repo.revs('troubled()') if troubled: ui.write_err(_('nothing to evolve here\n')) @@ -1492,36 +1242,84 @@ % len(troubled)) return 2 else: - ui.write_err(_('no troubled changeset\n')) + ui.write_err(_('no troubled changesets\n')) return 1 + + def progresscb(): + if allopt: + ui.progress('evolve', seen, unit='changesets', total=count) + seen = 1 + count = allopt and _counttroubled(ui, repo) or 1 + + while tro is not None: + 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: + if repo['.'] != startnode: + ui.status(_('working directory is now at %s\n') % repo['.']) + return result + progresscb() + tro = _picknexttroubled(ui, repo, anyopt or allopt) + + if allopt: + ui.progress('evolve', None) + + if repo['.'] != startnode: + ui.status(_('working directory is now at %s\n') % repo['.']) + + +def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb): + repo = repo.unfiltered() + tro = repo[tro.rev()] cmdutil.bailifchanged(repo) - troubles = tr.troubles() + troubles = tro.troubles() if 'unstable' in troubles: - return _solveunstable(ui, repo, tr, opts['dry_run']) + return _solveunstable(ui, repo, tro, dryrunopt, confirmopt, progresscb) elif 'bumped' in troubles: - return _solvebumped(ui, repo, tr, opts['dry_run']) + return _solvebumped(ui, repo, tro, dryrunopt, confirmopt, progresscb) elif 'divergent' in troubles: - return _solvedivergent(ui, repo, tr, opts['dry_run']) + return _solvedivergent(ui, repo, tro, dryrunopt, confirmopt, + progresscb) else: assert False # WHAT? unknown troubles -def _picknexttroubled(ui, repo, pickany=False): +def _counttroubled(ui, repo): + """Count the amount of troubled changesets""" + troubled = set() + troubled.update(getrevs(repo, 'unstable')) + troubled.update(getrevs(repo, 'bumped')) + troubled.update(getrevs(repo, 'divergent')) + return len(troubled) + +def _picknexttroubled(ui, repo, pickany=False, progresscb=None): """Pick a the next trouble changeset to solve""" - tr = _stabilizableunstable(repo, repo['.']) - if tr is None: + if progresscb: progresscb() + 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 @@ -1530,65 +1328,76 @@ """ def selfanddescendants(repo, pctx): yield pctx + for prec in repo.set('allprecursors(%d)', pctx): + yield prec for ctx in pctx.descendants(): yield ctx + for prec in repo.set('allprecursors(%d)', ctx): + yield prec # Look for an unstable which can be stabilized as a child of # node. The unstable must be a child of one of node predecessors. + directdesc = set([pctx.rev()]) for ctx in selfanddescendants(repo, pctx): - unstables = list(repo.set('unstable() and children(allprecursors(%d))', - ctx.rev())) - if unstables: - return unstables[0] + for child in ctx.children(): + if ctx.rev() in directdesc and not child.obsolete(): + directdesc.add(child.rev()) + elif child.unstable(): + return child return None -def _solveunstable(ui, repo, orig, dryrun=False): +def _solveunstable(ui, repo, orig, dryrun=False, confirm=False, + progresscb=None): """Stabilize a unstable changeset""" obs = orig.parents()[0] if not obs.obsolete(): - obs = orig.parents()[1] + obs = orig.parents()[1] # second parent is obsolete ? assert obs.obsolete() - newer = successorssets(repo, obs.node()) + newer = obsolete.successorssets(repo, obs.node()) # search of a parent which is not killed while not newer or newer == [()]: ui.debug("stabilize target %s is plain dead," - " trying to stabilize on its parent") + " trying to stabilize on its parent\n" % + obs) obs = obs.parents()[0] - newer = successorssets(repo, obs.node()) + newer = obsolete.successorssets(repo, obs.node()) if len(newer) > 1: - ui.write_err(_("conflict rewriting. can't choose destination\n")) - return 2 + raise util.Abort(_("conflict rewriting. can't choose destination\n")) targets = newer[0] assert targets if len(targets) > 1: - ui.write_err(_("does not handle splitted parent yet\n")) + raise util.Abort(_("does not handle split parents yet\n")) return 2 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]', 'n') != 'y': + raise util.Abort(_('evolve aborted by user')) + if progresscb: progresscb() todo = 'hg rebase -r %s -d %s\n' % (orig, target) if dryrun: repo.ui.write(todo) else: repo.ui.note(todo) - lock = repo.lock() + if progresscb: progresscb() + keepbranch = orig.p1().branch() != orig.branch() try: - relocate(repo, orig, target) + relocate(repo, orig, target, keepbranch) except MergeFailure: repo.opener.write('graftstate', orig.hex() + '\n') repo.ui.write_err(_('evolve failed!\n')) - repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n')) + repo.ui.write_err( + _('fix conflict and run "hg evolve --continue"' + ' or use "hg update -C" to abort\n')) raise - finally: - lock.release() - -def _solvebumped(ui, repo, bumped, dryrun=False): + +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: @@ -1601,12 +1410,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]', 'n') != '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) @@ -1614,104 +1424,129 @@ repo.ui.write('hg revert --all --rev %s;\n' % bumped) repo.ui.write('hg commit --msg "bumped update to %s"') return 0 - wlock = repo.wlock() + if progresscb: progresscb() + 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 = context.memfilectx(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=latediff) - bmupdate(newid) - tr.close() - repo.ui.status(_('commited 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] + obsolete.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 list(bumped.manifest().iteritems()): + precvalue = precmanifest.get(key, None) + if precvalue is not None: + del precmanifest[key] + if precvalue != 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 + return None + 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: + obsolete.createmarkers(repo, [(tmpctx, ())]) + newid = prec.node() + else: + phases.retractboundary(repo, tr, bumped.phase(), [newid]) + obsolete.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): + tr.release() + # reroute the working copy parent to the new changeset + repo.dirstate.beginparentchange() + repo.dirstate.setparents(newid, node.nullid) + repo.dirstate.endparentchange() + +def _solvedivergent(ui, repo, divergent, dryrun=False, confirm=False, + progresscb=None): base, others = divergentdata(divergent) if len(others) > 1: - raise util.Abort("We do not handle split yet") + othersstr = "[%s]" % (','.join([str(i) for i in others])) + hint = ("changeset %d is divergent with a changeset that got splitted " + "| into multiple ones:\n[%s]\n" + "| This is not handled by automatic evolution yet\n" + "| You have to fallback to manual handling with commands " + "such as:\n" + "| - hg touch -D\n" + "| - hg prune\n" + "| \n" + "| 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) other = others[0] if divergent.phase() <= phases.public: - raise util.Abort("We can't resolve this conflict from the public side") + raise util.Abort("we can't resolve this conflict from the public side", + hint="%s is public, try from %s" % (divergent, other)) if len(other.parents()) > 1: - raise util.Abort("divergent changeset can't be a merge (yet)") + raise util.Abort("divergent changeset can't be a merge (yet)", + hint="You have to fallback to solving this by hand...\n" + "| This probably means redoing the merge and using " + "| `hg prune` to kill older version.") if other.p1() not in divergent.parents(): - raise util.Abort("parents are not common (not handled yet)") + raise util.Abort("parents are not common (not handled yet)", + hint="| %(d)s, %(o)s are not based on the same changeset.\n" + "| With the current state of its implementation, \n" + "| evolve does not work in that case.\n" + "| rebase one of them next to the other and run \n" + "| this command again.\n" + "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n" + "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s" + % {'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]', 'n') != '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) @@ -1722,52 +1557,50 @@ 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')) - 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, and this is not yet automated', - 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 """) - tr = repo.transaction('stabilize-divergent') - try: - repo.dirstate.setparents(divergent.node(), node.nullid) - oldlen = len(repo) - amend(ui, repo) - 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.beginparentchange() + repo.dirstate.setparents(divergent.node(), node.nullid) + repo.dirstate.endparentchange() + oldlen = len(repo) + amend(ui, repo, message='', logfile='') + if oldlen == len(repo): + new = divergent + # no changes + else: + new = repo['.'] + obsolete.createmarkers(repo, [(other, (new,))]) + phases.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 @@ -1776,23 +1609,26 @@ XXX this woobly function won't survive XXX """ - for base in ctx._repo.set('reverse(precursors(%d))', ctx): - newer = successorssets(ctx._repo, base.node()) + repo = ctx._repo.unfiltered() + for base in repo.set('reverse(allprecursors(%d))', ctx): + newer = obsolete.successorssets(ctx._repo, base.node()) # drop filter and solution including the original ctx newer = [n for n in newer if n and ctx.node() not in n] if newer: return base, tuple(ctx._repo[o] for o in newer[0]) - raise KeyError('Base seem unknown. This case is not handled yet.') + raise util.Abort("base of divergent changeset %s not found" % ctx, + hint='this case is not yet handled') shorttemplate = '[{rev}] {desc|firstline}\n' -@command('^gdown', - [], - '') -def cmdgdown(ui, repo): - """update to parent an display summary lines""" +@command('^previous', + [('B', 'move-bookmark', False, + _('Move active bookmark after update'))], + '[-B]') +def cmdprevious(ui, repo, **opts): + """update to parent and display summary lines""" wkctx = repo[None] wparents = wkctx.parents() if len(wparents) != 1: @@ -1802,7 +1638,15 @@ displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) if len(parents) == 1: p = parents[0] - hg.update(repo, p.rev()) + bm = bmactive(repo) + shouldmove = opts.get('move_bookmark') and bm is not None + ret = hg.update(repo, p.rev()) + if not ret: + if shouldmove: + repo._bookmarks[bm] = p.node() + repo._bookmarks.write() + else: + bmdeactivate(repo) displayer.show(p) return 0 else: @@ -1811,11 +1655,12 @@ ui.warn(_('multiple parents, explicitly update to one\n')) return 1 -@command('^gup', - [], - '') -def cmdup(ui, repo): - """update to child an display summary lines""" +@command('^next', + [('B', 'move-bookmark', False, + _('Move active bookmark after update'))], + '[-B]') +def cmdnext(ui, repo, **opts): + """update to child and display summary lines""" wkctx = repo[None] wparents = wkctx.parents() if len(wparents) != 1: @@ -1824,69 +1669,211 @@ children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()] displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) if not children: - ui.warn(_('No non-obsolete children\n')) + ui.warn(_('no non-obsolete children\n')) return 1 if len(children) == 1: c = children[0] - hg.update(repo, c.rev()) + bm = bmactive(repo) + shouldmove = opts.get('move_bookmark') and bm is not None + ret = hg.update(repo, c.rev()) + if not ret: + if shouldmove: + repo._bookmarks[bm] = c.node() + repo._bookmarks.write() + else: + bmdeactivate(repo) displayer.show(c) return 0 else: for c in children: displayer.show(c) - ui.warn(_('Multiple non-obsolete children, explicitly update to one\n')) + ui.warn(_('multiple non-obsolete children, ' + 'explicitly update to one of them\n')) return 1 +def _reachablefrombookmark(repo, revs, mark): + """filter revisions and bookmarks reachable from the given bookmark + yoinked from mq.py + """ + marks = repo._bookmarks + if mark not in marks: + raise util.Abort(_("bookmark '%s' not found") % mark) + + # If the requested bookmark is not the only one pointing to a + # a revision we have to only delete the bookmark and not strip + # anything. revsets cannot detect that case. + uniquebm = True + for m, n in marks.iteritems(): + if m != mark and n == repo[mark].node(): + uniquebm = False + break + if uniquebm: + rsrevs = repo.revs("ancestors(bookmark(%s)) - " + "ancestors(head() and not bookmark(%s)) - " + "ancestors(bookmark() and not bookmark(%s)) - " + "obsolete()", + mark, mark, mark) + revs = set(revs) + revs.update(set(rsrevs)) + revs = sorted(revs) + return marks, revs + +def _deletebookmark(ui, marks, mark): + del marks[mark] + marks.write() + ui.write(_("bookmark '%s' deleted\n") % mark) + + + +def _getmetadata(**opts): + metadata = {} + date = opts.get('date') + user = opts.get('user') + if date: + metadata['date'] = '%i %i' % util.parsedate(date) + if user: + metadata['user'] = user + return metadata + + @command('^prune|obsolete|kill', - [('n', 'new', [], _("successor changeset"))], - _('[OPTION] REV...')) -def kill(ui, repo, *revs, **opts): - """mark a changeset as obsolete - - This update the parent directory to a not-killed parent if the current - working directory parent are killed. - - XXX bookmark support - XXX handle merge - XXX check immutable first + [('n', 'new', [], _("successor changeset (DEPRECATED)")), + ('s', 'succ', [], _("successor changeset")), + ('r', 'rev', [], _("revisions to prune")), + ('', 'biject', False, _("do a 1-1 map between rev and successor ranges")), + ('B', 'bookmark', '', _("remove revs only reachable from given" + " bookmark"))] + metadataopts, + _('[OPTION] [-r] REV...')) + # -U --noupdate option to prevent wc update and or bookmarks update ? +def cmdprune(ui, repo, *revs, **opts): + """hide changesets by marking them obsolete + + Obsolete changesets becomes invisible to all commands. + + Unpruned descendants of pruned changesets becomes "unstable". Use the + :hg:`evolve` to handle such situation. + + When the working directory parent is pruned, the repository is updated to a + non-obsolete parent. + + You can use the ``--succ`` option to inform mercurial that a newer version + of the pruned changeset exists. + + You can use the ``--biject`` option to specify a 1-1 (bijection) between + revisions to prune and successor changesets. This option may be removed in + a future release (with the functionality absorbed automatically). + """ - wlock = repo.wlock() + revs = scmutil.revrange(repo, list(revs) + opts.get('rev')) + succs = opts['new'] + opts['succ'] + bookmark = opts.get('bookmark') + metadata = _getmetadata(**opts) + biject = opts.get('biject') + + if bookmark: + marks,revs = _reachablefrombookmark(repo, revs, bookmark) + if not revs: + # no revisions to prune - delete bookmark immediately + _deletebookmark(ui, marks, bookmark) + + if not revs: + raise util.Abort(_('nothing to prune')) + + wlock = lock = None try: + wlock = repo.wlock() lock = repo.lock() - try: - new = set(noderange(repo, opts['new'])) - targetnodes = set(noderange(repo, revs)) - if not targetnodes: - raise util.Abort('nothing to prune') - if new: - sucs = tuple(repo[n] for n in new) - else: - sucs = () - markers = [] - for n in targetnodes: - markers.append((repo[n], sucs)) - createmarkers(repo, markers) - + # defines pruned changesets + precs = [] + revs.sort() + for p in revs: + cp = repo[p] + if not cp.mutable(): + # note: createmarkers() would have raised something anyway + raise util.Abort('cannot prune immutable changeset: %s' % cp, + hint='see "hg help phases" for details') + precs.append(cp) + if not precs: + raise util.Abort('nothing to prune') + + # defines successors changesets + sucs = scmutil.revrange(repo, succs) + sucs.sort() + sucs = tuple(repo[n] for n in sucs) + if not biject and len(sucs) > 1 and len(precs) > 1: + msg = "Can't use multiple successors for multiple precursors" + raise util.Abort(msg) + + if biject and len(sucs) != len(precs): + msg = "Can't use %d successors for %d precursors" \ + % (len(sucs), len(precs)) + raise util.Abort(msg) + + relations = [(p, sucs) for p in precs] + if biject: + relations = [(p, (s,)) for p, s in zip(precs, sucs)] + + # create markers + obsolete.createmarkers(repo, relations, metadata=metadata) + + # informs that changeset have been pruned + ui.status(_('%i changesets pruned\n') % len(precs)) + + wdp = repo['.'] + + if len(sucs) == 1 and len(precs) == 1 and wdp in precs: + # '.' killed, so update to the successor + newnode = sucs[0] + else: # update to an unkilled parent - wdp = repo['.'] newnode = wdp + while newnode.obsolete(): newnode = newnode.parents()[0] - if newnode.node() != wdp.node(): - commands.update(ui, repo, newnode.rev()) - ui.status(_('working directory now at %s\n') % newnode) - finally: - lock.release() + + if newnode.node() != wdp.node(): + bookactive = bmactive(repo) + # Active bookmark that we don't want to delete (with -B option) + # we deactivate and move it before the update and reactivate it + # after + movebookmark = bookactive and not bookmark + if movebookmark: + bmdeactivate(repo) + repo._bookmarks[bookactive] = newnode.node() + repo._bookmarks.write() + commands.update(ui, repo, newnode.rev()) + ui.status(_('working directory now at %s\n') % newnode) + if movebookmark: + bmactivate(repo, bookactive) + + # update bookmarks + if bookmark: + _deletebookmark(ui, marks, bookmark) + for ctx in repo.unfiltered().set('bookmark() and %ld', precs): + # used to be: + # + # ldest = list(repo.set('max((::%d) - obsolete())', ctx)) + # if ldest: + # c = ldest[0] + # + # but then revset took a lazy arrow in the knee and became much + # slower. The new forms makes as much sense and a much faster. + for dest in ctx.ancestors(): + if not dest.obsolete(): + updatebookmarks = _bookmarksupdater(repo, ctx.node()) + updatebookmarks(dest.node()) + break finally: - wlock.release() - -@command('^amend|refresh', + lockmod.release(lock, wlock) + +@command('amend|refresh', [('A', 'addremove', None, _('mark new/missing files as added/removed before committing')), - ('n', 'note', '', _('use text as commit message for this update')), - ('c', 'change', '', _('specifies the changesets to amend (DEPRECATED)'), _('REV')), ('e', 'edit', False, _('invoke editor on commit messages')), - ] + walkopts + commitopts + commitopts2, + ('', '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 + commitopts3 + interactiveopt, _('[OPTION]... [FILE]...')) def amend(ui, repo, *pats, **opts): """combine a changeset with updates and replace it with a new one @@ -1898,10 +1885,6 @@ If you don't specify -m, the parent's message will be reused. - If you specify --change, amend additionally considers all - changesets between the indicated changeset and the working copy - parent as updates to be subsumed. - Behind the scenes, Mercurial first commits the update as a regular child of the current parent. Then it creates a new commit on the parent's parents with the updated contents. Then it changes the working copy parent to this @@ -1910,102 +1893,60 @@ Returns 0 on success, 1 if nothing changed. """ - - # determine updates to subsume - old = scmutil.revsingle(repo, opts.get('change') or '.') - - lock = repo.lock() - try: - wlock = repo.wlock() - try: - if old.phase() == phases.public: - raise util.Abort(_("can not rewrite immutable changeset %s") - % old) - if not repo.revs('%d and (::.)', old): - raise error.Abort(_('cannot amend non ancestor changeset')) - tr = repo.transaction('amend') - try: - oldphase = old.phase() - # commit current changes as update - # code copied from commands.commit to avoid noisy messages - ciopts = dict(opts) - ciopts.pop('message', None) - ciopts.pop('logfile', None) - ciopts['message'] = opts.get('note') or ('amends %s' % old.hex()) - e = cmdutil.commiteditor - def commitfunc(ui, repo, message, match, opts): - return repo.commit(message, opts.get('user'), opts.get('date'), - match, editor=e) - revcount = len(repo) - tempid = cmdutil.commit(ui, repo, commitfunc, pats, ciopts) - if len(repo) == revcount: - # No revision created - tempid = None - - # find all changesets to be considered updates - head = repo['.'] - updatenodes = set(repo.changelog.nodesbetween( - roots=[old.node()], heads=[head.node()])[0]) - updatenodes.remove(old.node()) - okoptions = ['message', 'logfile', 'edit', 'user'] - if not updatenodes: - for o in okoptions: - if opts.get(o): - break - else: - raise error.Abort(_('no updates found')) - updates = [repo[n] for n in updatenodes] - - # perform amend - if opts.get('edit'): - opts['force_editor'] = True - newid, created = rewrite(repo, old, updates, head, - [old.p1().node(), old.p2().node()], opts) - if created: - # reroute the working copy parent to the new changeset - phases.retractboundary(repo, oldphase, [newid]) - repo.dirstate.setparents(newid, node.nullid) - else: - # rewrite() recreated an existing revision, discard - # the intermediate revision if any. No need to update - # phases or parents. - if tempid is not None: - createmarkers(repo, [(repo[tempid], ())]) - # XXX: need another message in collapse case. - tr.close() - raise error.Abort(_('no updates found')) - tr.close() - finally: - tr.release() - finally: - wlock.release() - finally: - lock.release() - -def _commitfiltered(repo, ctx, match): + opts = opts.copy() + edit = opts.pop('edit', False) + log = opts.get('logfile') + opts['amend'] = True + if not (edit or opts['message'] or log): + opts['message'] = repo['.'].description() + _resolveoptions(ui, opts) + _alias, commitcmd = cmdutil.findcmd('commit', commands.table) + return commitcmd[0](ui, repo, *pats, **opts) + + +def _touchedbetween(repo, source, dest, match=None): + touched = set() + for files in repo.status(source, dest, match=match)[:3]: + touched.update(files) + return touched + +def _commitfiltered(repo, ctx, match, target=None): """Recommit ctx with changed files not in match. Return the new node identifier, or None if nothing changed. """ base = ctx.p1() - m, a, r = repo.status(base, ctx)[:3] - allfiles = set(m + a + r) - files = set(f for f in allfiles if not match(f)) - if files == allfiles: + if target is None: + target = base + # ctx + initialfiles = _touchedbetween(repo, base, ctx) + if base == target: + affected = set(f for f in initialfiles if match(f)) + newcontent = set() + else: + affected = _touchedbetween(repo, target, ctx, match=match) + newcontent = _touchedbetween(repo, target, base, match=match) + # The commit touchs all existing files + # + all file that needs a new content + # - the file affected bny uncommit with the same content than base. + files = (initialfiles - affected) | newcontent + if not newcontent and files == initialfiles: return None # Filter copies - copied = copies.pathcopies(base, ctx) + copied = copies.pathcopies(target, ctx) copied = dict((src, dst) for src, dst in copied.iteritems() if dst in files) - def filectxfn(repo, memctx, path): - if path not in ctx: - raise IOError() - fctx = ctx[path] + def filectxfn(repo, memctx, path, contentctx=ctx, redirect=newcontent): + if path in redirect: + return filectxfn(repo, memctx, path, contentctx=target, redirect=()) + if path not in contentctx: + return None + fctx = contentctx[path] flags = fctx.flags() - mctx = context.memfilectx(fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) + mctx = memfilectx(repo, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) return mctx new = context.memctx(repo, @@ -2066,64 +2007,83 @@ @command('^uncommit', [('a', 'all', None, _('uncommit all changes when no arguments given')), + ('r', 'rev', '', _('revert commit content to REV instead')), ] + commands.walkopts, _('[OPTION]... [NAME]')) def uncommit(ui, repo, *pats, **opts): """move changes from parent revision to working directory - Changes to selected files in parent revision appear again as + Changes to selected files in the checked out revision appear again as uncommitted changed in the working directory. A new revision - without selected changes is created, becomes the new parent and - obsoletes the previous one. - - The --include option specify pattern to uncommit - The --exclude option specify pattern to keep in the commit + without the selected changes is created, becomes the checked out + revision, and obsoletes the previous one. + + The --include option specifies patterns to uncommit. + The --exclude option specifies patterns to keep in the commit. + + The --rev argument let you change the commit file to a content of another + revision. It still does not change the content of your file in the working + directory. 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 kill ." 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()) + + + rev = None + if opts.get('rev'): + rev = scmutil.revsingle(repo, opts.get('rev')) + ctx = repo[None] + if ctx.p1() == rev or ctx.p2() == rev: + raise util.Abort(_("cannot uncommit to parent changeset")) + + # 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, target=rev) + if newid is None: + raise util.Abort(_('nothing to uncommit'), + hint=_("use --all to uncommit all files")) + # Move local changes on filtered changeset + obsolete.createmarkers(repo, [(old, (repo[newid],))]) + phases.retractboundary(repo, tr, oldphase, [newid]) + repo.dirstate.beginparentchange() + repo.dirstate.setparents(newid, node.nullid) + _uncommitdirstate(repo, old, match) + repo.dirstate.endparentchange() + 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): if kwargs.get('amend', False): - lock = None + wlock = lock = None else: + wlock = repo.wlock() lock = repo.lock() try: obsoleted = kwargs.get('obsolete', []) @@ -2138,25 +2098,27 @@ oldbookmarks.extend(repo.nodebookmarks(old.node())) markers.append((old, (new,))) if markers: - createmarkers(repo, markers) + obsolete.createmarkers(repo, markers) for book in oldbookmarks: repo._bookmarks[book] = new.node() if oldbookmarks: - bookmarks.write(repo) + repo._bookmarks.write() return result finally: - if lock is not None: - lock.release() + lockmod.release(lock, wlock) @command('^touch', - [('r', 'rev', [], 'revision to update'),], + [('r', 'rev', [], 'revision to update'), + ('D', 'duplicate', False, + 'do not mark the new revision as successor of the old one')], # allow to choose the seed ? _('[-r] revs')) def touch(ui, repo, *revs, **opts): - """Create successors with exact same property but hash + """create successors that are identical to their predecessors except for the changeset ID This is used to "resurrect" changesets """ + duplicate = opts['duplicate'] revs = list(revs) revs.extend(opts['rev']) if not revs: @@ -2165,136 +2127,146 @@ if not revs: ui.write_err('no revision to touch\n') return 1 - if repo.revs('public() and %ld', revs): + if not duplicate and repo.revs('public() and %ld', revs): raise util.Abort("can't touch public revision") - wlock = lock = None + wlock = lock = tr = None try: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction('touch') - try: - for r in revs: - ctx = repo[r] - extra = ctx.extra().copy() - extra['__touch-noise__'] = random.randint(0, 0xffffffff) - new, _ = rewrite(repo, ctx, [], ctx, - [ctx.p1().node(), ctx.p2().node()], - commitopts={'extra': extra}) - createmarkers(repo, [(ctx, (repo[new],))]) - phases.retractboundary(repo, ctx.phase(), [new]) - if ctx in repo[None].parents(): - repo.dirstate.setparents(new, node.nullid) - tr.close() - finally: - tr.release() + revs.sort() # ensure parent are run first + newmapping = {} + for r in revs: + ctx = repo[r] + extra = ctx.extra().copy() + extra['__touch-noise__'] = random.randint(0, 0xffffffff) + # search for touched parent + p1 = ctx.p1().node() + p2 = ctx.p2().node() + p1 = newmapping.get(p1, p1) + p2 = newmapping.get(p2, p2) + 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: + obsolete.createmarkers(repo, [(ctx, (repo[new],))]) + phases.retractboundary(repo, tr, ctx.phase(), [new]) + if ctx in repo[None].parents(): + repo.dirstate.beginparentchange() + repo.dirstate.setparents(new, node.nullid) + repo.dirstate.endparentchange() + tr.close() finally: - lockmod.release(lock, wlock) - -@command('^fold', - [('r', 'rev', [], 'revisions to fold'), - ], - # allow to choose the seed ? - _('[-r] revs')) + lockmod.release(tr, lock, wlock) + +@command('^fold|squash', + [('r', 'rev', [], _("revision to fold")), + ('', 'exact', None, _("only fold specified revisions")) + ] + commitopts + commitopts2, + _('hg fold [OPTION]... [-r] REV')) def fold(ui, repo, *revs, **opts): - """Fold multiple revisions into a single one""" + """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) revs.extend(opts['rev']) - if revs: - revs = scmutil.revrange(repo, revs) 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") - root = repo[roots[0]] + raise util.Abort(_("cannot fold non-linear revisions " + "(multiple roots given)")) + root = repo[roots.first()] 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") - head = repo[heads[0]] + raise util.Abort(_("cannot fold non-linear revisions " + "(multiple heads given)")) + head = repo[heads.first()] wlock = lock = None try: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction('touch') try: + commitopts = opts.copy() allctx = [repo[r] for r in revs] targetphase = max(c.phase() for c in allctx) - msgs = ["HG: This is a fold of %d changesets." % len(allctx)] - msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % - (c.rev(), c.description()) for c in allctx] - 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]) - createmarkers(repo, [(ctx, (repo[newid],)) + + if commitopts.get('message') or commitopts.get('logfile'): + commitopts['edit'] = False + else: + msgs = ["HG: This is a fold of %d changesets." % len(allctx)] + msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % + (c.rev(), c.description()) for c in allctx] + commitopts['message'] = "\n".join(msgs) + commitopts['edit'] = True + + newid, unusedvariable = rewrite(repo, root, allctx, head, + [root.p1().node(), root.p2().node()], + commitopts=commitopts) + phases.retractboundary(repo, tr, targetphase, [newid]) + obsolete.createmarkers(repo, [(ctx, (repo[newid],)) for ctx in allctx]) tr.close() finally: tr.release() ui.status('%i changesets folded\n' % len(revs)) - if repo.revs('. and %ld', revs): + if repo['.'].rev() in revs: hg.update(repo, newid) finally: lockmod.release(lock, wlock) -if 'debugsuccessorssets' not in commands.table: - - @command('debugsuccessorssets', - [], - _('[REV]')) - def debugsuccessorssets(ui, repo, *revs): - """show set of successors for revision - - Successors set of changeset A are a consistent group of revision that - succeed to A. Successors set contains non-obsolete changeset only. - - In most case a changeset A have zero (changeset pruned) or a single - successors set that contains a single successors (changeset A replacement - by A') - - But splitted changeset will result with successors set containing more than - a single element. Divergent rewritting will result in multiple successor - set. - - result is displayed as follows:: - - - - - - - - here rev2 have two possible successors sets. One hold three elements. - - add --debug if you want full size node id. - """ - cache = {} - s = str - if ui.debug: - def s(ctx): - return ctx.hex() - for rev in scmutil.revrange(repo, revs): - ctx = repo[rev] - if ui.debug(): - ui.write('%s\n'% ctx.hex()) - s = node.hex - else: - ui.write('%s\n'% ctx) - s = node.short - for ss in successorssets(repo, ctx.node(), cache): - if ss: - ui.write(' ') - ui.write(s(ss[0])) - for n in ss[1:]: - ui.write(' ') - ui.write(s(n)) - ui.write('\n') - pass @eh.wrapcommand('graft') @@ -2304,8 +2276,10 @@ kwargs['rev'] = [] obsoleted = kwargs.setdefault('obsolete', []) - lock = repo.lock() + wlock = lock = None try: + wlock = repo.wlock() + lock = repo.lock() if kwargs.get('old_obsolete'): if kwargs.get('continue'): obsoleted.extend(repo.opener.read('graftstate').splitlines()) @@ -2315,30 +2289,655 @@ obsoleted[:] = [str(i) for i in repo.revs('%lr', obsoleted)] if obsoleted and len(revs) > 1: - raise error.Abort(_('Can not graft multiple revision while ' + raise error.Abort(_('cannot graft multiple revisions while ' 'obsoleting (for now).')) return commitwrapper(orig, ui, repo,*revs, **kwargs) finally: - lock.release() + lockmod.release(lock, wlock) @eh.extsetup def oldevolveextsetup(ui): - try: - rebase = extensions.find('rebase') - except KeyError: - raise error.Abort(_('evolution extension requires rebase extension.')) - - for cmd in ['amend', 'kill', 'uncommit', 'touch', 'fold']: + for cmd in ['kill', 'uncommit', 'touch', 'fold']: entry = extensions.wrapcommand(cmdtable, cmd, warnobserrors) 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) + +if getattr(exchange, '_pushdiscoveryobsmarkers', None) is not None: + @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers') + def _pushdiscoveryobsmarkers(orig, pushop): + if (obsolete._enabled + and pushop.repo.obsstore + and 'obsolete' in pushop.remote.listkeys('namespaces')): + repo = pushop.repo + obsexcmsg(repo.ui, "computing relevant nodes\n") + revs = list(repo.revs('::%ln', pushop.futureheads)) + unfi = repo.unfiltered() + cl = unfi.changelog + if not pushop.remote.capable('_evoext_obshash_0'): + # do not trust core yet + # return orig(pushop) + nodes = [cl.node(r) for r in revs] + if nodes: + obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n" + % len(nodes)) + pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes) + else: + obsexcmsg(repo.ui, "markers already in sync\n") + pushop.outobsmarkers = [] + pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes) + return + + common = [] + obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" + % len(revs)) + commonrevs = list(unfi.revs('::%ln', pushop.outgoing.commonheads)) + common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, commonrevs) + + 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)) + pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes) + else: + obsexcmsg(repo.ui, "markers already in sync\n") + pushop.outobsmarkers = [] + +@eh.wrapfunction(wireproto, 'capabilities') +def discocapabilities(orig, repo, proto): + """wrapper to advertise new capability""" + caps = orig(repo, proto) + if obsolete._enabled: + caps += ' _evoext_obshash_0' + return caps + +@eh.extsetup +def _installobsmarkersdiscovery(ui): + hgweb_mod.perms['evoext_obshash'] = 'pull' + hgweb_mod.perms['evoext_obshash1'] = 'pull' + # wrap command content + oldcap, args = wireproto.commands['capabilities'] + def newcap(repo, proto): + return discocapabilities(oldcap, repo, proto) + wireproto.commands['capabilities'] = (newcap, args) + wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes') + wireproto.commands['evoext_obshash1'] = (srv_obshash1, 'nodes') + if getattr(exchange, '_pushdiscoveryobsmarkers', None) is None: + ui.warn('evolve: your mercurial version is too old\n' + 'evolve: (running in degraded mode, push will includes all markers)\n') + else: + olddisco = exchange.pushdiscoverymapping['obsmarker'] + def newdisco(pushop): + _pushdiscoveryobsmarkers(olddisco, pushop) + exchange.pushdiscoverymapping['obsmarker'] = newdisco + +### Set discovery START + +from mercurial import dagutil +from mercurial import setdiscovery + +def _obshash(repo, nodes, version=0): + if version == 0: + hashs = _obsrelsethashtreefm0(repo) + elif version ==1: + hashs = _obsrelsethashtreefm1(repo) + else: + assert False + nm = repo.changelog.nodemap + revs = [nm.get(n) for n in nodes] + return [r is None and nullid or hashs[r][1] for r in revs] + +def srv_obshash(repo, proto, nodes): + return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes))) + +def srv_obshash1(repo, proto, nodes): + return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes), version=1)) + +@eh.addattr(localrepo.localpeer, 'evoext_obshash') +def local_obshash(peer, nodes): + return _obshash(peer._repo, nodes) + +@eh.addattr(localrepo.localpeer, 'evoext_obshash1') +def local_obshash1(peer, nodes): + return _obshash(peer._repo, nodes, version=1) + +@eh.addattr(wireproto.wirepeer, 'evoext_obshash') +def peer_obshash(self, nodes): + d = self._call("evoext_obshash", nodes=wireproto.encodelist(nodes)) + try: + return wireproto.decodelist(d) + except ValueError: + self._abort(error.ResponseError(_("unexpected response:"), d)) + +@eh.addattr(wireproto.wirepeer, 'evoext_obshash1') +def peer_obshash1(self, nodes): + d = self._call("evoext_obshash1", nodes=wireproto.encodelist(nodes)) + try: + return wireproto.decodelist(d) + except ValueError: + self._abort(error.ResponseError(_("unexpected response:"), d)) + +def findcommonobsmarkers(ui, local, remote, probeset, + initialsamplesize=100, + fullsamplesize=200): + # from discovery + roundtrips = 0 + cl = local.changelog + dag = dagutil.revlogdag(cl) + missing = set() + common = set() + undecided = set(probeset) + _takefullsample = setdiscovery._takefullsample + if remote.capable('_evoext_obshash_1'): + getremotehash = remote.evoext_obshash1 + localhash = _obsrelsethashtreefm1(local) + else: + getremotehash = remote.evoext_obshash + localhash = _obsrelsethashtreefm0(local) + + while undecided: + + ui.note(_("sampling from both directions\n")) + if len(undecided) < fullsamplesize: + sample = set(undecided) + else: + sample = _takefullsample(dag, undecided, size=fullsamplesize) + + roundtrips += 1 + ui.debug("query %i; still undecided: %i, sample size is: %i\n" + % (roundtrips, len(undecided), len(sample))) + # indices between sample and externalized version must match + sample = list(sample) + remotehash = getremotehash(dag.externalizeall(sample)) + + yesno = [localhash[ix][1] == remotehash[si] + for si, ix in enumerate(sample)] + + commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) + common.update(dag.ancestorset(commoninsample, common)) + + missinginsample = [n for i, n in enumerate(sample) if not yesno[i]] + missing.update(dag.descendantset(missinginsample, missing)) + + undecided.difference_update(missing) + undecided.difference_update(common) + + + result = dag.headsetofconnecteds(common) + ui.debug("%d total queries\n" % roundtrips) + + if not result: + return set([nullid]) + return dag.externalizeall(result) + + +_pushkeyescape = getattr(obsolete, '_pushkeyescape', None) + +class pushobsmarkerStringIO(StringIO): + """hacky string io for progress""" + + @util.propertycache + def length(self): + return len(self.getvalue()) + + def read(self, size=None): + obsexcprg(self.ui, self.tell(), unit="bytes", total=self.length) + return StringIO.read(self, size) + + def __iter__(self): + d = self.read(4096) + while d: + yield d + d = self.read(4096) + +@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') + if util.safehasattr(pushop, 'cgresult'): + cgresult = pushop.cgresult + else: + cgresult = pushop.ret + if cgresult == 0: + return + pushop.ui.debug('try to push obsolete markers to remote\n') + repo = pushop.repo + remote = pushop.remote + if (obsolete._enabled and repo.obsstore and + 'obsolete' in remote.listkeys('namespaces')): + markers = pushop.outobsmarkers + if not markers: + obsexcmsg(repo.ui, "no marker to push\n") + elif remote.capable('_evoext_pushobsmarkers_0'): + obsdata = pushobsmarkerStringIO() + for chunk in obsolete.encodemarkers(markers, True): + obsdata.write(chunk) + obsdata.seek(0) + obsdata.ui = repo.ui + obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n" + % (len(markers), len(obsdata.getvalue())), + True) + remote.evoext_pushobsmarkers_0(obsdata) + obsexcprg(repo.ui, None) + else: + rslts = [] + remotedata = _pushkeyescape(markers).items() + totalbytes = sum(len(d) for k,d in remotedata) + sentbytes = 0 + 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: + obsexcprg(repo.ui, sentbytes, item=key, unit="bytes", + total=totalbytes) + rslts.append(remote.pushkey('obsolete', key, '', data)) + sentbytes += len(data) + 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) + obsexcmsg(repo.ui, "DONE\n") + + +@eh.addattr(wireproto.wirepeer, 'evoext_pushobsmarkers_0') +def client_pushobsmarkers(self, obsfile): + """wireprotocol peer method""" + self.requirecap('_evoext_pushobsmarkers_0', + _('push obsolete markers faster')) + ret, output = self._callpush('evoext_pushobsmarkers_0', obsfile) + for l in output.splitlines(True): + self.ui.status(_('remote: '), l) + return ret + +@eh.addattr(httppeer.httppeer, 'evoext_pushobsmarkers_0') +def httpclient_pushobsmarkers(self, obsfile): + """httpprotocol peer method + (Cannot simply use _callpush as http is doing some special handling)""" + self.requirecap('_evoext_pushobsmarkers_0', + _('push obsolete markers faster')) + try: + r = self._call('evoext_pushobsmarkers_0', data=obsfile) + vals = r.split('\n', 1) + if len(vals) < 2: + raise error.ResponseError(_("unexpected response:"), r) + + for l in vals[1].splitlines(True): + if l.strip(): + self.ui.status(_('remote: '), l) + return vals[0] + except socket.error, err: + if err.args[0] in (errno.ECONNRESET, errno.EPIPE): + raise util.Abort(_('push failed: %s') % err.args[1]) + raise util.Abort(err.args[1]) + +@eh.wrapfunction(localrepo.localrepository, '_restrictcapabilities') +def local_pushobsmarker_capabilities(orig, repo, caps): + caps = orig(repo, caps) + caps.add('_evoext_pushobsmarkers_0') + return caps + +@eh.addattr(localrepo.localpeer, 'evoext_pushobsmarkers_0') +def local_pushobsmarkers(peer, obsfile): + data = obsfile.read() + tr = lock = None + try: + lock = peer._repo.lock() + tr = peer._repo.transaction('pushkey: obsolete markers') + new = peer._repo.obsstore.mergemarkers(tr, data) + if new is not None: + obsexcmsg(peer._repo.ui, "%i obsolescence markers added\n" % new, True) + tr.close() + finally: + lockmod.release(tr, lock) + peer._repo.hook('evolve_pushobsmarkers') + +def srv_pushobsmarkers(repo, proto): + """wireprotocol command""" + fp = StringIO() + proto.redirect() + proto.getfile(fp) + data = fp.getvalue() + fp.close() + tr = lock = None + try: + lock = repo.lock() + tr = repo.transaction('pushkey: obsolete markers') + new = repo.obsstore.mergemarkers(tr, data) + if new is not None: + obsexcmsg(repo.ui, "%i obsolescence markers added\n" % new, True) + tr.close() + finally: + lockmod.release(tr, lock) + repo.hook('evolve_pushobsmarkers') + return wireproto.pushres(0) + +def _buildpullobsmarkersboundaries(pullop): + """small funtion returning the argument for pull markers call + may to contains 'heads' and 'common'. skip the key for None. + + Its a separed functio to play around with strategy for that.""" + repo = pullop.repo + remote = pullop.remote + unfi = repo.unfiltered() + revs = unfi.revs('::(%ln - null)', pullop.common) + common = [nullid] + if remote.capable('_evoext_obshash_0'): + 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} + +@eh.uisetup +def addgetbundleargs(self): + gboptsmap['evo_obscommon'] = 'nodes' + +@eh.wrapfunction(exchange, '_pullbundle2extraprepare') +def _addobscommontob2pull(orig, pullop, kwargs): + ret = orig(pullop, kwargs) + if 'obsmarkers' in kwargs and pullop.remote.capable('_evoext_getbundle_obscommon'): + boundaries = _buildpullobsmarkersboundaries(pullop) + common = boundaries['common'] + if common != [nullid]: + kwargs['evo_obscommon'] = common + return ret + +if getattr(exchange, '_getbundleobsmarkerpart', None) is not None: + @eh.wrapfunction(exchange, '_getbundleobsmarkerpart') + def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs): + if 'evo_obscommon' not in kwargs: + return orig(bundler, repo, source, **kwargs) + + heads = kwargs.get('heads') + if kwargs.get('obsmarkers', False): + if heads is None: + heads = repo.heads() + obscommon = kwargs.get('evo_obscommon', ()) + assert obscommon + obsset = repo.unfiltered().set('::%ln - ::%ln', heads, obscommon) + subset = [c.node() for c in obsset] + markers = repo.obsstore.relevantmarkers(subset) + exchange.buildobsmarkerspart(bundler, markers) + + @eh.uisetup + def installgetbundlepartgen(ui): + origfunc = exchange.getbundle2partsmapping['obsmarkers'] + def newfunc(*args, **kwargs): + return _getbundleobsmarkerpart(origfunc, *args, **kwargs) + exchange.getbundle2partsmapping['obsmarkers'] = newfunc + + +@eh.wrapfunction(exchange, '_pullobsolete') +def _pullobsolete(orig, pullop): + if not obsolete._enabled: + return None + if 'obsmarkers' not in getattr(pullop, 'todosteps', ['obsmarkers']): + return None + if 'obsmarkers' in getattr(pullop, 'stepsdone', []): + return None + wirepull = pullop.remote.capable('_evoext_pullobsmarkers_0') + if not wirepull: + return orig(pullop) + if 'obsolete' not in pullop.remote.listkeys('namespaces'): + return None # remote opted out of obsolescence marker exchange + tr = None + ui = pullop.repo.ui + boundaries = _buildpullobsmarkersboundaries(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 wirepull: + obsdata = pullop.remote.evoext_pullobsmarkers_0(**boundaries) + obsdata = obsdata.read() + if len(obsdata) > 5: + 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 + obsexcmsg(ui, "%i obsolescence markers added\n" % new, True) + else: + obsexcmsg(ui, "no unknown remote markers\n") + obsexcmsg(ui, "DONE\n") + if new: + pullop.repo.invalidatevolatilesets() + return tr + +def _getobsmarkersstream(repo, heads=None, common=None): + revset = '' + args = [] + repo = repo.unfiltered() + if heads is None: + revset = 'all()' + elif heads: + revset += "(::%ln)" + args.append(heads) + else: + assert False, 'pulling no heads?' + if common: + revset += ' - (::%ln)' + args.append(common) + nodes = [c.node() for c in repo.set(revset, *args)] + markers = repo.obsstore.relevantmarkers(nodes) + obsdata = StringIO() + for chunk in obsolete.encodemarkers(markers, True): + obsdata.write(chunk) + obsdata.seek(0) + return obsdata + +@eh.addattr(wireproto.wirepeer, 'evoext_pullobsmarkers_0') +def client_pullobsmarkers(self, heads=None, common=None): + self.requirecap('_evoext_pullobsmarkers_0', _('look up remote obsmarkers')) + opts = {} + if heads is not None: + opts['heads'] = wireproto.encodelist(heads) + if common is not None: + opts['common'] = wireproto.encodelist(common) + if util.safehasattr(self, '_callcompressable'): + f = self._callcompressable("evoext_pullobsmarkers_0", **opts) + else: + f = self._callstream("evoext_pullobsmarkers_0", **opts) + f = self._decompress(f) + length = int(f.read(20)) + chunk = 4096 + current = 0 + data = StringIO() + ui = self.ui + obsexcprg(ui, current, unit="bytes", total=length) + while current < length: + readsize = min(length-current, chunk) + data.write(f.read(readsize)) + current += readsize + obsexcprg(ui, current, unit="bytes", total=length) + obsexcprg(ui, None) + data.seek(0) + return data + +@eh.addattr(localrepo.localpeer, 'evoext_pullobsmarkers_0') +def local_pullobsmarkers(self, heads=None, common=None): + return _getobsmarkersstream(self._repo, heads=heads, common=common) + +def srv_pullobsmarkers(repo, proto, others): + opts = wireproto.options('', ['heads', 'common'], others) + for k, v in opts.iteritems(): + if k in ('heads', 'common'): + opts[k] = wireproto.decodelist(v) + obsdata = _getobsmarkersstream(repo, **opts) + finaldata = StringIO() + obsdata = obsdata.getvalue() + finaldata.write('%20i' % len(obsdata)) + finaldata.write(obsdata) + finaldata.seek(0) + return wireproto.streamres(proto.groupchunks(finaldata)) + +def _obsrelsethashtreefm0(repo): + return _obsrelsethashtree(repo, obsolete._fm0encodeonemarker) + +def _obsrelsethashtreefm1(repo): + return _obsrelsethashtree(repo, obsolete._fm1encodeonemarker) + +def _obsrelsethashtree(repo, encodeonemarker): + cache = [] + unfi = repo.unfiltered() + markercache = {} + for i in unfi: + ctx = unfi[i] + entry = 0 + sha = util.sha1() + # add data from p1 + for p in ctx.parents(): + p = p.rev() + if p < 0: + p = nullid + else: + p = cache[p][1] + if p != nullid: + entry += 1 + sha.update(p) + tmarkers = repo.obsstore.relevantmarkers([ctx.node()]) + if tmarkers: + bmarkers = [] + for m in tmarkers: + if not m in markercache: + markercache[m] = encodeonemarker(m) + bmarkers.append(markercache[m]) + bmarkers.sort() + for m in bmarkers: + entry += 1 + sha.update(m) + if entry: + cache.append((ctx.node(), sha.digest())) + else: + cache.append((ctx.node(), nullid)) + return cache + +@command('debugobsrelsethashtree', + [('', 'v0', None, 'hash on marker format "0"'), + ('', 'v1', None, 'hash on marker format "1" (default)') + ,] , _('')) +def debugobsrelsethashtree(ui, repo, v0=False, v1=False): + """display Obsolete markers, Relevant Set, Hash Tree + changeset-node obsrelsethashtree-node + + It computed form the "orsht" of its parent and markers + relevant to the changeset itself.""" + if v0 and v1: + raise util.Abort('cannot only specify one format') + elif v0: + treefunc = _obsrelsethashtreefm0 + else: + treefunc = _obsrelsethashtreefm1 + + for chg, obs in treefunc(repo): + ui.status('%s %s\n' % (node.hex(chg), node.hex(obs))) + +_bestformat = max(obsolete.formats.keys()) + + +if getattr(obsolete, '_checkinvalidmarkers', None) is not None: + @eh.wrapfunction(obsolete, '_checkinvalidmarkers') + def _checkinvalidmarkers(orig, markers): + """search for marker with invalid data and raise error if needed + + Exist as a separated function to allow the evolve extension for a more + subtle handling. + """ + if 'debugobsconvert' in sys.argv: + return + for mark in markers: + if node.nullid in mark[1]: + raise util.Abort(_('bad obsolescence marker detected: ' + 'invalid successors nullid'), + hint=_('You should run `hg debugobsconvert`')) + +@command( + 'debugobsconvert', + [('', 'new-format', _bestformat, _('Destination format for markers.'))], + '') +def debugobsconvert(ui, repo, new_format): + if new_format == repo.obsstore._version: + msg = _('New format is the same as the old format, not upgrading!') + raise util.Abort(msg) + f = repo.sopener('obsstore', 'wb', atomictemp=True) + origmarkers = repo.obsstore._all + known = set() + markers = [] + for m in origmarkers: + # filter out invalid markers + if nullid in m[1]: + m = list(m) + m[1] = tuple(s for s in m[1] if s != nullid) + m = tuple(m) + if m in known: + continue + known.add(m) + markers.append(m) + ui.write(_('Old store is version %d, will rewrite in version %d\n') % ( + repo.obsstore._version, new_format)) + map(f.write, obsolete.encodemarkers(markers, True, new_format)) + f.close() + ui.write(_('Done!\n')) + + +@eh.wrapfunction(wireproto, 'capabilities') +def capabilities(orig, repo, proto): + """wrapper to advertise new capability""" + caps = orig(repo, proto) + if obsolete._enabled: + caps += ' _evoext_pushobsmarkers_0' + caps += ' _evoext_pullobsmarkers_0' + caps += ' _evoext_obshash_0' + caps += ' _evoext_obshash_1' + caps += ' _evoext_getbundle_obscommon' + return caps + + +@eh.extsetup +def _installwireprotocol(ui): + localrepo.moderncaps.add('_evoext_pullobsmarkers_0') + hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push' + hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull' + wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') + wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') + # wrap command content + oldcap, args = wireproto.commands['capabilities'] + def newcap(repo, proto): + return capabilities(oldcap, repo, proto) + wireproto.commands['capabilities'] = (newcap, args) diff -r eccfd01aec56 -r 8a20b2774a65 hgext/obsolete.py --- a/hgext/obsolete.py Tue Jun 23 16:47:47 2015 -0700 +++ b/hgext/obsolete.py Tue Jun 23 16:49:53 2015 -0700 @@ -96,7 +96,7 @@ 'user': ui.username(), } try: - store.create(tr, prec, sucs, 0, meta) + store.create(tr, prec, sucs, 0, metadata=meta) cnt += 1 except ValueError: repo.ui.write_err("invalid old marker line: %s" @@ -135,7 +135,7 @@ succs = [bin(n) for n in oldsubjects] succs = [n for n in succs if n != nullid] store.create(tr, bin(oldobject), succs, - 0, meta) + 0, metadata=meta) cnt += 1 except ValueError: repo.ui.write_err("invalid marker %s -> %s\n" diff -r eccfd01aec56 -r 8a20b2774a65 hgext/pushexperiment.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/pushexperiment.py Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,112 @@ +"""Small extension altering some push behavior + +- Add a new wire protocol command to exchange obsolescence markers. Sending the + raw file as a binary instead of using pushkey hack. +- Add a "push done" notification +- Push obsolescence marker before anything else (This works around the lack of global transaction) + +""" + +import errno +from StringIO import StringIO + +from mercurial.i18n import _ +from mercurial import extensions +from mercurial import wireproto +from mercurial import obsolete +from mercurial import localrepo + + +def client_pushobsmarkers(self, obsfile): + """wireprotocol peer method""" + self.requirecap('_push_experiment_pushobsmarkers_0', + _('push obsolete markers faster')) + ret, output = self._callpush('push_experiment_pushobsmarkers_0', obsfile) + for l in output.splitlines(True): + self.ui.status(_('remote: '), l) + return ret + + +def srv_pushobsmarkers(repo, proto): + """wireprotocol command""" + fp = StringIO() + proto.redirect() + proto.getfile(fp) + data = fp.getvalue() + fp.close() + lock = repo.lock() + try: + tr = repo.transaction('pushkey: obsolete markers') + try: + repo.obsstore.mergemarkers(tr, data) + tr.close() + finally: + tr.release() + finally: + lock.release() + return wireproto.pushres(0) + + +def syncpush(orig, repo, remote): + """wraper for obsolete.syncpush to use the fast way if possible""" + if not (obsolete._enabled and repo.obsstore): + return + if remote.capable('_push_experiment_pushobsmarkers_0'): + return # already pushed before changeset + remote.push_experiment_pushobsmarkers_0(obsfp) + return + return orig(repo, remote) + + +def client_notifypushend(self): + """wire peer command to notify a push is done""" + self.requirecap('_push_experiment_notifypushend_0', _('hook once push is all done')) + return self._call('push_experiment_notifypushend_0') + + +def srv_notifypushend(repo, proto): + """wire protocol command to notify a push is done""" + proto.redirect() + repo.hook('notifypushend') + return wireproto.pushres(0) + + +def augmented_push(orig, repo, remote, *args, **kwargs): + """push wrapped that call the wire protocol command""" + if not remote.canpush(): + raise util.Abort(_("destination does not support push")) + if (obsolete._enabled and repo.obsstore + and remote.capable('_push_experiment_pushobsmarkers_0')): + # push marker early to limit damage of pushing too early. + try: + obsfp = repo.sopener('obsstore') + except IOError as e: + if e.errno != errno.ENOENT: + raise + else: + remote.push_experiment_pushobsmarkers_0(obsfp) + ret = orig(repo, remote, *args, **kwargs) + if remote.capable('_push_experiment_notifypushend_0'): + remote.push_experiment_notifypushend_0() + return ret + + +def capabilities(orig, repo, proto): + """wrapper to advertise new capability""" + caps = orig(repo, proto) + if obsolete._enabled: + caps += ' _push_experiment_pushobsmarkers_0' + caps += ' _push_experiment_notifypushend_0' + return caps + + +def extsetup(ui): + wireproto.wirepeer.push_experiment_pushobsmarkers_0 = client_pushobsmarkers + wireproto.wirepeer.push_experiment_notifypushend_0 = client_notifypushend + wireproto.commands['push_experiment_pushobsmarkers_0'] = (srv_pushobsmarkers, '') + wireproto.commands['push_experiment_notifypushend_0'] = (srv_notifypushend, '') + extensions.wrapfunction(wireproto, 'capabilities', capabilities) + extensions.wrapfunction(obsolete, 'syncpush', syncpush) + extensions.wrapfunction(localrepo.localrepository, 'push', augmented_push) + + diff -r eccfd01aec56 -r 8a20b2774a65 hgext/qsync.py --- a/hgext/qsync.py Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -# Copyright 2011 Logilab SA -"""synchronize patches queues and evolving changesets""" - -import re -from cStringIO import StringIO -import json - -from mercurial.i18n import _ -from mercurial import commands -from mercurial import patch -from mercurial import util -from mercurial.node import nullid, hex, short, bin -from mercurial import cmdutil -from mercurial import hg -from mercurial import scmutil -from mercurial import error -from mercurial import extensions -from mercurial import phases - -### old compat code -############################# - -BRANCHNAME="qsubmit2" - -### new command -############################# -cmdtable = {} -command = cmdutil.command(cmdtable) - -@command('^qsync|sync', - [ - ('a', 'review-all', False, _('mark all touched patches ready for review (no editor)')), - ], - '') -def cmdsync(ui, repo, **opts): - '''Export draft changeset as mq patch in a mq patches repository commit. - - This command get all changesets in draft phase and create an mq changeset: - - * on a "qsubmit2" branch (based on the last changeset) - - * one patch per draft changeset - - * a series files listing all generated patch - - * qsubmitdata holding useful information - - It does use obsolete relation to update patches that already existing in the qsubmit2 branch. - - Already existing patch which became public, draft or got killed are remove from the mq repo. - - Patch name are generated using the summary line for changeset description. - - .. warning:: Series files is ordered topologically. So two series with - interleaved changeset will appear interleaved. - ''' - - review = 'edit' - if opts['review_all']: - review = 'all' - mqrepo = repo.mq.qrepo() - if mqrepo is None: - raise util.Abort('No patches repository') - - try: - parent = mqrepo[BRANCHNAME] - except error.RepoLookupError: - parent = initqsubmit(mqrepo) - store, data, touched = fillstore(repo, parent) - try: - if not touched: - raise util.Abort('Nothing changed') - files = ['qsubmitdata', 'series'] + touched - # mark some as ready for review - message = 'qsubmit commit\n\n' - review_list = [] - applied_list = [] - if review: - olddata = get_old_data(parent) - oldfiles = dict([(name, bin(ctxhex)) for ctxhex, name in olddata]) - - for patch_name in touched: - try: - store.getfile(patch_name) - review_list.append(patch_name) - except IOError: - oldnode = oldfiles[patch_name] - evolve = extensions.find('evolve') - newnodes = evolve.successorssets(repo, oldnode) - if newnodes: - newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing - if not newnodes: - # changeset has been killed (eg. reject) - pass - else: - assert len(newnodes) == 1 # conflict!!! - newnode = newnodes[0] - assert len(newnode) == 1 # split unsupported for now - newnode = list(newnode)[0] - # XXX unmanaged case where a cs is obsoleted by an unavailable one - #if newnode.node() not in repo.changelog.nodemap: - # raise util.Abort('%s is obsoleted by an unknown node %s'% (oldnode, newnode)) - ctx = repo[newnode] - if ctx.phase() == phases.public: - # applied - applied_list.append(patch_name) - elif ctx.phase() == phases.secret: - # already exported changeset is now secret - repo.ui.warn("An already exported changeset is now secret!!!") - else: - # draft - assert False, "Should be exported" - - if review: - if applied_list: - message += '\n'.join('* applied %s' % x for x in applied_list) + '\n' - if review_list: - message += '\n'.join('* %s ready for review' % x for x in review_list) + '\n' - memctx = patch.makememctx(mqrepo, (parent.node(), nullid), - message, - None, - None, - parent.branch(), files, store, - editor=None) - if review == 'edit': - memctx._text = cmdutil.commitforceeditor(mqrepo, memctx, []) - mqrepo.savecommitmessage(memctx.description()) - n = memctx.commit() - finally: - store.close() - return 0 - - -def makename(ctx): - """create a patch name form a changeset""" - descsummary = ctx.description().splitlines()[0] - descsummary = re.sub(r'\s+', '_', descsummary) - descsummary = re.sub(r'\W+', '', descsummary) - if len(descsummary) > 45: - descsummary = descsummary[:42] + '.' - return '%s-%s.diff' % (ctx.branch().upper(), descsummary) - - -def get_old_data(mqctx): - """read qsubmit data to fetch previous export data - - get old data from the content of an mq commit""" - try: - old_data = mqctx['qsubmitdata'] - return json.loads(old_data.data()) - except error.LookupError: - return [] - -def get_current_data(repo): - """Return what would be exported if no previous data exists""" - data = [] - for ctx in repo.set('draft() - (obsolete() + merge())'): - name = makename(ctx) - data.append([ctx.hex(), makename(ctx)]) - merges = repo.revs('draft() and merge()') - if merges: - repo.ui.warn('ignoring %i merge\n' % len(merges)) - return data - - -def patchmq(repo, store, olddata, newdata): - """export the mq patches and return all useful data to be exported""" - finaldata = [] - touched = set() - currentdrafts = set(d[0] for d in newdata) - usednew = set() - usedold = set() - evolve = extensions.find('evolve') - for oldhex, oldname in olddata: - if oldhex in usedold: - continue # no duplicate - usedold.add(oldhex) - oldname = str(oldname) - oldnode = bin(oldhex) - newnodes = evolve.successorssets(repo, oldnode) - if newnodes: - newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing - if len(newnodes) > 1: - newnodes = [short(nodes[0]) for nodes in newnodes] - raise util.Abort('%s have more than one newer version: %s'% (oldname, newnodes)) - if newnodes: - # else, changeset have been killed - newnode = list(newnodes)[0][0] - ctx = repo[newnode] - if ctx.hex() != oldhex and ctx.phase(): - fp = StringIO() - cmdutil.export(repo, [ctx.rev()], fp=fp) - data = fp.getvalue() - store.setfile(oldname, data, (None, None)) - finaldata.append([ctx.hex(), oldname]) - usednew.add(ctx.hex()) - touched.add(oldname) - continue - if oldhex in currentdrafts: - # else changeset is now public or secret - finaldata.append([oldhex, oldname]) - usednew.add(ctx.hex()) - continue - touched.add(oldname) - - for newhex, newname in newdata: - if newhex in usednew: - continue - newnode = bin(newhex) - ctx = repo[newnode] - fp = StringIO() - cmdutil.export(repo, [ctx.rev()], fp=fp) - data = fp.getvalue() - store.setfile(newname, data, (None, None)) - finaldata.append([ctx.hex(), newname]) - touched.add(newname) - # sort by branchrev number - finaldata.sort(key=lambda x: sort_key(repo[x[0]])) - # sort touched too (ease review list) - stouched = [f[1] for f in finaldata if f[1] in touched] - stouched += [x for x in touched if x not in stouched] - return finaldata, stouched - -def sort_key(ctx): - """ctx sort key: (branch, rev)""" - return (ctx.branch(), ctx.rev()) - - -def fillstore(repo, basemqctx): - """fill store with patch data""" - olddata = get_old_data(basemqctx) - newdata = get_current_data(repo) - store = patch.filestore() - try: - data, touched = patchmq(repo, store, olddata, newdata) - # put all name in the series - series ='\n'.join(d[1] for d in data) + '\n' - store.setfile('series', series, (False, False)) - - # export data to ease futur work - store.setfile('qsubmitdata', json.dumps(data, indent=True), - (False, False)) - except: - store.close() - raise - return store, data, touched - - -def initqsubmit(mqrepo): - """create initial qsubmit branch""" - store = patch.filestore() - try: - files = set() - store.setfile('DO-NOT-EDIT-THIS-WORKING-COPY-BY-HAND', 'WE WARNED YOU!', (False, False)) - store.setfile('.hgignore', '^status$\n', (False, False)) - memctx = patch.makememctx(mqrepo, (nullid, nullid), - 'qsubmit init', - None, - None, - BRANCHNAME, ('.hgignore',), store, - editor=None) - mqrepo.savecommitmessage(memctx.description()) - n = memctx.commit() - finally: - store.close() - return mqrepo[n] diff -r eccfd01aec56 -r 8a20b2774a65 hgext/simple4server.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/simple4server.py Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,304 @@ +'''enable experimental obsolescence feature of Mercurial + +OBSOLESCENCE IS AN EXPERIMENTAL FEATURE MAKE SURE YOU UNDERSTOOD THE INVOLVED +CONCEPT BEFORE USING IT. + +/!\ THIS EXTENSION IS INTENDED FOR SERVER SIDE ONLY USAGE /!\ + +For client side usages it is recommended to use the evolve extension for +improved user interface.''' + +testedwith = '3.3.3 3.4-rc' +buglink = 'http://bz.selenic.com/' + +import mercurial.obsolete +mercurial.obsolete._enabled = True + +import struct +from mercurial import util +from mercurial import wireproto +from mercurial import extensions +from mercurial import obsolete +from cStringIO import StringIO +from mercurial import node +from mercurial.hgweb import hgweb_mod +from mercurial import bundle2 +from mercurial import localrepo +from mercurial import exchange +from mercurial import node +_pack = struct.pack + +gboptslist = gboptsmap = None +try: + from mercurial import obsolete + if not obsolete._enabled: + obsolete._enabled = True + from mercurial import wireproto + gboptslist = getattr(wireproto, 'gboptslist', None) + gboptsmap = getattr(wireproto, 'gboptsmap', None) +except (ImportError, AttributeError): + raise util.Abort('Your Mercurial is too old for this version of Evolve\n' + 'requires version 3.0.1 or above') + +# Start of simple4server specific content + +from mercurial import pushkey + +# specific content also include the wrapping int extsetup +def _nslist(orig, repo): + rep = orig(repo) + if not repo.ui.configbool('__temporary__', 'advertiseobsolete', True): + rep.pop('obsolete') + return rep + +# End of simple4server specific content + + + +# from evolve extension: 1a23c7c52a43 +def srv_pushobsmarkers(repo, proto): + """That receives a stream of markers and apply then to the repo""" + fp = StringIO() + proto.redirect() + proto.getfile(fp) + data = fp.getvalue() + fp.close() + lock = repo.lock() + try: + tr = repo.transaction('pushkey: obsolete markers') + try: + repo.obsstore.mergemarkers(tr, data) + tr.close() + finally: + tr.release() + finally: + lock.release() + repo.hook('evolve_pushobsmarkers') + return wireproto.pushres(0) + +# from evolve extension: 1a23c7c52a43 +def _getobsmarkersstream(repo, heads=None, common=None): + """Get a binary stream for all markers relevant to `:: - ::` + """ + revset = '' + args = [] + repo = repo.unfiltered() + if heads is None: + revset = 'all()' + elif heads: + revset += "(::%ln)" + args.append(heads) + else: + assert False, 'pulling no heads?' + if common: + revset += ' - (::%ln)' + args.append(common) + nodes = [c.node() for c in repo.set(revset, *args)] + markers = repo.obsstore.relevantmarkers(nodes) + obsdata = StringIO() + for chunk in obsolete.encodemarkers(markers, True): + obsdata.write(chunk) + obsdata.seek(0) + return obsdata + +if not util.safehasattr(obsolete.obsstore, 'relevantmarkers'): + # from evolve extension: 1a23c7c52a43 + class pruneobsstore(obsolete.obsstore): + """And extended obsstore class that read parent information from v1 format + + Evolve extension adds parent information in prune marker. We use it to make + markers relevant to pushed changeset.""" + + def __init__(self, *args, **kwargs): + self.prunedchildren = {} + return super(pruneobsstore, self).__init__(*args, **kwargs) + + def _load(self, markers): + markers = self._prunedetectingmarkers(markers) + return super(pruneobsstore, self)._load(markers) + + + def _prunedetectingmarkers(self, markers): + for m in markers: + if not m[1]: # no successors + meta = obsolete.decodemeta(m[3]) + if 'p1' in meta: + p1 = node.bin(meta['p1']) + self.prunedchildren.setdefault(p1, set()).add(m) + if 'p2' in meta: + p2 = node.bin(meta['p2']) + self.prunedchildren.setdefault(p2, set()).add(m) + yield m + + # from evolve extension: 1a23c7c52a43 + def relevantmarkers(self, nodes): + """return a set of all obsolescence marker relevant to a set of node. + + "relevant" to a set of node mean: + + - marker that use this changeset as successors + - prune marker of direct children on this changeset. + - recursive application of the two rules on precursors of these markers + + It is a set so you cannot rely on order""" + seennodes = set(nodes) + seenmarkers = set() + pendingnodes = set(nodes) + precursorsmarkers = self.precursors + prunedchildren = self.prunedchildren + while pendingnodes: + direct = set() + for current in pendingnodes: + direct.update(precursorsmarkers.get(current, ())) + direct.update(prunedchildren.get(current, ())) + direct -= seenmarkers + pendingnodes = set([m[0] for m in direct]) + seenmarkers |= direct + pendingnodes -= seennodes + seennodes |= pendingnodes + return seenmarkers + +# from evolve extension: cf35f38d6a10 +def srv_pullobsmarkers(repo, proto, others): + """serves a binary stream of markers. + + Serves relevant to changeset between heads and common. The stream is prefix + by a -string- representation of an integer. This integer is the size of the + stream.""" + opts = wireproto.options('', ['heads', 'common'], others) + for k, v in opts.iteritems(): + if k in ('heads', 'common'): + opts[k] = wireproto.decodelist(v) + obsdata = _getobsmarkersstream(repo, **opts) + finaldata = StringIO() + obsdata = obsdata.getvalue() + finaldata.write('%20i' % len(obsdata)) + finaldata.write(obsdata) + finaldata.seek(0) + return wireproto.streamres(proto.groupchunks(finaldata)) + + +# from evolve extension: 3249814dabd1 +def _obsrelsethashtreefm0(repo): + return _obsrelsethashtree(repo, obsolete._fm0encodeonemarker) + +# from evolve extension: 3249814dabd1 +def _obsrelsethashtreefm1(repo): + return _obsrelsethashtree(repo, obsolete._fm1encodeonemarker) + +# from evolve extension: 3249814dabd1 +def _obsrelsethashtree(repo, encodeonemarker): + cache = [] + unfi = repo.unfiltered() + markercache = {} + for i in unfi: + ctx = unfi[i] + entry = 0 + sha = util.sha1() + # add data from p1 + for p in ctx.parents(): + p = p.rev() + if p < 0: + p = node.nullid + else: + p = cache[p][1] + if p != node.nullid: + entry += 1 + sha.update(p) + tmarkers = repo.obsstore.relevantmarkers([ctx.node()]) + if tmarkers: + bmarkers = [] + for m in tmarkers: + if not m in markercache: + markercache[m] = encodeonemarker(m) + bmarkers.append(markercache[m]) + bmarkers.sort() + for m in bmarkers: + entry += 1 + sha.update(m) + if entry: + cache.append((ctx.node(), sha.digest())) + else: + cache.append((ctx.node(), node.nullid)) + return cache + +# from evolve extension: 3249814dabd1 +def _obshash(repo, nodes, version=0): + if version == 0: + hashs = _obsrelsethashtreefm0(repo) + elif version ==1: + hashs = _obsrelsethashtreefm1(repo) + else: + assert False + nm = repo.changelog.nodemap + revs = [nm.get(n) for n in nodes] + return [r is None and node.nullid or hashs[r][1] for r in revs] + +# from evolve extension: 3249814dabd1 +def srv_obshash(repo, proto, nodes): + return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes))) + +# from evolve extension: 3249814dabd1 +def srv_obshash1(repo, proto, nodes): + return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes), version=1)) + +# from evolve extension: 3249814dabd1 +def capabilities(orig, repo, proto): + """wrapper to advertise new capability""" + caps = orig(repo, proto) + advertise = repo.ui.configbool('__temporary__', 'advertiseobsolete', True) + if obsolete._enabled and advertise: + caps += ' _evoext_pushobsmarkers_0' + caps += ' _evoext_pullobsmarkers_0' + caps += ' _evoext_obshash_0' + caps += ' _evoext_obshash_1' + caps += ' _evoext_getbundle_obscommon' + return caps + +def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs): + if 'evo_obscommon' not in kwargs: + return orig(bundler, repo, source, **kwargs) + + heads = kwargs.get('heads') + if 'evo_obscommon' not in kwargs: + return orig(bundler, repo, source, **kwargs) + + if kwargs.get('obsmarkers', False): + if heads is None: + heads = repo.heads() + obscommon = kwargs.get('evo_obscommon', ()) + obsset = repo.set('::%ln - ::%ln', heads, obscommon) + subset = [c.node() for c in obsset] + markers = repo.obsstore.relevantmarkers(subset) + exchange.buildobsmarkerspart(bundler, markers) + +# from evolve extension: 10867a8e27c6 +# heavily modified +def extsetup(ui): + localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0') + gboptsmap['evo_obscommon'] = 'nodes' + if not util.safehasattr(obsolete.obsstore, 'relevantmarkers'): + obsolete.obsstore = pruneobsstore + obsolete.obsstore.relevantmarkers = relevantmarkers + hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push' + hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull' + hgweb_mod.perms['evoext_obshash'] = 'pull' + wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') + wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') + # wrap module content + origfunc = exchange.getbundle2partsmapping['obsmarkers'] + def newfunc(*args, **kwargs): + return _getbundleobsmarkerpart(origfunc, *args, **kwargs) + exchange.getbundle2partsmapping['obsmarkers'] = newfunc + extensions.wrapfunction(wireproto, 'capabilities', capabilities) + # wrap command content + oldcap, args = wireproto.commands['capabilities'] + def newcap(repo, proto): + return capabilities(oldcap, repo, proto) + wireproto.commands['capabilities'] = (newcap, args) + wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes') + wireproto.commands['evoext_obshash1'] = (srv_obshash1, 'nodes') + # specific simple4server content + extensions.wrapfunction(pushkey, '_nslist', _nslist) + pushkey._namespaces['namespaces'] = (lambda *x: False, pushkey._nslist) + diff -r eccfd01aec56 -r 8a20b2774a65 setup.py --- a/setup.py Tue Jun 23 16:47:47 2015 -0700 +++ b/setup.py Tue Jun 23 16:49:53 2015 -0700 @@ -2,13 +2,24 @@ # Credit to Augie Fackler from distutils.core import setup +from os.path import dirname, join + +def get_version(relpath): + '''Read version info from a file without importing it''' + for line in open(join(dirname(__file__), relpath), 'rb'): + # Decode to a fail-safe string for PY3 + # (gives unicode object in PY2) + line = line.decode('utf8') + if '__version__' in line: + if "'" in line: + return line.split("'")[1] setup( name='hg-evolve', - version='1.1.0', + version=get_version('hgext/evolve.py'), author='Pierre-Yves David', maintainer='Pierre-Yves David', - maintainer_email='pierre-yves.david@logilab.fr', + maintainer_email='pierre-yves.david@ens-lyon.org', url='https://bitbucket.org/marmoute/mutable-history', description='Flexible evolution of Mercurial history.', long_description=open('README').read(), diff -r eccfd01aec56 -r 8a20b2774a65 tests/_exc-util.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/_exc-util.sh Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,110 @@ +#!/bin/sh + +cat >> $HGRCPATH <> $HGRCPATH + +mkcommit() { + echo "$1" > "$1" + hg add "$1" + hg ci -m "$1" +} +getid() { + hg log --hidden --template '{node}\n' --rev "$1" +} + +setuprepos() { + echo creating test repo for test case $1 + mkdir $1 + cd $1 + echo - pulldest + hg init pushdest + cd pushdest + mkcommit O + hg phase --public . + cd .. + echo - main + hg clone -q pushdest main + echo - pushdest + hg clone -q main pulldest + echo 'cd into `main` and proceed with env setup' +} + +dotest() { +# dotest TESTNAME [TARGETNODE] + + testcase=$1 + shift + target="$1" + if [ $# -gt 0 ]; then + shift + fi + targetnode="" + desccall="" + cd $testcase + echo "## Running testcase $testcase" + if [ -n "$target" ]; then + desccall="desc("\'"$target"\'")" + targetnode="`hg -R main id -qr \"$desccall\"`" + echo "# testing echange of \"$target\" ($targetnode)" + fi + echo "## initial state" + echo "# obstore: main" + hg -R main debugobsolete | sort + echo "# obstore: pushdest" + hg -R pushdest debugobsolete | sort + echo "# obstore: pulldest" + hg -R pulldest debugobsolete | sort + + if [ -n "$target" ]; then + echo "## pushing \"$target\"" from main to pushdest + hg -R main push -r "$desccall" $@ pushdest + else + echo "## pushing from main to pushdest" + hg -R main push pushdest $@ + fi + echo "## post push state" + echo "# obstore: main" + hg -R main debugobsolete | sort + echo "# obstore: pushdest" + hg -R pushdest debugobsolete | sort + echo "# obstore: pulldest" + hg -R pulldest debugobsolete | sort + if [ -n "$target" ]; then + echo "## pulling \"$targetnode\"" from main into pulldest + hg -R pulldest pull -r $targetnode $@ main + else + echo "## pulling from main into pulldest" + hg -R pulldest pull main $@ + fi + echo "## post pull state" + echo "# obstore: main" + hg -R main debugobsolete | sort + echo "# obstore: pushdest" + hg -R pushdest debugobsolete | sort + echo "# obstore: pulldest" + hg -R pulldest debugobsolete | sort + + cd .. + +} diff -r eccfd01aec56 -r 8a20b2774a65 tests/dummyssh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/dummyssh Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import sys +import os + +os.chdir(os.getenv('TESTTMP')) + +if sys.argv[1] != "user@dummy": + sys.exit(-1) + +os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" + +log = open("dummylog", "ab") +log.write("Got arguments") +for i, arg in enumerate(sys.argv[1:]): + log.write(" %d:%s" % (i + 1, arg)) +log.write("\n") +log.close() +hgcmd = sys.argv[2] +if os.name == 'nt': + # hack to make simple unix single quote quoting work on windows + hgcmd = hgcmd.replace("'", '"') +r = os.system(hgcmd) +sys.exit(bool(r)) diff -r eccfd01aec56 -r 8a20b2774a65 tests/run-tests.py diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-amend.t --- a/tests/test-amend.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-amend.t Tue Jun 23 16:49:53 2015 -0700 @@ -1,8 +1,5 @@ $ cat >> $HGRCPATH < [defaults] - > amend=-d "0 0" > [extensions] - > hgext.rebase= > hgext.graphlog= > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH @@ -11,43 +8,42 @@ > hg glog --template '{rev}@{branch}({phase}) {desc|firstline}\n' "$@" > } - $ hg init repo + $ hg init repo --traceback $ cd repo $ echo a > a $ 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 - bd19cbe78fbfbd87eb33420c63986fe5f3154f2c a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) - 07f4944404050f47db2e5c5071e0e84e7a27bba9 a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) + 07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'user': 'test'} (glob) + b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'user': 'test'} (glob) $ hg branch foo $ hg branches - foo 2:a34b93d251e4 - default 0:07f494440405 (inactive) + foo 2:6a022cbb61d5 $ glog @ 2@foo(draft) adda Test no-op - $ hg amend - abort: no updates found - [255] + $ hg amend -d '0 0' + nothing changed + [1] $ glog @ 2@foo(draft) adda Test forcing the message to the same value, no intermediate revision. - $ hg amend -m 'adda' - abort: no updates found - [255] + $ hg amend -d '0 0' -m 'adda' + nothing changed + [1] $ glog @ 2@foo(draft) adda @@ -61,7 +57,7 @@ M a $ hg pstatus $ hg diff - diff -r 2f97fe38810f a + diff -r f7a50201fe3a a --- a/a Thu Jan 01 00:00:00 1970 +0000 +++ b/a * +0000 (glob) @@ -1,2 +1,1 @@ @@ -69,12 +65,9 @@ -a $ hg pdiff $ hg ci -m reseta - $ hg amend --change 2 - abort: no updates found - [255] $ hg debugobsolete - bd19cbe78fbfbd87eb33420c63986fe5f3154f2c a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) - 07f4944404050f47db2e5c5071e0e84e7a27bba9 a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) + 07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'user': 'test'} (glob) + b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'user': 'test'} (glob) $ hg phase 2 2: draft $ glog @@ -84,32 +77,84 @@ | 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 -Test collapsing into an existing rev, with an intermediate revision. +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) - $ hg branch --force default - marked working directory as branch default - (branches are permanent and global, did you want a bookmark?) - $ hg ci -m resetbranch - created new head - $ hg branch --force foo - marked working directory as branch foo - (branches are permanent and global, did you want a bookmark?) - $ hg amend --change 2 - abort: no updates found +Specify current user as committer with -U + $ HGUSER=newbie hg amend -U + $ hg parents --template '{rev} {author}\n' + 7 newbie + +Check that --logfile works + $ echo "logfile message" > logfile.txt + $ hg amend -l logfile.txt + $ hg log -r . -T "{desc}\n" + logfile message + +# Make sure we don't get reparented to -1 with no username (issue4211) + $ HGUSER= + $ hg amend -e --config ui.username= -m "empty user" + abort: no username supplied + (use "hg config --edit" to set your username) [255] - $ hg debugobsolete - bd19cbe78fbfbd87eb33420c63986fe5f3154f2c a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) - 07f4944404050f47db2e5c5071e0e84e7a27bba9 a34b93d251e49c93d5685ebacad785c73a7e8605 0 {'date': '* *', 'user': 'test'} (glob) - 7384bbcba36fde1a789cd00f9cd6f9b919ab5910 0 {'date': '* *', 'user': 'test'} (glob) - $ glog - @ 6@foo(draft) amends a34b93d251e49c93d5685ebacad785c73a7e8605 - | - o 5@default(draft) resetbranch - | - o 4@foo(draft) reseta - | - o 3@foo(draft) changea - | - o 2@foo(draft) adda + $ hg sum + parent: 8:* tip (glob) + logfile message + branch: foo + commit: 1 unknown (clean) + update: (current) + +Check the help + $ hg amend -h + hg amend [OPTION]... [FILE]... + + aliases: refresh + + combine a changeset with updates and replace it with a new one + + Commits a new changeset incorporating both the changes to the given files + and all the changes from the current parent changeset into the repository. + + See "hg commit" for details about committing changes. + + If you don't specify -m, the parent's message will be reused. + Behind the scenes, Mercurial first commits the update as a regular child + of the current parent. Then it creates a new commit on the parent's + parents with the updated contents. Then it changes the working copy parent + to this new combined changeset. Finally, the old changeset and its update + are hidden from "hg log" (unless you use --hidden with log). + + Returns 0 on success, 1 if nothing changed. + + options ([+] can be repeated): + + -A --addremove mark new/missing files as added/removed before + committing + -e --edit invoke editor on commit messages + --close-branch mark a branch as closed, hiding it from the branch + list + -s --secret use the secret phase for committing + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns + -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 + -u --user USER record the specified user as committer + -D --current-date record the current date as commit date + -U --current-user record the current user as committer + -i --interactive use interactive mode + + (some details hidden, use --verbose to show complete help) diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-corrupt.t --- a/tests/test-corrupt.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-corrupt.t Tue Jun 23 16:49:53 2015 -0700 @@ -13,7 +13,6 @@ > git = 1 > unified = 0 > [extensions] - > hgext.rebase= > hgext.graphlog= > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH @@ -103,6 +102,7 @@ $ hg kill -n -1 -- -2 -3 + 2 changesets pruned $ hg push ../other pushing to ../other searching for changes @@ -110,6 +110,8 @@ adding manifests adding file changes added 1 changesets with 2 changes to 2 files + pushing 2 obsolescence markers (* bytes) (glob) + 2 obsolescence markers added $ hg -R ../other verify checking changesets checking manifests diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-drop.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-drop.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,266 @@ + + $ cat >> $HGRCPATH < [extensions] + > hgext.graphlog= + > EOF + $ echo "drophack=$(echo $(dirname $TESTDIR))/hgext/drophack.py" >> $HGRCPATH + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + $ mkcommit() { + > echo "$1" > "$1" + > hg add "$1" + > hg ci -m "add $1" + > } + $ summary() { + > echo ============ graph ============== + > hg log -G + > echo ============ hidden ============= + > hg log --hidden -G + > echo ============ obsmark ============ + > hg debugobsolete + > } + + + $ hg init repo + $ cd repo + $ mkcommit base + +drop a single changeset without any rewrite +================================================ + + + $ mkcommit simple-single + $ summary + ============ graph ============== + @ changeset: 1:d4e7845543ff + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add simple-single + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 1:d4e7845543ff + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add simple-single + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + $ hg drop . + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at b4952fcf48cf + search obsmarker: wall * comb * user * sys * (glob) + 0 obsmarkers found + search nodes: wall * comb * user * sys * (glob) + 1 nodes found + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d4e7845543ff-8ad8efe0-drophack.hg (glob) + strip nodes: wall * comb * user * sys * (glob) + $ summary + ============ graph ============== + @ changeset: 0:b4952fcf48cf + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 0:b4952fcf48cf + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + +Try to drop a changeset with children +================================================ + + $ mkcommit parent + $ mkcommit child + $ summary + ============ graph ============== + @ changeset: 2:34b6c051bf1f + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 2:34b6c051bf1f + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + $ hg drop 1 + cannot drop revision with children (no-eol) + [1] + $ summary + ============ graph ============== + @ changeset: 2:34b6c051bf1f + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 2:34b6c051bf1f + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + +Try to drop a public changeset +================================================ + + $ hg phase --public 2 + $ hg drop 2 + cannot drop public revision (no-eol) + [1] + + +Try to drop a changeset with rewrite +================================================ + + $ hg phase --force --draft 2 + $ echo babar >> child + $ hg commit --amend + $ summary + ============ graph ============== + @ changeset: 4:a2c06c884bfe + | tag: tip + | parent: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 4:a2c06c884bfe + | tag: tip + | parent: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + | x changeset: 3:87ea30a976fd + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: temporary amend commit for 34b6c051bf1f + | | + | x changeset: 2:34b6c051bf1f + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add child + | + o changeset: 1:19509a42b0d0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + 34b6c051bf1f78db6aef400776de5cb964470207 a2c06c884bfe53d3840026248bd8a7eafa152df8 0 (*) {'user': 'test'} (glob) + 87ea30a976fdf235bf096f04899cb02a903873e2 0 {34b6c051bf1f78db6aef400776de5cb964470207} (*) {'user': 'test'} (glob) + $ hg drop . + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at 19509a42b0d0 + search obsmarker: wall * comb * user * sys * (glob) + 1 obsmarkers found + search nodes: wall * comb * user * sys * (glob) + 2 nodes found + strip obsmarker: wall * comb * user * sys * (glob) + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-drophack.hg (glob) + strip nodes: wall * comb * user * sys * (glob) + $ summary + ============ graph ============== + @ changeset: 1:19509a42b0d0 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ hidden ============= + @ changeset: 1:19509a42b0d0 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add parent + | + o changeset: 0:b4952fcf48cf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add base + + ============ obsmark ============ + 87ea30a976fdf235bf096f04899cb02a903873e2 0 {34b6c051bf1f78db6aef400776de5cb964470207} (*) {'user': 'test'} (glob) diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-evolve-bumped.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-evolve-bumped.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,82 @@ + $ hg init public + $ cd public + $ echo a > a + $ hg commit -A -m init + adding a + $ cd .. + + $ evolvepath=$(echo $(dirname $TESTDIR))/hgext/evolve.py + $ hg clone -U public private + $ cd private + $ cat >> .hg/hgrc < [extensions] + > evolve = $evolvepath + > [phases] + > publish = false + > EOF + $ cd .. + + $ cp -a private alice + $ cp -a private bob + + $ cd alice + $ hg update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo a >> a + $ hg commit -u alice -m 'modify a' + $ hg push ../private + pushing to ../private + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + $ hg log -r 'draft()' + changeset: 1:4d1169d82e47 + tag: tip + user: alice + date: Thu Jan 01 00:00:00 1970 +0000 + summary: modify a + + + $ cd ../bob + $ hg pull ../private + pulling from ../private + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + pull obsolescence markers + (run 'hg update' to get a working copy) + $ hg log -r 'draft()' + changeset: 1:4d1169d82e47 + tag: tip + user: alice + date: Thu Jan 01 00:00:00 1970 +0000 + summary: modify a + + $ hg push ../public + pushing to ../public + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + $ hg log -r 'draft()' + + $ cd ../alice + $ hg amend -m 'tweak a' + $ hg pull ../public + pulling from ../public + searching for changes + no changes found + pull obsolescence markers + 1 new bumped changesets + + $ hg evolve -a + recreate:[2] tweak a + atop:[1] modify a + computing new diff + committed as 4d1169d82e47 + working directory is now at 4d1169d82e47 diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-evolve.t --- a/tests/test-evolve.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-evolve.t Tue Jun 23 16:49:53 2015 -0700 @@ -1,6 +1,7 @@ $ cat >> $HGRCPATH < [defaults] > amend=-d "0 0" + > fold=-d "0 0" > [web] > push_ssl = false > allow_push = * @@ -12,7 +13,6 @@ > git = 1 > unified = 0 > [extensions] - > hgext.rebase= > hgext.graphlog= > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH @@ -58,7 +58,8 @@ $ hg log -r 1 --template '{rev} {phase} {obsolete}\n' 1 public stable $ hg kill 1 - abort: cannot obsolete immutable changeset: 7c3bad9141dc + abort: cannot prune immutable changeset: 7c3bad9141dc + (see "hg help phases" for details) [255] $ hg log -r 1 --template '{rev} {phase} {obsolete}\n' 1 public stable @@ -68,6 +69,7 @@ $ hg id -n 5 $ hg kill . + 1 changesets pruned 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at fbb94e3a0ecf $ hg qlog @@ -79,7 +81,8 @@ test multiple kill - $ hg kill 4 3 + $ hg kill 4 -r 3 + 2 changesets pruned 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at 7c3bad9141dc $ hg qlog @@ -94,10 +97,22 @@ $ echo 4 > g $ hg add g $ hg kill . + 1 changesets pruned 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at 7c3bad9141dc $ hg st A g + +Smoketest debugobsrelsethashtree: + + $ hg debugobsrelsethashtree + 1f0dee641bb7258c56bd60e93edfa2405381c41e 0000000000000000000000000000000000000000 + 7c3bad9141dcb46ff89abf5f61856facd56e476c * (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d * (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 * (glob) + fbb94e3a0ecf6d20c2cc31152ef162ce45af982f * (glob) + e44648563c73f75950076031c6fdf06629de95f1 * (glob) + $ cd .. ########################## @@ -188,13 +203,13 @@ It is therefore advisable to always set the bookmark before committing:: $ hg book feature-B - $ hg commit --message "another feature" + $ hg commit --message "another feature (child of $(hg log -r . -T '{node|short}'))" So here we are:: $ hg book feature-A 1:568a468b60fc - * feature-B 2:7b36850622b2 + * feature-B 2:73296a82292a Fix The Second Patch @@ -211,17 +226,13 @@ and **amend**:: - $ hg amend --note "fix spelling of Zwei" - -The `--note` is our commit message for the *update* only. So its only purpose -is to document the evolution of the changeset. If we use `--message` with -`amend`, it replaces the commit message of the changeset itself. + $ hg amend This results in a new single changeset for our amended changeset, and the old changeset plus the updating changeset are hidden from view by default:: $ hg log - 4 feature-B: another feature - test + 4 feature-B: another feature (child of 568a468b60fc) - test 1 feature-A: a nifty feature - test 0 : base - test @@ -233,51 +244,45 @@ $ hg phase --public 0 -v phase changed for 1 changesets - $ hg amend -c 2 - abort: cannot amend non ancestor changeset - [255] (amend of on ancestors) - $ hg amend -c 2 - abort: cannot amend non ancestor changeset - [255] - - $ hg amend --note 'french looks better' + $ hg amend 1 new unstable changesets $ hg log 6 feature-A: a nifty feature - test - 4 feature-B: another feature - test + 4 feature-B: another feature (child of 568a468b60fc) - test 1 : a nifty feature - test 0 : base - test $ hg up -q 0 $ glog --hidden - o 6:23409eba69a0@default(draft) a nifty feature + o 6:ba0ec09b1bab@default(draft) a nifty feature | - | x 5:e416e48b2742@default(draft) french looks better + | x 5:c296b79833d1@default(draft) temporary amend commit for 568a468b60fc | | - | | o 4:f8111a076f09@default(draft) another feature + | | o 4:6992c59c6b06@default(draft) another feature (child of 568a468b60fc) | |/ - | | x 3:524e478d4811@default(draft) fix spelling of Zwei + | | x 3:c97947cdc7a2@default(draft) temporary amend commit for 73296a82292a | | | - | | x 2:7b36850622b2@default(draft) another feature + | | x 2:73296a82292a@default(draft) another feature (child of 568a468b60fc) | |/ | x 1:568a468b60fc@default(draft) a nifty feature |/ @ 0:e55e0562ee93@default(public) base $ hg debugobsolete - 524e478d4811d405c8771e4c441de4483bdf8b33 f8111a076f0975cbecb336e2bd3411be22b673fb 0 {'date': '* *', 'user': 'test'} (glob) - 7b36850622b2fd159fa30a4fb2a1edd2043b4a14 f8111a076f0975cbecb336e2bd3411be22b673fb 0 {'date': '* *', 'user': 'test'} (glob) - e416e48b27428695d00c2a2cc4a0b9619482e63f 23409eba69a0986e90cd42252852c1e6da97af5b 0 {'date': '* *', 'user': 'test'} (glob) - 568a468b60fc99a42d5d4ddbe181caff1eef308d 23409eba69a0986e90cd42252852c1e6da97af5b 0 {'date': '* *', 'user': 'test'} (glob) + 73296a82292a76fb8a7061969d2489ec0d84cd5e 6992c59c6b06a1b4a92e24ff884829ae026d018b 0 (*) {'user': 'test'} (glob) + c97947cdc7a2a11cf78419f5c2c3dd3944ec79e8 0 {73296a82292a76fb8a7061969d2489ec0d84cd5e} (*) {'user': 'test'} (glob) + 568a468b60fc99a42d5d4ddbe181caff1eef308d ba0ec09b1babf3489b567853807f452edd46704f 0 (*) {'user': 'test'} (glob) + c296b79833d1d497f33144786174bf35e04e44a3 0 {568a468b60fc99a42d5d4ddbe181caff1eef308d} (*) {'user': 'test'} (glob) $ hg evolve - move:[4] another feature + move:[4] another feature (child of 568a468b60fc) atop:[6] a nifty feature merging main-file-1 + working directory is now at 5c9c8d9c2e4e $ hg log - 7 feature-B: another feature - test + 7 feature-B: another feature (child of ba0ec09b1bab) - test 6 feature-A: a nifty feature - test 0 : base - test @@ -298,7 +303,7 @@ phase change turning obsolete changeset public issue a bumped warning - $ hg phase --public 7 + $ hg phase --hidden --public 7 1 new bumped changesets all solving bumped troubled @@ -306,7 +311,7 @@ $ hg glog @ 8 feature-B: another feature that rox - test | - | o 7 : another feature - test + | o 7 : another feature (child of ba0ec09b1bab) - test |/ o 6 feature-A: a nifty feature - test | @@ -314,19 +319,20 @@ $ hg evolve --any --traceback recreate:[8] another feature that rox - atop:[7] another feature + atop:[7] another feature (child of ba0ec09b1bab) computing new diff - commited as 53ff506edef1 + committed as 476d0454d60e + working directory is now at 476d0454d60e $ hg glog - @ 9 feature-B: bumped update to 5f4744038ed5: - test + @ 9 feature-B: bumped update to 5c9c8d9c2e4e: - test | - o 7 : another feature - test + o 7 : another feature (child of ba0ec09b1bab) - test | o 6 feature-A: a nifty feature - test | o 0 : base - test - $ hg diff -r 9 -r 8 + $ hg diff --hidden -r 9 -r 8 $ hg diff -r 9^ -r 9 diff --git a/main-file-1 b/main-file-1 --- a/main-file-1 @@ -336,6 +342,60 @@ +deux $ hg log -r 'bumped()' # no more bumped +test evolve --all + $ sed -i'' -e s/deux/to/ main-file-1 + $ hg commit -m 'dansk 2!' + $ sed -i'' -e s/Three/tre/ main-file-1 + $ hg commit -m 'dansk 3!' + $ hg update 9 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ sed -i'' -e s/Un/Én/ main-file-1 + $ 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! + merging main-file-1 + move:[11] dansk 3! + atop:[14] dansk 2! + merging main-file-1 + working directory is now at cfb5ebed336d + $ hg glog + @ 15 : dansk 3! - test + | + o 14 : dansk 2! - test + | + o 13 feature-B: dansk! - test + | + o 7 : another feature (child of ba0ec09b1bab) - test + | + o 6 feature-A: a nifty feature - test + | + o 0 : base - test + + $ cd .. enable general delta @@ -359,6 +419,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers $ cd alpha $ cat << EOF > A @@ -393,7 +454,10 @@ checking files 3 files, 4 changesets, 4 total revisions $ hg --config extensions.hgext.mq= strip 'extinct()' - saved backup bundle to $TESTTMP/alpha/.hg/strip-backup/e87767087a57-backup.hg + abort: empty revision set + [255] + $ hg --config extensions.hgext.mq= strip --hidden 'extinct()' + saved backup bundle to $TESTTMP/alpha/.hg/strip-backup/e87767087a57-d7bd82e9-backup.hg (glob) $ hg verify checking changesets checking manifests @@ -412,6 +476,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + 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 @@ -441,9 +507,9 @@ o 0:8685c6d34325@default(draft) add 0 $ hg graft -r3 -O - grafting revision 3 + grafting 3:0e84df4912da "add 3" $ hg graft -r1 -o 2 - grafting revision 1 + grafting 1:73d38bb17fd7 "add 1" $ glog --hidden @ 6:acb28cd497b7@default(draft) add 1 | @@ -460,8 +526,8 @@ o 0:8685c6d34325@default(draft) add 0 $ hg debugobsolete - 0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 {'date': '* *', 'user': 'test'} (glob) - db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 {'date': '* *', 'user': 'test'} (glob) + 0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (*) {'user': 'test'} (glob) + db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (*) {'user': 'test'} (glob) Test graft --continue @@ -471,7 +537,7 @@ created new head $ hg up -qC 6 $ hg graft -O 7 - grafting revision 7 + grafting 7:a5bfd90a2f29 "conflict" (tip) merging 1 warning: conflicts during merge. merging 1 incomplete! (edit conflicts, then use 'hg resolve --mark') @@ -482,8 +548,9 @@ 7:a5bfd90a2f29 stable $ echo 3 > 1 $ hg resolve -m 1 + (no more unresolved files) $ hg graft --continue -O - grafting revision 7 + grafting 7:a5bfd90a2f29 "conflict" (tip) $ glog --hidden @ 8:920e58bb443b@default(draft) conflict | @@ -504,9 +571,9 @@ o 0:8685c6d34325@default(draft) add 0 $ hg debugobsolete - 0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 {'date': '* *', 'user': 'test'} (glob) - db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 {'date': '* *', 'user': 'test'} (glob) - a5bfd90a2f29c7ccb8f917ff4e5013a9053d0a04 920e58bb443b73eea9d6d65570b4241051ea3229 0 {'date': '* *', 'user': 'test'} (glob) + 0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (*) {'user': 'test'} (glob) + db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (*) {'user': 'test'} (glob) + a5bfd90a2f29c7ccb8f917ff4e5013a9053d0a04 920e58bb443b73eea9d6d65570b4241051ea3229 0 (*) {'user': 'test'} (glob) Test touch @@ -556,23 +623,36 @@ $ 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::10 - 2 changesets folded + $ 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 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:*@default(draft) add 1 (glob) - | - 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: hidden revision '6'! + (use --hidden to access hidden revisions) + [255] + $ hg log -r 11 --template '{desc}\n' + add 3 - $ hg log -r 11 --template '{desc}\n' + add 1 @@ -584,16 +664,20 @@ $ hg up 4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg fold 4::11 - 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:*@default(draft) add 4 (glob) + @ 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 + 1: test + 0: test $ hg log -r 12 --template '{desc}\n' add 4 @@ -612,5 +696,194 @@ $ hg olog 4 : add 4 - test - 5 : add 3 - test - 11 : add 1 - test + 11 : add 3 - test + +Test obsstore stat + + $ hg debugobsstorestat + markers total: 10 + for known precursors: 10 + with parents data: 0 + markers with no successors: 0 + 1 successors: 10 + 2 successors: 0 + more than 2 successors: 0 + available keys: + user: 10 + disconnected clusters: 1 + any known node: 1 + smallest length: 10 + longer length: 10 + median length: 10 + mean length: 10 + using parents data: 1 + any known node: 1 + smallest length: 10 + longer length: 10 + median length: 10 + mean length: 10 + + +Test evolving renames + + $ hg up null + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ echo a > a + $ hg ci -Am a + adding a + created new head + $ echo b > b + $ hg ci -Am b + adding b + $ hg mv a c + $ hg ci -m c + $ hg kill .^ + 1 changesets pruned + 1 new unstable changesets + $ hg stab --any + move:[15] c + atop:[13] a + working directory is now at 3742bde73477 + $ hg st -C --change=tip + A c + a + R a + +Test fold with commit messages + + $ cd ../work + $ hg fold .^ --message "Folding with custom commit message" + 2 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ glog + @ 16:d6239ff09c9f@default(draft) Folding with custom commit message + | + o 13:56ade053f46d@default(draft) dansk! + | + o 7:5c9c8d9c2e4e@default(public) another feature (child of ba0ec09b1bab) + | + o 6:ba0ec09b1bab@default(public) a nifty feature + | + o 0:e55e0562ee93@default(public) base + + $ cat > commit-message < A longer + > commit message + > EOF + + $ hg fold .^ --logfile commit-message + 2 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg qlog + 17 - dba606655966 A longer + commit message (draft) + 7 - 5c9c8d9c2e4e another feature (child of ba0ec09b1bab) (public) + 6 - ba0ec09b1bab a nifty feature (public) + 0 - e55e0562ee93 base (public) + + $ cd .. + +Test branch preservation: +=========================== + + $ hg init evolving-branch + $ cd evolving-branch + $ touch a + $ hg add a + $ hg ci -m 'a0' + $ echo 1 > a + $ hg ci -m 'a1' + $ echo 2 > a + $ hg ci -m 'a2' + $ echo 3 > a + $ hg ci -m 'a3' + + $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n' + @ 3 [default] a3 + | + o 2 [default] a2 + | + o 1 [default] a1 + | + o 0 [default] a0 + + +branch change propagated + + $ hg up 'desc(a2)' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg branch mybranch + marked working directory as branch mybranch + (branches are permanent and global, did you want a bookmark?) + $ hg amend + 1 new unstable changesets + + $ hg evolve + move:[3] a3 + atop:[5] a2 + working directory is now at 7c5649f73d11 + + $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n' + @ 6 [mybranch] a3 + | + o 5 [mybranch] a2 + | + o 1 [default] a1 + | + o 0 [default] a0 + + +branch change preserved + + $ hg up 'desc(a1)' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg amend -m 'a1_' + 2 new unstable changesets + $ hg evolve + move:[5] a2 + atop:[7] a1_ + working directory is now at 5406c5cfee42 + $ hg evolve + move:[6] a3 + atop:[8] a2 + working directory is now at c7661e655801 + $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n' + @ 9 [mybranch] a3 + | + o 8 [mybranch] a2 + | + o 7 [default] a1_ + | + o 0 [default] a0 + + +Evolve from the middle of a stack pick the right changesets. + + $ hg up 7 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg ci --amend -m 'a1__' + 2 new unstable changesets + + $ hg up 8 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg evolve + nothing to evolve here + (2 troubled changesets, do you want --any ?) + [2] + + +Evolve disables active bookmarks. + + $ hg up 10 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg bookmark testbookmark + $ ls .hg/bookmarks* + .hg/bookmarks + .hg/bookmarks.* (glob) + $ hg evolve + move:[8] a2 + atop:[10] a1__ + (leaving bookmark testbookmark) + working directory is now at f37ed7a60f43 + $ ls .hg/bookmarks* + .hg/bookmarks diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A1.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A1.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,285 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +==== A.1.1 pushing a single head ==== +.. +.. {{{ +.. ⇠◔ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A +.. +.. Command run: +.. +.. * hg push -r A +.. * hg push +.. +.. Expected exchange: +.. +.. * chain from A + +Setup +--------------- + +initial + + $ setuprepos A.1.1 + creating test repo for test case A.1.1 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'` + $ hg log -G + @ f5bc6836db60 (draft): A + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +setup both variants + + $ cp -r A.1.1 A.1.1.a + $ cp -r A.1.1 A.1.1.b + + +Variant a: push -r A +-------------------- + + $ dotest A.1.1.a A + ## Running testcase A.1.1.a + # testing echange of "A" (f5bc6836db60) + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "f5bc6836db60" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + + + + +Variant b: push +--------------- + + $ dotest A.1.1.b + ## Running testcase A.1.1.b + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + + + + + + +==== A.1.2 pushing a multiple changeset into a single head ==== + +.. {{{ +.. ◔ B +.. | +.. ⇠◔ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A +.. +.. Command run: +.. +.. * hg push -r B +.. * hg push +.. +.. Expected exchange: +.. +.. * chain from A + +Setup +--------------- + +initial + + $ setuprepos A.1.2 + creating test repo for test case A.1.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ mkcommit B + $ hg log -G + @ f6fbb35d8ac9 (draft): B + | + o f5bc6836db60 (draft): A + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'` + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +setup both variants + + $ cp -r A.1.2 A.1.2.a + $ cp -r A.1.2 A.1.2.b + + +Variant a: push -r A +-------------------- + + $ dotest A.1.2.a B + ## Running testcase A.1.2.a + # testing echange of "B" (f6fbb35d8ac9) + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "B" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "f6fbb35d8ac9" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Variant b: push +--------------- + + $ dotest A.1.2.b + ## Running testcase A.1.2.b + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A2.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A2.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,110 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== A.2 Two heads === + +.. {{{ +.. ⇠○ B +.. ⇠◔ | A +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A +.. * B +.. +.. +.. Command run: +.. +.. * hg push -r A +.. +.. Expected exchange: +.. +.. * chain from A +.. +.. Expected Exclude: +.. +.. * chain from B + +initial + + $ setuprepos A.2 + creating test repo for test case A.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'` + $ hg up .^ + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ mkcommit B + created new head + $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb `getid 'desc(B)'` + $ hg log -G + @ 35b183996678 (draft): B + | + | o f5bc6836db60 (draft): A + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + +Actual Test +--------------- + + $ dotest A.2 A + ## Running testcase A.2 + # testing echange of "A" (f5bc6836db60) + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "f5bc6836db60" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + + + $ cd .. diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A3.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A3.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,218 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== A.3 new branch created === + +.. {{{ +.. B' ○⇢ø B +.. | | +.. \Aø⇠◔ A' +.. \|/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `Aø⇠○ A'` +.. * `Bø⇠○ B'` +.. +.. Command run: +.. +.. * hg push -r A +.. +.. Expected exchange: +.. +.. * chain from A +.. +.. Expected Exclude: +.. +.. * chain from B +.. +.. Extra note: +.. +.. If A and B are remontly known, we should expect: +.. +.. * `hg push` will complain about the new head +.. * `hg push` should complain about unstable history creation + +initial + + $ setuprepos A.3.a + creating test repo for test case A.3.a + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B0 + $ hg update -q 0 + $ mkcommit A1 + created new head + $ hg update -q 0 + $ mkcommit B1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg debugobsolete `getid 'desc(B0)'` `getid 'desc(B1)'` + $ hg log -G --hidden + @ f6298a8ac3a4 (draft): B1 + | + | o e5ea8f9c7314 (draft): A1 + |/ + | x 6e72f0a95b5e (draft): B0 + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- + + $ dotest A.3.a A1 + ## Running testcase A.3.a + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + + +other variant: changeset known in remote +---------------------------------------- + + $ setuprepos A.3.b + creating test repo for test case A.3.b + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B0 + $ hg push -q ../pushdest + $ hg push -q ../pulldest + $ hg update -q 0 + $ mkcommit A1 + created new head + $ hg update -q 0 + $ mkcommit B1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg debugobsolete `getid 'desc(B0)'` `getid 'desc(B1)'` + $ hg log -G --hidden + @ f6298a8ac3a4 (draft): B1 + | + | o e5ea8f9c7314 (draft): A1 + |/ + | x 6e72f0a95b5e (draft): B0 + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- + +check it complains about multiple heads + + $ cd A.3.b + $ hg push -R main -r e5ea8f9c7314 pushdest + pushing to pushdest + searching for changes + abort: push creates new remote head e5ea8f9c7314! + (merge or see "hg help push" for details about pushing new heads) + [255] + $ cd .. + +test obsmarkers exchange. + + $ dotest A.3.b A1 -f + ## Running testcase A.3.b + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files (+1 heads) + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 2 files (+1 heads) + 1 new obsolescence markers + (run 'hg heads' to see heads, 'hg merge' to merge) + 1 new unstable changesets + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A4.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A4.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,112 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== A.4 Push in the middle of the obsolescence chain === + +.. (Where we show that we should not push the marker without the successors) +.. +.. {{{ +.. B ◔ +.. | +.. A⇠ø⇠○ A' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `Aø⇠○ A'` +.. * chain from A +.. +.. Command run: +.. +.. * hg push -r B +.. +.. Expected exchange: +.. +.. * Chain from A +.. +.. Expected Exclude: +.. +.. * `Aø⇠○ A'` + + +initial + + $ setuprepos A.4 + creating test repo for test case A.4 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B + $ hg update 0 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit A1 + created new head + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A0)'` + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg log -G --hidden + @ e5ea8f9c7314 (draft): A1 + | + | o 06055a7959d4 (draft): B + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- + + $ dotest A.4 B -f + ## Running testcase A.4 + # testing echange of "B" (06055a7959d4) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "B" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "06055a7959d4" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A5.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A5.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,121 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== A.5 partial reordering === +.. +.. {{{ +.. B ø⇠⇠ +.. | ⇡ +.. A ø⇠⇠⇠○ A' +.. | ⇡/ +.. | ○ B' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `Aø⇠○ A'` +.. * `Bø⇠○ B'` +.. +.. Command run: +.. +.. * hg push -r B +.. +.. Expected exchange: +.. +.. * `Bø⇠○ B'` +.. +.. Expected Exclude: +.. +.. * `Aø⇠○ A'` + + +initial + + $ setuprepos A.5 + creating test repo for test case A.5 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B0 + $ hg update 0 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit B1 + created new head + $ mkcommit A1 + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A0)'` + $ hg debugobsolete `getid 'desc(B0)'` `getid 'desc(B1)'` + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg log -G --hidden + @ 8c0a98c83722 (draft): A1 + | + o f6298a8ac3a4 (draft): B1 + | + | x 6e72f0a95b5e (draft): B0 + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 8c0a98c8372212c6efde4bfdcef006f27ff759d3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +----------- + + $ dotest A.5 B1 + ## Running testcase A.5 + # testing echange of "B1" (f6298a8ac3a4) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 8c0a98c8372212c6efde4bfdcef006f27ff759d3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "B1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 8c0a98c8372212c6efde4bfdcef006f27ff759d3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "f6298a8ac3a4" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 8c0a98c8372212c6efde4bfdcef006f27ff759d3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A6.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A6.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,134 @@ + + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== A.6 between existing changeset === + +.. {{{ +.. A ◕⇠● B +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `A◕⇠● B` +.. +.. Command run: +.. +.. * hg push -r B +.. * hg push +.. +.. Expected exchange: +.. +.. * `A◕⇠● B` + + +initial + + $ setuprepos A.6 + creating test repo for test case A.6 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ hg update -q 0 + $ mkcommit A1 + created new head + +make both changeset known in remote + + $ hg push -qf ../pushdest + $ hg push -qf ../pulldest + +create a marker after this + + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg log -G --hidden + @ e5ea8f9c7314 (draft): A1 + | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + $ cp -r A.6 A.6.a + $ cp -r A.6 A.6.b + +Actual Test (explicit push version) +----------------------------------- + + $ dotest A.6.a A1 + ## Running testcase A.6.a + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push version) +------------------------------- + + $ dotest A.6.b + ## Running testcase A.6.b + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-A7.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-A7.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,75 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== A.7 Non targeted common changeset === + +.. {{{ +.. ⇠◕ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * Chain from A +.. +.. Command run: +.. +.. * hg push -r O +.. +.. Expected exchange: +.. +.. * ø + + + $ setuprepos A.7 + creating test repo for test case A.7 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg push -q ../pushdest + $ hg push -q ../pulldest + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'` + $ hg log -G --hidden + @ f5bc6836db60 (draft): A + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +----------------------------------- + + $ dotest A.7 O + ## Running testcase A.7 + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + ## post push state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + ## post pull state + # obstore: main + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B1.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B1.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,137 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== B.1 Prune on non-targeted common changeset === + +.. {{{ +.. ⊗ B +.. | +.. ◕ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r O +.. * hg push +.. +.. Expected exchange: +.. +.. * B (prune) + + + $ setuprepos B.1 + creating test repo for test case B.1 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ mkcommit B + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x f6fbb35d8ac9 (draft): B + | + @ f5bc6836db60 (draft): A + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + + $ cp -r B.1 B.1.a + $ cp -r B.1 B.1.b + +Actual Test (explicit push version) +----------------------------------- + + $ dotest B.1.a A + ## Running testcase B.1.a + # testing echange of "A" (f5bc6836db60) + ## initial state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "f5bc6836db60" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push version) +----------------------------------- + + $ dotest B.1.b + ## Running testcase B.1.b + ## initial state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 1 new obsolescence markers + ## post push state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 1 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B2.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B2.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,117 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== B.2 Pruned changeset on head: nothing pushed === + +.. {{{ +.. ⊗ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A (prune) +.. +.. Command run: +.. +.. * hg push -r O +.. * hg push +.. +.. Expected exchange: +.. +.. * prune marker for A + + + $ setuprepos B.2 + creating test repo for test case B.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x f5bc6836db60 (draft): A + | + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + + $ cp -r B.2 B.2.a + $ cp -r B.2 B.2.b + +Actual Test (explicit push version) +----------------------------------- + + $ dotest B.2.a O + ## Running testcase B.2.a + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push version) +----------------------------------- + + $ dotest B.2.b + ## Running testcase B.2.b + ## initial state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B3.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B3.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,100 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== B.3 Pruned changeset on non-pushed part of the history === + +.. {{{ +.. ⊗ C +.. | +.. ○ B +.. | ◔ A +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * C (prune) +.. +.. Command run: +.. +.. * hg push -r A +.. * hg push +.. +.. Expected exchange: +.. +.. * ø +.. +.. Expected Exclude: +.. +.. * chain from B + + + $ setuprepos B.3 + creating test repo for test case B.3 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg up --quiet 0 + $ mkcommit B + created new head + $ mkcommit C + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x e56289ab6378 (draft): C + | + @ 35b183996678 (draft): B + | + | o f5bc6836db60 (draft): A + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + e56289ab6378dc752fd7965f8bf66b58bda740bd 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + +Actual Test +----------------------------------- + + $ dotest B.3 A + ## Running testcase B.3 + # testing echange of "A" (f5bc6836db60) + ## initial state + # obstore: main + e56289ab6378dc752fd7965f8bf66b58bda740bd 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + ## post push state + # obstore: main + e56289ab6378dc752fd7965f8bf66b58bda740bd 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pulling "f5bc6836db60" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + e56289ab6378dc752fd7965f8bf66b58bda740bd 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B4.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B4.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,143 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== B.4 Pruned changeset on common part of history === + +.. {{{ +.. ⊗ C +.. | ● B +.. | | +.. | ● A +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * C (prune) +.. +.. Command run: +.. +.. * hg push -r B +.. * hg push +.. +.. Expected exchange: +.. +.. * prune for C + + + $ setuprepos B.4 + creating test repo for test case B.4 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ mkcommit B + $ hg phase --public . + $ hg push ../pushdest + pushing to ../pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + $ hg push ../pulldest + pushing to ../pulldest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + $ hg update -q 0 + $ mkcommit C + created new head + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x 7f7f229b13a6 (draft): C + | + | o f6fbb35d8ac9 (public): B + | | + | o f5bc6836db60 (public): A + |/ + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + + $ cp -r B.4 B.4.a + $ cp -r B.4 B.4.b + +Actual Test (explicit push version) +----------------------------------- + + $ dotest B.4.a O + ## Running testcase B.4.a + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push version) +----------------------------------- + + $ dotest B.4.b + ## Running testcase B.4.b + ## initial state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 1 new obsolescence markers + ## post push state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 1 new obsolescence markers + ## post pull state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B5.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B5.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,171 @@ + + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== B.5 Push of a children of changeset which successors is pruned === + +.. This case Mirror A.4, with pruned changeset successors. +.. +.. {{{ +.. B ◔ +.. | +.. A⇠ø⇠⊗ A' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `Aø⇠○ A'` +.. * chain from A +.. * `A'` +.. +.. Command run: +.. +.. * hg push -r B +.. +.. Expected exchange: +.. +.. * `Aø⇠○ A'` +.. * chain from A +.. * `A'` +.. +.. Extra Note: +.. +.. I'm not totally happy about this case and I believe some more complicated +.. graph can result in behavior wuite confusing for the user (if some tool create +.. prune maker in a the middle of a valid chain) + + $ setuprepos B.5 + creating test repo for test case B.5 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B + $ hg up --quiet 0 + $ mkcommit A1 + created new head + $ hg debugobsolete --hidden `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x e5ea8f9c7314 (draft): A1 + | + | o 06055a7959d4 (draft): B + | | + | x 28b51eb45704 (draft): A0 + |/ + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + $ cp -r B.5 B.5.a + $ cp -r B.5 B.5.b + +Actual Test (explicit push version) +----------------------------------- + + $ dotest B.5.a B -f + ## Running testcase B.5.a + # testing echange of "B" (06055a7959d4) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "B" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "06055a7959d4" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + 1 new unstable changesets + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push version) +------------------------------------- + + $ dotest B.5.b B -f + ## Running testcase B.5.b + # testing echange of "B" (06055a7959d4) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "B" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 2 changesets with 2 changes to 2 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "06055a7959d4" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + 1 new unstable changesets + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B6.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B6.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,101 @@ + + + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +== B.6 Pruned changeset with ancestors not in pushed set === + +.. {{{ +.. B ø⇠⊗ B' +.. | | +.. A ○ | +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `Bø⇠⊗ B'` +.. * B' prune +.. +.. Command run: +.. +.. * hg push -r O +.. +.. Expected exchange: +.. +.. * `Bø⇠⊗ B'` +.. * B' prune + + $ setuprepos B.6 + creating test repo for test case B.6 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ mkcommit B0 + $ hg up --quiet 0 + $ mkcommit B1 + created new head + $ hg debugobsolete `getid 'desc(B0)'` `getid 'desc(B1)'` + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x f6298a8ac3a4 (draft): B1 + | + | x 962ecf6b1afc (draft): B0 + | | + | o f5bc6836db60 (draft): A + |/ + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest B.6 O + ## Running testcase B.6 + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 2 new obsolescence markers + ## post pull state + # obstore: main + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 962ecf6b1afc94e15c7e48fdfb76ef8abd11372b f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-B7.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-B7.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,83 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== B.7 Prune on non-targeted common changeset === +.. +.. {{{ +.. ⊗ B +.. | +.. ◕ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r O +........ * hg push +.. +.. Expected exchange: +.. +.. * ø +....... * B (prune) + + $ setuprepos B.7 + creating test repo for test case B.7 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg push -q ../pushdest + $ hg push -q ../pulldest + $ mkcommit B + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x f6fbb35d8ac9 (draft): B + | + @ f5bc6836db60 (draft): A + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest B.7 O + ## Running testcase B.7 + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + ## post push state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + ## post pull state + # obstore: main + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-C1.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-C1.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,135 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== C.1 Multiple pruned changeset atop each other === +.. +.. {{{ +.. ⊗ B +.. | +.. ⊗ A +.. | +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A (prune) +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r O +.. * hg push +.. +.. Expected exchange: +.. +.. * A (prune) +.. * B (prune) + + $ setuprepos C.1 + creating test repo for test case C.1 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ mkcommit B + $ hg prune -qd '0 0' .^::. + $ hg log -G --hidden + x f6fbb35d8ac9 (draft): B + | + x f5bc6836db60 (draft): A + | + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + $ cp -r C.1 C.1.a + $ cp -r C.1 C.1.b + +Actual Test (explicit push) +--------------------------- + + $ dotest C.1.a O + ## Running testcase C.1.a + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 2 new obsolescence markers + ## post push state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 2 new obsolescence markers + ## post pull state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push) +------------------------------------- + + $ dotest C.1.b + ## Running testcase C.1.b + ## initial state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 2 new obsolescence markers + ## post push state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 2 new obsolescence markers + ## post pull state + # obstore: main + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f6fbb35d8ac958bbe70035e4c789c18471cdc0af 0 {f5bc6836db60e308a17ba08bf050154ba9c4fad7} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-C2.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-C2.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,157 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== C.2 Pruned changeset on precursors === + +.. {{{ +.. B ⊗ +.. | +.. A ø⇠◔ A' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A' succeed to A +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r A' +.. * hg push +.. +.. Expected exchange: +.. +.. * `A ø⇠o A'` +.. * B (prune) + + $ setuprepos C.2 + creating test repo for test case C.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B + $ hg prune -qd '0 0' . + $ hg update -q 0 + $ mkcommit A1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg log -G --hidden + @ e5ea8f9c7314 (draft): A1 + | + | x 06055a7959d4 (draft): B + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + $ cp -r C.2 C.2.a + $ cp -r C.2 C.2.b + +Actual Test (explicit push) +--------------------------- + + $ dotest C.2.a A1 + ## Running testcase C.2.a + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push) +------------------------------------- + + $ dotest C.2.b + ## Running testcase C.2.b + ## initial state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-C3.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-C3.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,159 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + + +=== C.3 Pruned changeset on precursors of another pruned one === + +.. {{{ +.. B ⊗ +.. | +.. A ø⇠⊗ A' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A' succeed to A +.. * A' (prune +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r A' +.. * hg push +.. +.. Expected exchange: +.. +.. * `A ø⇠⊗ A'` +.. * A (prune) +.. * B (prune) + + $ setuprepos C.3 + creating test repo for test case C.3 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B + $ hg prune -qd '0 0' . + $ hg update -q 0 + $ mkcommit A1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x e5ea8f9c7314 (draft): A1 + | + | x 06055a7959d4 (draft): B + | | + | x 28b51eb45704 (draft): A0 + |/ + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + + $ cp -r C.3 C.3.a + $ cp -r C.3 C.3.b + +Actual Test (explicit push) +--------------------------- + + $ dotest C.3.a O + ## Running testcase C.3.a + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 3 new obsolescence markers + ## post push state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 3 new obsolescence markers + ## post pull state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +Actual Test (bare push) +------------------------------------- + + $ dotest C.3.b + ## Running testcase C.3.b + ## initial state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 3 new obsolescence markers + ## post push state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 3 new obsolescence markers + ## post pull state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-C4.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-C4.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,118 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== C.4 multiple successors, one is pruned === + +.. Another case were prune are confusing? (A is killed without its successors being +.. pushed) +.. +.. (could split of divergence, if split see the Z section) +.. +.. {{{ +.. A +.. B ○⇢ø⇠⊗ C +.. \|/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * `A ø⇠○ B` +.. * `A ø⇠○ C` +.. * C (prune) +.. +.. +.. Command run: +.. +.. * hg push -r O +.. +.. Expected exchange: +.. +.. * `A ø⇠○ C` +.. * C (prune) +.. +.. Expected exclude: +.. +.. * `A ø⇠○ B` + +Implemented as the non-split version + + $ setuprepos C.4 + creating test repo for test case C.4 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A + $ hg update -q 0 + $ mkcommit B + created new head + $ hg update -q 0 + $ mkcommit C + created new head + $ hg debugobsolete --hidden `getid 'desc(A)'` `getid 'desc(B)'` + $ hg debugobsolete --hidden `getid 'desc(A)'` `getid 'desc(C)'` + $ hg prune -qd '0 0' . + $ hg log -G --hidden + x 7f7f229b13a6 (draft): C + | + | o 35b183996678 (draft): B + |/ + | x f5bc6836db60 (draft): A + |/ + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + f5bc6836db60e308a17ba08bf050154ba9c4fad7 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest C.4 O + ## Running testcase C.4 + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + 2 new obsolescence markers + ## post pull state + # obstore: main + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 35b1839966785d5703a01607229eea932db42f87 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + f5bc6836db60e308a17ba08bf050154ba9c4fad7 7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-D1.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-D1.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,105 @@ + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== D.1 Pruned changeset based on missing precursor of something not present === + +.. {{{ +.. B ⊗ +.. | +.. A ◌⇠◔ A' +.. |/ +.. ● O +.. }}} +.. +.. Marker exist from: +.. +.. * A' succeed to A +.. * B (prune) +.. +.. Command run: +.. +.. * hg push -r A' +.. * hg push +.. +.. Expected exchange: +.. +.. * `A ø⇠o A'` +.. * B (prune) + + $ setuprepos D.1 + creating test repo for test case D.1 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B + $ hg up -q 0 + $ mkcommit A1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg prune -d '0 0' 'desc(B)' + 1 changesets pruned + $ hg strip --hidden -q 'desc(A0)' + $ hg log -G --hidden + @ e5ea8f9c7314 (draft): A1 + | + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest D.1 A1 + ## Running testcase D.1 + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 06055a7959d4128e6e3bccfd01482e83a2db8a3a 0 {28b51eb45704506b5c603decd6bf7ac5e0f6a52f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-D2.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-D2.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,94 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== D.2 missing prune target (prune in "pushed set") === + +{{{ +}}} + +Marker exist from: + + * A' succeed to A + * A' (prune) + +Command run: + + * hg push + +Expected exchange: + + * `A ø⇠o A'` + * A' (prune) + + + $ setuprepos D.2 + creating test repo for test case D.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ hg up -q 0 + $ mkcommit A1 + created new head + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg prune --date '0 0' . + 1 changesets pruned + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at a9bdc8b26820 + $ hg strip --hidden -q 'desc(A1)' + $ hg log -G --hidden + x 28b51eb45704 (draft): A0 + | + @ a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest D.2 + ## Running testcase D.2 + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing from main to pushdest + pushing to pushdest + searching for changes + no changes found + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling from main into pulldest + pulling from main + searching for changes + no changes found + 2 new obsolescence markers + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 {a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-D3.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-D3.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,90 @@ + + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== D.2 missing prune target (prune in "pushed set") === + +{{{ +}}} + +Marker exist from: + + * A' succeed to A + * A' (prune) + +Command run: + + * hg push + +Expected exchange: + + * `A ø⇠o A'` + * A' (prune) + + + $ setuprepos D.2 + creating test repo for test case D.2 + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ hg up -q 0 + $ mkcommit B + created new head + $ mkcommit A1 + $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'` + $ hg prune -d '0 0' . + 1 changesets pruned + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at 35b183996678 + $ hg strip --hidden -q 'desc(A1)' + $ hg log -G --hidden + @ 35b183996678 (draft): B + | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test +------------------------------------- + + $ dotest D.2 O + ## Running testcase D.2 + # testing echange of "O" (a9bdc8b26820) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "O" from main to pushdest + pushing to pushdest + searching for changes + no changes found + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pulling "a9bdc8b26820" from main into pulldest + pulling from main + no changes found + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6aa67a7b4baa6fb41b06aed38d5b1201436546e2 0 {35b1839966785d5703a01607229eea932db42f87} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-exchange-D4.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exchange-D4.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,125 @@ + + +Initial setup + + $ . $TESTDIR/_exc-util.sh + +=== D.4 Unknown changeset in between known one === + +.. Mostly a clarification case +.. +.. {{{ +.. ø⇠◌⇠○ +.. | |/ +.. | ◔ +.. |/ +.. ● O +.. +.. }}} +.. +.. Should be treated as A.3 case: +.. +.. {{{ +.. +.. ø⇠○ +.. | | +.. | ◔ +.. |/ +.. ● O +.. +.. }}} + + +initial + + $ setuprepos A.3.a + creating test repo for test case A.3.a + - pulldest + - main + - pushdest + cd into `main` and proceed with env setup + $ cd main + $ mkcommit A0 + $ mkcommit B0 + $ hg update -q 0 + $ mkcommit A1 + created new head + $ mkcommit B1 + $ hg debugobsolete `getid 'desc(A0)'` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A1)'` + $ hg debugobsolete `getid 'desc(B0)'` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb `getid 'desc(B1)'` + $ hg log -G --hidden + @ 069b05c3876d (draft): B1 + | + o e5ea8f9c7314 (draft): A1 + | + | x 6e72f0a95b5e (draft): B0 + | | + | x 28b51eb45704 (draft): A0 + |/ + o a9bdc8b26820 (public): O + + $ hg debugobsolete + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 069b05c3876d56f62895e853a501ea58ea85f68d 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + $ cd .. + $ cd .. + +Actual Test for first version (changeset unknown in remote) +----------------------------------------------------------- + + $ dotest A.3.a A1 + ## Running testcase A.3.a + # testing echange of "A1" (e5ea8f9c7314) + ## initial state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 069b05c3876d56f62895e853a501ea58ea85f68d 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + # obstore: pulldest + ## pushing "A1" from main to pushdest + pushing to pushdest + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + remote: 2 new obsolescence markers + ## post push state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 069b05c3876d56f62895e853a501ea58ea85f68d 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + ## pulling "e5ea8f9c7314" from main into pulldest + pulling from main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers + (run 'hg update' to get a working copy) + ## post pull state + # obstore: main + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 069b05c3876d56f62895e853a501ea58ea85f68d 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pushdest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + # obstore: pulldest + 28b51eb45704506b5c603decd6bf7ac5e0f6a52f aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-import.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-import.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,91 @@ + +This feature requires mercurial 3.0 +(and the `only()` revset is 3.0 specific) + + $ (hg help revset | grep '"only(' > /dev/null) || exit 80 + +Test creation of obsolescence marker by path import + + $ hg init auto-obsolete + $ cd auto-obsolete + $ echo '[extensions]' >> $HGRCPATH + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + $ echo A > a + $ hg commit -Am A + adding a + $ echo B > b + $ hg commit -Am B + adding b + $ hg up '.^' + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo C > c + $ hg commit -Am C + adding c + created new head + $ hg log -G + @ changeset: 2:eb8dd0f31b51 + | tag: tip + | parent: 0:f2bbf19cf96d + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: C + | + | o changeset: 1:95b760afef3c + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: B + | + o changeset: 0:f2bbf19cf96d + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: A + + +(actual test) + + $ hg export 'desc(B)' | hg import - --obsolete + applying patch from stdin + $ hg log -G + @ changeset: 3:00c49133f17e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: B + | + o changeset: 2:eb8dd0f31b51 + | parent: 0:f2bbf19cf96d + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: C + | + o changeset: 0:f2bbf19cf96d + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: A + + $ hg debugobsolete + 95b760afef3c234ffb3f9fd391edcb36e60921a4 00c49133f17e5e5a52b6ef1b6d516c0e90b56d8a 0 (*) {'user': 'test'} (glob) + + $ hg rollback + repository tip rolled back to revision 2 (undo import) + working directory now based on revision 2 + $ hg log -G + @ changeset: 2:eb8dd0f31b51 + | tag: tip + | parent: 0:f2bbf19cf96d + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: C + | + | o changeset: 1:95b760afef3c + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: B + | + o changeset: 0:f2bbf19cf96d + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: A + + $ hg debugobsolete + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-obsconvert.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-obsconvert.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,78 @@ + $ cat >> $HGRCPATH < [extensions] + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + $ hg init alpha + $ cd alpha + $ echo foo > foo + $ hg addremove + adding foo + $ hg ci -m 'foo' + $ for x in 1 2 3 4 ; do + > echo foo $x > foo + > hg amend + > done + +Test conversion between obsolete marker formats + $ hg debugobsolete + e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob) + a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob) + b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob) + 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob) + 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob) + 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob) + 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob) + 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob) + $ hg debugobsconvert --new-format 0 + Old store is version 1, will rewrite in version 0 + Done! + $ hg debugobsolete + e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob) + a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob) + b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob) + 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob) + 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob) + 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob) + 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob) + 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob) + $ hg debugobsconvert --new-format 0 + abort: New format is the same as the old format, not upgrading! + [255] + $ hg debugobsolete + e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob) + a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob) + b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob) + 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob) + 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob) + 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob) + 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob) + 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob) + $ hg debugobsconvert --new-format 1 + Old store is version 0, will rewrite in version 1 + Done! + $ hg debugobsolete + e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob) + a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob) + b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob) + 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob) + 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob) + 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob) + 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob) + 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob) + +Test that the default is some reasonably modern format (first downgrade) + $ hg debugobsconvert --new-format 0 + Old store is version 1, will rewrite in version 0 + Done! + $ hg debugobsconvert + Old store is version 0, will rewrite in version 1 + Done! + $ hg debugobsolete + e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'user': 'test'} (glob) + a5b276878fa564da042b4b9efef3713ceea20350 0 {e63c23eaa88ae77967edcf4ea194d31167c478b0} (*) {'user': 'test'} (glob) + b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'user': 'test'} (glob) + 2291082406feb57d0f83b9b0a6777b6074f3fde6 0 {b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34} (*) {'user': 'test'} (glob) + 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'user': 'test'} (glob) + 1616bdbe82d3fd1fb7c4e068aee277835672ffdc 0 {384fc811182687231962e486f23ea8c5bab7a2d3} (*) {'user': 'test'} (glob) + 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'user': 'test'} (glob) + 8668d55aac650158bb510be6d47d21e3db9e5c75 0 {949d379b3c3bf051906bc3528c049cb536e2ec86} (*) {'user': 'test'} (glob) diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-obsolete-divergent.t --- a/tests/test-obsolete-divergent.t Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +0,0 @@ -Test file decicated to testing the divergent troubles from obsolete changeset. - -This is the most complexe troubles from far so we isolate it in a dedicated -file. - -Enable obsolete - - $ cat >> $HGRCPATH << EOF - > [ui] - > logtemplate = {rev}:{node|short} {desc}\n - > [alias] - > debugobsolete = debugobsolete -d '0 0' - > [phases] - > publish=False - > [extensions] - > rebase= - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH - - - $ mkcommit() { - > echo "$1" > "$1" - > hg add "$1" - > hg ci -m "$1" - > } - $ getid() { - > hg id --debug -ir "desc('$1')" - > } - -setup repo - - $ hg init reference - $ cd reference - $ mkcommit base - $ mkcommit A_0 - $ hg up 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit A_1 - created new head - $ hg up 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit A_2 - created new head - $ hg up 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ cd .. - - - $ newcase() { - > hg clone -u 0 -q reference $1 - > cd $1 - > } - -direct divergence ------------------ - -A_1 have two direct and divergent successors A_1 and A_1 - - $ newcase direct - $ hg debugobsolete `getid A_0` `getid A_1` - $ hg debugobsolete `getid A_0` `getid A_2` - $ hg log -G --hidden - o 3:392fd25390da A_2 - | - | o 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - @ 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 392fd25390da - 82623d38b9ba - 82623d38b9ba - 82623d38b9ba - 392fd25390da - 392fd25390da - $ hg log -r 'divergent()' - 2:82623d38b9ba A_1 - 3:392fd25390da A_2 - $ hg summary -v - parent: 0:d20a80d4def3 - base - branch: default - commit: (clean) - update: 3 new changesets (update) - unstable: 0 changesets - bumped: 0 changesets - divergent: 2 changesets - - -check that mercurial refuse to push - - $ hg init ../other - $ hg push ../other - pushing to ../other - searching for changes - abort: push includes a divergent changeset: 82623d38b9ba! - (use 'hg evolve' to get a stable history or --force to ignore warnings) - [255] - - $ cd .. - - -indirect divergence with known changeset -------------------------------------------- - - $ newcase indirect_known - $ hg debugobsolete `getid A_0` `getid A_1` - $ hg debugobsolete `getid A_0` `getid A_2` - $ mkcommit A_3 - created new head - $ hg debugobsolete `getid A_2` `getid A_3` - $ hg log -G --hidden - @ 4:01f36c5a8fda A_3 - | - | x 3:392fd25390da A_2 - |/ - | o 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - o 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 01f36c5a8fda - 82623d38b9ba - 82623d38b9ba - 82623d38b9ba - 392fd25390da - 01f36c5a8fda - 01f36c5a8fda - 01f36c5a8fda - $ hg log -r 'divergent()' - 2:82623d38b9ba A_1 - 4:01f36c5a8fda A_3 - $ cd .. - - -indirect divergence with known changeset -------------------------------------------- - - $ newcase indirect_unknown - $ hg debugobsolete `getid A_0` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid A_1` - $ hg debugobsolete `getid A_0` `getid A_2` - $ hg log -G --hidden - o 3:392fd25390da A_2 - | - | o 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - @ 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 392fd25390da - 82623d38b9ba - 82623d38b9ba - 82623d38b9ba - 392fd25390da - 392fd25390da - $ hg log -r 'divergent()' - 2:82623d38b9ba A_1 - 3:392fd25390da A_2 - $ cd .. - -do not take unknown node in account if they are final ------------------------------------------------------ - - $ newcase final-unknown - $ hg debugobsolete `getid A_0` `getid A_1` - $ hg debugobsolete `getid A_1` `getid A_2` - $ hg debugobsolete `getid A_0` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc - $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd - - $ hg debugsuccessorssets 'desc('A_0')' - 007dc284c1f8 - 392fd25390da - - $ cd .. - -divergence that converge again is not divergence anymore ------------------------------------------------------ - - $ newcase converged_divergence - $ hg debugobsolete `getid A_0` `getid A_1` - $ hg debugobsolete `getid A_0` `getid A_2` - $ mkcommit A_3 - created new head - $ hg debugobsolete `getid A_1` `getid A_3` - $ hg debugobsolete `getid A_2` `getid A_3` - $ hg log -G --hidden - @ 4:01f36c5a8fda A_3 - | - | x 3:392fd25390da A_2 - |/ - | x 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - o 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 01f36c5a8fda - 82623d38b9ba - 01f36c5a8fda - 392fd25390da - 01f36c5a8fda - 01f36c5a8fda - 01f36c5a8fda - $ hg log -r 'divergent()' - $ cd .. - -split is not divergences ------------------------------ - - $ newcase split - $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2` - $ hg log -G --hidden - o 3:392fd25390da A_2 - | - | o 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - @ 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 82623d38b9ba 392fd25390da - 82623d38b9ba - 82623d38b9ba - 392fd25390da - 392fd25390da - $ hg log -r 'divergent()' - -Even when subsequente rewriting happen - - $ mkcommit A_3 - created new head - $ hg debugobsolete `getid A_1` `getid A_3` - $ hg up 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit A_4 - created new head - $ hg debugobsolete `getid A_2` `getid A_4` - $ hg up 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit A_5 - created new head - $ hg debugobsolete `getid A_4` `getid A_5` - $ hg log -G --hidden - @ 6:e442cfc57690 A_5 - | - | x 5:6a411f0d7a0a A_4 - |/ - | o 4:01f36c5a8fda A_3 - |/ - | x 3:392fd25390da A_2 - |/ - | x 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - o 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 01f36c5a8fda e442cfc57690 - 82623d38b9ba - 01f36c5a8fda - 392fd25390da - e442cfc57690 - 01f36c5a8fda - 01f36c5a8fda - 6a411f0d7a0a - e442cfc57690 - e442cfc57690 - e442cfc57690 - $ hg log -r 'divergent()' - -Check more complexe obsolescence graft (with divergence) - - $ mkcommit B_0; hg up 0 - 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg debugobsolete `getid B_0` `getid A_2` - $ mkcommit A_7; hg up 0 - created new head - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit A_8; hg up 0 - created new head - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg debugobsolete `getid A_5` `getid A_7` `getid A_8` - $ mkcommit A_9; hg up 0 - created new head - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg debugobsolete `getid A_5` `getid A_9` - $ hg log -G --hidden - o 10:bed64f5d2f5a A_9 - | - | o 9:14608b260df8 A_8 - |/ - | o 8:7ae126973a96 A_7 - |/ - | x 7:3750ebee865d B_0 - | | - | x 6:e442cfc57690 A_5 - |/ - | x 5:6a411f0d7a0a A_4 - |/ - | o 4:01f36c5a8fda A_3 - |/ - | x 3:392fd25390da A_2 - |/ - | x 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - @ 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 01f36c5a8fda bed64f5d2f5a - 01f36c5a8fda 7ae126973a96 14608b260df8 - 82623d38b9ba - 01f36c5a8fda - 392fd25390da - bed64f5d2f5a - 7ae126973a96 14608b260df8 - 01f36c5a8fda - 01f36c5a8fda - 6a411f0d7a0a - bed64f5d2f5a - 7ae126973a96 14608b260df8 - e442cfc57690 - bed64f5d2f5a - 7ae126973a96 14608b260df8 - 3750ebee865d - bed64f5d2f5a - 7ae126973a96 14608b260df8 - 7ae126973a96 - 7ae126973a96 - 14608b260df8 - 14608b260df8 - bed64f5d2f5a - bed64f5d2f5a - $ hg log -r 'divergent()' - 4:01f36c5a8fda A_3 - 8:7ae126973a96 A_7 - 9:14608b260df8 A_8 - 10:bed64f5d2f5a A_9 - -fix the divergence - - $ mkcommit A_A; hg up 0 - created new head - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg debugobsolete `getid A_9` `getid A_A` - $ hg debugobsolete `getid A_7` `getid A_A` - $ hg debugobsolete `getid A_8` `getid A_A` - $ hg log -G --hidden - o 11:a139f71be9da A_A - | - | x 10:bed64f5d2f5a A_9 - |/ - | x 9:14608b260df8 A_8 - |/ - | x 8:7ae126973a96 A_7 - |/ - | x 7:3750ebee865d B_0 - | | - | x 6:e442cfc57690 A_5 - |/ - | x 5:6a411f0d7a0a A_4 - |/ - | o 4:01f36c5a8fda A_3 - |/ - | x 3:392fd25390da A_2 - |/ - | x 2:82623d38b9ba A_1 - |/ - | x 1:007dc284c1f8 A_0 - |/ - @ 0:d20a80d4def3 base - - $ hg debugsuccessorssets 'all()' - d20a80d4def3 - d20a80d4def3 - 007dc284c1f8 - 01f36c5a8fda a139f71be9da - 82623d38b9ba - 01f36c5a8fda - 392fd25390da - a139f71be9da - 01f36c5a8fda - 01f36c5a8fda - 6a411f0d7a0a - a139f71be9da - e442cfc57690 - a139f71be9da - 3750ebee865d - a139f71be9da - 7ae126973a96 - a139f71be9da - 14608b260df8 - a139f71be9da - bed64f5d2f5a - a139f71be9da - a139f71be9da - a139f71be9da - $ hg log -r 'divergent()' - - $ cd .. - - -Subset does not diverge ------------------------------- - -Do not report divergent successors-set if it is a subset of another -successors-set. (report [A,B] not [A] + [A,B]) - - $ newcase subset - $ hg debugobsolete `getid A_0` `getid A_2` - $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2` - $ hg debugsuccessorssets 'desc('A_0')' - 007dc284c1f8 - 82623d38b9ba 392fd25390da - - $ cd .. diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-obsolete-push.t --- a/tests/test-obsolete-push.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-obsolete-push.t Tue Jun 23 16:49:53 2015 -0700 @@ -2,7 +2,6 @@ > [defaults] > amend=-d "0 0" > [extensions] - > hgext.rebase= > hgext.graphlog= > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH @@ -27,6 +26,7 @@ $ hg ci -qAm C c $ hg phase --secret --force . $ hg kill 0 1 + 2 changesets pruned 1 new unstable changesets $ glog --hidden @ 2:244232c2222a@default(unstable/secret) C diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-obsolete-rebase.t --- a/tests/test-obsolete-rebase.t Tue Jun 23 16:47:47 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ - $ cat >> $HGRCPATH < [defaults] - > amend=-d "0 0" - > [extensions] - > hgext.rebase= - > hgext.graphlog= - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH - - $ glog() { - > hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n'\ - > "$@" - > } - - $ hg init repo - $ cd repo - $ echo a > a - $ hg ci -Am adda - adding a - $ echo a >> a - $ hg ci -m changea - -Test regular rebase - - $ hg up 0 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo b > b - $ hg ci -Am addb - adding b - created new head - $ echo e > e - $ hg ci -Am adde e - -(phase compliance) - - $ hg phase --public 3 - $ hg rebase -d 1 -r 3 - abort: can't rebase immutable changeset 98e4a024635e - (see hg help phases for details) - [255] - $ hg phase --draft --force 0 - $ hg rebase -d 1 -r 3 --keep - $ glog - @ 4:9c5494949763@default(draft) adde - | - | o 3:98e4a024635e@default(draft) adde - | | - | o 2:102a90ea7b4a@default(draft) addb - | | - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ glog --hidden - @ 4:9c5494949763@default(draft) adde - | - | o 3:98e4a024635e@default(draft) adde - | | - | o 2:102a90ea7b4a@default(draft) addb - | | - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ hg debugobsolete - $ hg --config extensions.hgext.mq= strip tip - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9c5494949763-backup.hg - $ hg rebase -d 1 -r 3 - $ glog - @ 4:9c5494949763@default(draft) adde - | - | o 2:102a90ea7b4a@default(draft) addb - | | - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ glog --hidden - @ 4:9c5494949763@default(draft) adde - | - | x 3:98e4a024635e@default(draft) adde - | | - | o 2:102a90ea7b4a@default(draft) addb - | | - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ hg debugobsolete - 98e4a024635e8c50928144c9277a4388d26bd786 9c54949497631abfb5a255d96746bbd3a42ed2ba 0 {'date': '* *', 'user': 'test'} (glob) - -Test rebase with deleted empty revision - - $ hg up 0 - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg branch foo - marked working directory as branch foo - (branches are permanent and global, did you want a bookmark?) - $ echo a >> a - $ hg ci -m changea - $ hg rebase -d 1 - $ glog --hidden - x 5:4e322f7ce8e3@foo(draft) changea - | - | o 4:9c5494949763@default(draft) adde - | | - | | x 3:98e4a024635e@default(draft) adde - | | | - +---o 2:102a90ea7b4a@default(draft) addb - | | - | @ 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ hg debugobsolete - 98e4a024635e8c50928144c9277a4388d26bd786 9c54949497631abfb5a255d96746bbd3a42ed2ba 0 {'date': '* *', 'user': 'test'} (glob) - 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c 540395c442253af3b991be882b539e7e198b5808 0 {'date': '* *', 'user': 'test'} (glob) - -Test rebase --collapse - - $ hg up 0 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo c > c - $ hg ci -Am addc - adding c - created new head - $ echo c >> c - $ hg ci -m changec - $ hg rebase --collapse -d 1 - merging c - $ glog --hidden - @ 8:a7773ffa7edc@default(draft) Collapsed revision - | - | x 7:03f31481307a@default(draft) changec - | | - | x 6:076e9b2ffbe1@default(draft) addc - | | - | | x 5:4e322f7ce8e3@foo(draft) changea - | |/ - +---o 4:9c5494949763@default(draft) adde - | | - | | x 3:98e4a024635e@default(draft) adde - | | | - | | o 2:102a90ea7b4a@default(draft) addb - | |/ - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ hg debugobsolete - 98e4a024635e8c50928144c9277a4388d26bd786 9c54949497631abfb5a255d96746bbd3a42ed2ba 0 {'date': '* *', 'user': 'test'} (glob) - 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c 540395c442253af3b991be882b539e7e198b5808 0 {'date': '* *', 'user': 'test'} (glob) - 076e9b2ffbe11c7bcb9ee97f5c0c8b88a1a10b93 a7773ffa7edcfac27b5dcdb2d5c1036e15a49861 0 {'date': '* *', 'user': 'test'} (glob) - 03f31481307aaf5275d07ec28c1c59931759ccd2 a7773ffa7edcfac27b5dcdb2d5c1036e15a49861 0 {'date': '* *', 'user': 'test'} (glob) - -Test rebase --abort - - $ hg debugobsolete > ../successors.old - $ hg up 0 - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ echo d > d - $ hg ci -Am addd d - created new head - $ echo b >> a - $ hg ci -m appendab - $ hg rebase -d 1 - merging a - warning: conflicts during merge. - merging a incomplete! (edit conflicts, then use 'hg resolve --mark') - abort: unresolved conflicts (see hg resolve, then hg rebase --continue) - [255] - $ hg rebase --abort - saved backup bundle to $TESTTMP/repo/.hg/strip-backup/03f165c84ea8-backup.hg - rebase aborted - $ hg debugobsolete > ../successors.new - $ diff -u ../successors.old ../successors.new - -Test rebase --continue - - $ hg rebase -d 1 - merging a - warning: conflicts during merge. - merging a incomplete! (edit conflicts, then use 'hg resolve --mark') - abort: unresolved conflicts (see hg resolve, then hg rebase --continue) - [255] - $ hg resolve --tool internal:other a - $ hg rebase --continue - $ glog --hidden - @ 12:1951ead97108@default(draft) appendab - | - o 11:03f165c84ea8@default(draft) addd - | - | x 10:4b9d80f48523@default(draft) appendab - | | - | x 9:a31943eabc43@default(draft) addd - | | - +---o 8:a7773ffa7edc@default(draft) Collapsed revision - | | - | | x 7:03f31481307a@default(draft) changec - | | | - | | x 6:076e9b2ffbe1@default(draft) addc - | |/ - | | x 5:4e322f7ce8e3@foo(draft) changea - | |/ - +---o 4:9c5494949763@default(draft) adde - | | - | | x 3:98e4a024635e@default(draft) adde - | | | - | | o 2:102a90ea7b4a@default(draft) addb - | |/ - o | 1:540395c44225@default(draft) changea - |/ - o 0:07f494440405@default(draft) adda - - $ hg debugobsolete > ../successors.new - $ diff -u ../successors.old ../successors.new - --- ../successors.old* (glob) - +++ ../successors.new* (glob) - @@ -2,3 +2,5 @@ - 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c 540395c442253af3b991be882b539e7e198b5808 0 {'date': '* *', 'user': 'test'} (glob) - 076e9b2ffbe11c7bcb9ee97f5c0c8b88a1a10b93 a7773ffa7edcfac27b5dcdb2d5c1036e15a49861 0 {'date': '* *', 'user': 'test'} (glob) - 03f31481307aaf5275d07ec28c1c59931759ccd2 a7773ffa7edcfac27b5dcdb2d5c1036e15a49861 0 {'date': '* *', 'user': 'test'} (glob) - +a31943eabc4327df16f9eca71bf7779c32f815f7 03f165c84ea8889fc35a64a392caa7a0084dd212 0 {'date': '* *', 'user': 'test'} (glob) - +4b9d80f48523e296f4402cc8e37236b768dfb981 1951ead9710803dbf117e95901954d5ed717f80b 0 {'date': '* *', 'user': 'test'} (glob) - [1] - -Test hg pull --rebase - - $ hg glog - @ changeset: 12:1951ead97108 - | tag: tip - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: appendab - | - o changeset: 11:03f165c84ea8 - | parent: 1:540395c44225 - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: addd - | - | o changeset: 8:a7773ffa7edc - |/ parent: 1:540395c44225 - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: Collapsed revision - | - | o changeset: 4:9c5494949763 - |/ parent: 1:540395c44225 - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: adde - | - | o changeset: 2:102a90ea7b4a - | | parent: 0:07f494440405 - | | user: test - | | date: Thu Jan 01 00:00:00 1970 +0000 - | | summary: addb - | | - o | changeset: 1:540395c44225 - |/ user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: changea - | - o changeset: 0:07f494440405 - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: adda - - $ echo '[phases]' >> .hg/hgrc - $ echo 'publish=False' >> .hg/hgrc - $ hg clone . -r 540395c44225 ../other - adding changesets - adding manifests - adding file changes - added 2 changesets with 2 changes to 1 files - updating to branch default - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg ph -vfd 'all()' - no phases changed - [1] - $ cd ../other - $ echo 'babar' > toto - $ hg add toto - $ hg ci -m 'babar is not dead' - $ echo '[ui]' >> .hg/hgrc - $ echo 'logtemplate={rev} {node|short} {desc|firstline}\n' >> .hg/hgrc - $ hg pull --rebase --traceback | grep -v 'saved' - pulling from $TESTTMP/repo - searching for changes - adding changesets - adding manifests - adding file changes - added 5 changesets with 5 changes to 5 files (+4 heads) - $ hg glog - @ [78] d5567dbec794 babar is not dead (re) - | - o [67] 1951ead97108 appendab (re) - | - o [56] 03f165c84ea8 addd (re) - | - | o [45] a7773ffa7edc Collapsed revision (re) - |/ - | o [34] 9c5494949763 adde (re) - |/ - | o [23] 102a90ea7b4a addb (re) - | | - o | 1 540395c44225 changea - |/ - o 0 07f494440405 adda - diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-obsolete.t --- a/tests/test-obsolete.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-obsolete.t Tue Jun 23 16:49:53 2015 -0700 @@ -5,7 +5,7 @@ > [phases] > publish=False > [alias] - > odiff=diff --rev 'limit(precursors(.),1)' --rev . + > debugobsolete=debugobsolete -d '0 0' > [extensions] > hgext.rebase= > EOF @@ -16,7 +16,7 @@ > hg ci -m "add $1" > } $ getid() { - > hg id --debug -ir "$1" + > hg id --hidden --debug -ir "$1" > } $ alias qlog="hg log --template='{rev}\n- {node|short}\n'" @@ -36,7 +36,7 @@ 0d3f46688ccc6e756c7e96cf64c391c411309597 $ hg debugobsolete 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 $ hg debugobsolete - 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 {'date': '', 'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} Test hidden() revset @@ -67,7 +67,7 @@ 2 - 4538525df7e2 -Test that obsolete parent a properly computed +Test that obsolete precursors are properly computed $ qlog -r 'precursors(.)' --hidden 2 @@ -87,13 +87,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 @@ -120,8 +120,17 @@ - 0d3f46688ccc 4 - 725c380fe99b - $ hg up 3 -q - Working directory parent is obsolete + $ hg up --hidden 3 -q + working directory parent is obsolete! +(reported by parents too) + $ hg parents + changeset: 3:0d3f46688ccc + parent: 1:7c3bad9141dc + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add obsol_c + + working directory parent is obsolete! $ mkcommit d # 5 (on 3) 1 new unstable changesets $ qlog -r 'obsolete()' @@ -164,7 +173,7 @@ $ hg push ../other-new pushing to ../other-new searching for changes - abort: push includes an unstable changeset: a7a6f2b5d8a5! + abort: push includes unstable changeset: a7a6f2b5d8a5! (use 'hg evolve' to get a stable history or --force to ignore warnings) [255] $ hg push -f ../other-new @@ -174,6 +183,8 @@ adding manifests adding file changes added 5 changesets with 5 changes to 5 files (+1 heads) + pushing 2 obsolescence markers (* bytes) (glob) + 2 obsolescence markers added $ hg -R ../other-new verify checking changesets checking manifests @@ -194,8 +205,8 @@ - 7c3bad9141dc 0 - 1f0dee641bb7 - $ hg up 3 -q - Working directory parent is obsolete + $ hg up --hidden 3 -q + working directory parent is obsolete! $ mkcommit obsol_d # 6 created new head 1 new unstable changesets @@ -217,7 +228,7 @@ $ hg push ../other-new pushing to ../other-new searching for changes - abort: push includes an unstable changeset: 95de7fc6918d! + abort: push includes unstable changeset: 95de7fc6918d! (use 'hg evolve' to get a stable history or --force to ignore warnings) [255] $ hg push ../other-new -f # use f because there is unstability @@ -227,6 +238,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + pushing 3 obsolescence markers (* bytes) (glob) + 1 obsolescence markers added $ qlog -R ../other-new 5 - 95de7fc6918d @@ -242,16 +255,18 @@ 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 + pushing 3 obsolescence markers (* bytes) (glob) + 0 obsolescence markers added [1] - $ hg up -q .^ # 3 - Working directory parent is obsolete + $ hg up --hidden -q .^ # 3 + working directory parent is obsolete! $ mkcommit "obsol_d'" # 7 created new head 1 new unstable changesets @@ -262,8 +277,10 @@ adding changesets adding manifests adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) - (run 'hg heads .' to see heads, 'hg merge' to merge) + added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) + pull obsolescence markers + 1 obsolescence markers added + (run 'hg heads' to see heads, 'hg merge' to merge) $ qlog -R ../other-new 6 - 909a0fb57e5d @@ -276,9 +293,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 @@ -337,8 +354,8 @@ Test rollback support - $ hg up .^ -q # 3 - Working directory parent is obsolete + $ hg up --hidden .^ -q # 3 + working directory parent is obsolete! $ mkcommit "obsol_d''" created new head 1 new unstable changesets @@ -351,8 +368,10 @@ adding changesets adding manifests adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) - (run 'hg heads .' to see heads, 'hg merge' to merge) + added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) + 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 $ qlog @@ -374,7 +393,7 @@ add obsol_c' branch: default commit: 1 deleted, 2 unknown (clean) - update: 4 new changesets, 4 branch heads (merge) + update: 2 new changesets, 2 branch heads (merge) unstable: 1 changesets $ qlog 6 @@ -437,7 +456,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 @@ -445,7 +464,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 @@ -468,35 +487,40 @@ 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 -s 7 -d 4 2>&1 | grep -v 'whole rebase' - nothing to rebase $ hg rebase -b '3' -d 4 --traceback + rebasing 3:0d3f46688ccc "add obsol_c" + rebasing 8:159dfc9fa5d3 "add obsol_d''" (tip) 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' @ 11 - 9468a5f5d8b2 add obsol_d'' | @@ -510,6 +534,7 @@ Does not complain about new head if you obsolete the old one +(re necessary when we start running discovery on unfiltered repo in core) $ hg push ../other-new --traceback pushing to ../other-new @@ -517,7 +542,9 @@ adding changesets adding manifests adding file changes - added 2 changesets with 1 changes to 1 files + added 2 changesets with 1 changes to [12] files (re) + pushing 7 obsolescence markers (* bytes) (glob) + 3 obsolescence markers added $ hg up -q 10 $ mkcommit "obsol_d'''" created new head @@ -529,13 +556,15 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + pushing 8 obsolescence markers (* bytes) (glob) + 1 obsolescence markers added $ cd .. check bumped detection (make an obsolete changeset public) $ cd local - $ hg phase --public 11 + $ hg phase --hidden --public 11 1 new bumped changesets $ hg log -G --template='{rev} - ({phase}) {node|short} {desc}\n' @ 12 - (draft) 6db5e282cb91 add obsol_d''' @@ -561,7 +590,7 @@ $ hg push ../other-new/ pushing to ../other-new/ searching for changes - abort: push includes a bumped changeset: 6db5e282cb91! + abort: push includes bumped changeset: 6db5e282cb91! (use 'hg evolve' to get a stable history or --force to ignore warnings) [255] @@ -574,7 +603,7 @@ $ echo 42 >> f $ hg commit --amend --traceback --quiet $ hg log -G - @ changeset: 1[35]:3734a65252e6 (re) + @ changeset: 15:705ab2a6b72e | tag: tip | parent: 10:2033b4e49474 | user: test @@ -615,21 +644,21 @@ summary: add a $ hg debugobsolete | grep -v 33d458d86621f3186c40bfccd77652f4a122743e - 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 {'date': '', 'user': 'test'} (glob) - 0d3f46688ccc6e756c7e96cf64c391c411309597 725c380fe99b5e76613493f0903e8d11ddc70d54 0 {'date': '', 'user': 'test'} (glob) - a7a6f2b5d8a54b81bc7aa2fba2934ad6d700a79e 95de7fc6918dea4c9c8d5382f50649794b474c4a 0 {'date': '', 'user': 'test'} (glob) - 95de7fc6918dea4c9c8d5382f50649794b474c4a 909a0fb57e5d909f353d89e394ffd7e0890fec88 0 {'date': '', 'user': 'test'} (glob) - 909a0fb57e5d909f353d89e394ffd7e0890fec88 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 0 {'date': '', 'user': 'test'} (glob) - 1f0dee641bb7258c56bd60e93edfa2405381c41e 83b5778897adafb967ef2f75be3aaa4fce49a4cc 0 {'date': '', 'user': 'test'} (glob) - 83b5778897adafb967ef2f75be3aaa4fce49a4cc 0 {'date': '', 'user': 'test'} (glob) - 0d3f46688ccc6e756c7e96cf64c391c411309597 2033b4e494742365851fac84d276640cbf52833e 0 {'date': '* *', 'user': 'test'} (glob) - 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 0 {'date': '* *', 'user': 'test'} (glob) - 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 6db5e282cb91df5c43ff1f1287c119ff83230d42 0 {'date': '', 'user': 'test'} (glob) - 0b1b6dd009c037985363e2290a0b579819f659db 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 0d3f46688ccc6e756c7e96cf64c391c411309597 725c380fe99b5e76613493f0903e8d11ddc70d54 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + a7a6f2b5d8a54b81bc7aa2fba2934ad6d700a79e 95de7fc6918dea4c9c8d5382f50649794b474c4a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 95de7fc6918dea4c9c8d5382f50649794b474c4a 909a0fb57e5d909f353d89e394ffd7e0890fec88 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 909a0fb57e5d909f353d89e394ffd7e0890fec88 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 1f0dee641bb7258c56bd60e93edfa2405381c41e 83b5778897adafb967ef2f75be3aaa4fce49a4cc 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 83b5778897adafb967ef2f75be3aaa4fce49a4cc 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 0d3f46688ccc6e756c7e96cf64c391c411309597 2033b4e494742365851fac84d276640cbf52833e 0 (*) {'user': 'test'} (glob) + 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 0 (*) {'user': 'test'} (glob) + 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 6db5e282cb91df5c43ff1f1287c119ff83230d42 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 0b1b6dd009c037985363e2290a0b579819f659db 705ab2a6b72e2cd86edb799ebe15f2695f86143e 0 (*) {'user': 'test'} (glob) #no produced by 2.3 33d458d86621f3186c40bfccd77652f4a122743e 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob) -Check conflict detection +Check divergence detection $ hg up 9468a5f5d8b2 # add obsol_d'' 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -639,20 +668,172 @@ add obsolet_conflicting_d branch: default commit: (clean) - update: (9|11) new changesets, (9|10) branch heads \(merge\) (re) + update: (2|9|11) new changesets, (3|9|10) branch heads \(merge\) (re) bumped: 1 changesets $ hg debugobsolete `getid a7a6f2b5d8a5` `getid 50f11e5e3a63` - $ hg log -r 'conflicting()' + $ hg log -r 'divergent()' changeset: 12:6db5e282cb91 parent: 10:2033b4e49474 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add obsol_d''' - changeset: 14:50f11e5e3a63 + changeset: 16:50f11e5e3a63 tag: tip parent: 11:9468a5f5d8b2 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add obsolet_conflicting_d + + $ hg up --hidden 3 -q + working directory parent is obsolete! + $ hg evolve + parent is obsolete with multiple successors: + [4] add obsol_c' + [10] add obsol_c + [2] + $ hg olog + changeset: 2:4538525df7e2 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add c + + +Check import reports new unstable changeset: + + $ hg up --hidden 2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory parent is obsolete! + $ hg export 9468a5f5d8b2 | hg import - + applying patch from stdin + 1 new unstable changesets + + +Relevant marker computation +============================== + + $ hg log -G --hidden + @ changeset: 17:a5f7a21fe7bc + | tag: tip + | parent: 2:4538525df7e2 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add obsol_d'' + | + | o changeset: 16:50f11e5e3a63 + | | parent: 11:9468a5f5d8b2 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: add obsolet_conflicting_d + | | + | | o changeset: 15:705ab2a6b72e + | | | parent: 10:2033b4e49474 + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add f + | | | + | | | x changeset: 14:33d458d86621 + | | | | user: test + | | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | | summary: temporary amend commit for 0b1b6dd009c0 + | | | | + | | | x changeset: 13:0b1b6dd009c0 + | | |/ parent: 10:2033b4e49474 + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add f + | | | + | | | o changeset: 12:6db5e282cb91 + | | |/ parent: 10:2033b4e49474 + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add obsol_d''' + | | | + | o | changeset: 11:9468a5f5d8b2 + | |/ user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: add obsol_d'' + | | + | o changeset: 10:2033b4e49474 + | | parent: 4:725c380fe99b + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: add obsol_c + | | + | | x changeset: 9:83b5778897ad + | | parent: -1:000000000000 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: add toto + | | + | | x changeset: 8:159dfc9fa5d3 + | | | parent: 3:0d3f46688ccc + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add obsol_d'' + | | | + | | | x changeset: 7:909a0fb57e5d + | | |/ parent: 3:0d3f46688ccc + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add obsol_d' + | | | + | | | x changeset: 6:95de7fc6918d + | | |/ parent: 3:0d3f46688ccc + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add obsol_d + | | | + | | | x changeset: 5:a7a6f2b5d8a5 + | | |/ parent: 3:0d3f46688ccc + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add d + | | | + | o | changeset: 4:725c380fe99b + | | | parent: 1:7c3bad9141dc + | | | user: test + | | | date: Thu Jan 01 00:00:00 1970 +0000 + | | | summary: add obsol_c' + | | | + | | x changeset: 3:0d3f46688ccc + | |/ parent: 1:7c3bad9141dc + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: add obsol_c + | | + x | changeset: 2:4538525df7e2 + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add c + | + o changeset: 1:7c3bad9141dc + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: add b + | + o changeset: 0:1f0dee641bb7 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add a + + +Simple rewrite + + $ hg --hidden debugobsolete --rev 3 + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + +simple rewrite with a prune attached to it + + $ hg debugobsolete --rev 15 + 0b1b6dd009c037985363e2290a0b579819f659db 705ab2a6b72e2cd86edb799ebe15f2695f86143e 0 (*) {'user': 'test'} (glob) + 33d458d86621f3186c40bfccd77652f4a122743e 0 {0b1b6dd009c037985363e2290a0b579819f659db} (*) {'user': 'test'} (glob) + +Transitive rewrite + + $ hg --hidden debugobsolete --rev 8 + 909a0fb57e5d909f353d89e394ffd7e0890fec88 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + 95de7fc6918dea4c9c8d5382f50649794b474c4a 909a0fb57e5d909f353d89e394ffd7e0890fec88 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + a7a6f2b5d8a54b81bc7aa2fba2934ad6d700a79e 95de7fc6918dea4c9c8d5382f50649794b474c4a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} + diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-oldconvert.t --- a/tests/test-oldconvert.t Tue Jun 23 16:47:47 2015 -0700 +++ b/tests/test-oldconvert.t Tue Jun 23 16:49:53 2015 -0700 @@ -54,7 +54,7 @@ summary: add a $ hg debugobsolete - 7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 {'date': '* *', 'user': 'test'} (glob) + 7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 (*) {'user': 'test'} (glob) $ hg debugconvertobsolete nothing to do 0 obsolete marker converted @@ -108,7 +108,7 @@ $ hg debugconvertobsolete --traceback 3 obsolete marker converted $ hg debugobsolete - 7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 {'date': '* *', 'user': 'test'} (glob) - 3e03d82708d4da97a92158558dd13386d8f09ad5 3218406b50ed13480765e7c260669620f37fba6e 0 {'date': '* *', 'user': 'Pierre-Yves David '} (glob) - 5c722672795c3a2cb94d0cc9a821c394c1475f87 0 {'date': '* *', 'user': 'Pierre-Yves David '} (glob) - 2c3784e102bb34ccc93862af5bd6d609ee30c577 0 {'date': '* *', 'user': 'Pierre-Yves David '} (glob) + 7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 (*) {'user': 'test'} (glob) + 3e03d82708d4da97a92158558dd13386d8f09ad5 3218406b50ed13480765e7c260669620f37fba6e 0 (Tue May 08 20:55:23 2012 +0200) {'user': 'Pierre-Yves David '} + 5c722672795c3a2cb94d0cc9a821c394c1475f87 0 (Wed May 09 11:57:52 2012 +0200) {'user': 'Pierre-Yves David '} + 2c3784e102bb34ccc93862af5bd6d609ee30c577 0 (Wed May 09 11:57:52 2012 +0200) {'user': 'Pierre-Yves David '} diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-prev-next.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-prev-next.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,84 @@ + $ cat >> $HGRCPATH < [extensions] + > hgext.graphlog= + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + +hg prev -B should move active bookmark + $ hg init + $ touch a + $ hg add a + $ hg commit -m 'added a' + $ touch b + $ hg add b + $ hg commit -m 'added b' + $ hg bookmark mark + $ hg bookmarks + * mark 1:6e742c9127b3 + $ hg prev -B + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [0] added a + $ hg bookmarks + * mark 0:a154386e50d1 + +hg next -B should move active bookmark + $ hg next -B + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [1] added b + $ hg bookmarks + * mark 1:6e742c9127b3 + +hg prev should unset active bookmark + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [0] added a + $ hg bookmarks + mark 1:6e742c9127b3 + +hg next should move active bookmark + $ hg bookmark mark2 + $ hg bookmarks + mark 1:6e742c9127b3 + * mark2 0:a154386e50d1 + $ hg next + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [1] added b + $ hg bookmarks + mark 1:6e742c9127b3 + mark2 0:a154386e50d1 + + $ hg bookmark -d mark2 + $ hg bookmark mark + +hg next/prev should not interfere with inactive bookmarks + $ touch c + $ hg add c + $ hg commit -m 'added c' + $ hg bookmark -r2 no-move + $ hg prev -B + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [1] added b + $ hg bookmarks + * mark 1:6e742c9127b3 + no-move 2:4e26ef31f919 + $ hg next -B + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [2] added c + $ hg bookmarks + * mark 2:4e26ef31f919 + no-move 2:4e26ef31f919 + $ hg up 1 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + (leaving bookmark mark) + $ hg next -B + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [2] added c + $ hg bookmarks + mark 2:4e26ef31f919 + no-move 2:4e26ef31f919 + $ hg prev -B + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [1] added b + $ hg bookmarks + mark 2:4e26ef31f919 + no-move 2:4e26ef31f919 diff -r eccfd01aec56 -r 8a20b2774a65 tests/test-prune.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-prune.t Tue Jun 23 16:49:53 2015 -0700 @@ -0,0 +1,334 @@ + $ cat >> $HGRCPATH < [ui] + > logtemplate={rev}:{node|short}[{bookmarks}] ({obsolete}/{phase}) {desc|firstline}\n + > [extensions] + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + + $ mkcommit() { + > echo "$1" > "$1" + > hg add "$1" + > hg ci -m "add $1" + > } + + $ hg init repo + $ cd repo + $ mkcommit a + $ hg phase --public . + $ mkcommit b + $ mkcommit c + $ mkcommit d + $ mkcommit e + $ hg bookmarks BABAR + $ hg log -G + @ 4:9d206ffc875e[BABAR] (stable/draft) add e + | + o 3:47d2a3944de8[] (stable/draft) add d + | + o 2:4538525df7e2[] (stable/draft) add c + | + o 1:7c3bad9141dc[] (stable/draft) add b + | + o 0:1f0dee641bb7[] (stable/public) add a + + +Check simple case +---------------------------- + +prune current and tip changeset + + $ hg prune --user blah --date '1979-12-15' . + 1 changesets pruned + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at 47d2a3944de8 + $ hg bookmark + * BABAR 3:47d2a3944de8 + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + +prune leaving instability behind + + $ hg prune 1 + 1 changesets pruned + 2 new unstable changesets + $ hg book -i BABAR + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + +pruning multiple changeset at once + + $ hg prune 2: + 2 changesets pruned + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + working directory now at 1f0dee641bb7 + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + +cannot prune public changesets + + $ hg prune 0 + abort: cannot prune immutable changeset: 1f0dee641bb7 + (see "hg help phases" for details) + [255] + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + +Check successors addition +---------------------------- + + $ mkcommit bb + $ mkcommit cc + $ mkcommit dd + $ mkcommit ee + $ hg up 0 + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ mkcommit nB + created new head + $ mkcommit nC + $ mkcommit nD + $ mkcommit nE + + $ hg log -G + @ 12:6e8148413dd5[] (stable/draft) add nE + | + o 11:8ee176ff1d4b[] (stable/draft) add nD + | + o 10:aa96dc3f04c2[] (stable/draft) add nC + | + o 9:6f6f25e4f748[] (stable/draft) add nB + | + | o 8:bb5e90a7ea1f[] (stable/draft) add ee + | | + | o 7:00ded550b1e2[] (stable/draft) add dd + | | + | o 6:354011cd103f[] (stable/draft) add cc + | | + | o 5:814c38b95e72[] (stable/draft) add bb + |/ + o 0:1f0dee641bb7[BABAR] (stable/public) add a + + +one old, one new + + $ hg up 'desc("add ee")' + 4 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ hg prune 'desc("add ee")' -s 'desc("add nE")' + 1 changesets pruned + 4 files updated, 0 files merged, 4 files removed, 0 files unresolved + working directory now at 6e8148413dd5 + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + $ hg log -G + @ 12:6e8148413dd5[] (stable/draft) add nE + | + o 11:8ee176ff1d4b[] (stable/draft) add nD + | + o 10:aa96dc3f04c2[] (stable/draft) add nC + | + o 9:6f6f25e4f748[] (stable/draft) add nB + | + | o 7:00ded550b1e2[] (stable/draft) add dd + | | + | o 6:354011cd103f[] (stable/draft) add cc + | | + | o 5:814c38b95e72[] (stable/draft) add bb + |/ + o 0:1f0dee641bb7[BABAR] (stable/public) add a + + +one old, two new + + $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")' + 1 changesets pruned + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) + $ hg log -G + @ 12:6e8148413dd5[] (stable/draft) add nE + | + o 11:8ee176ff1d4b[] (stable/draft) add nD + | + o 10:aa96dc3f04c2[] (stable/draft) add nC + | + o 9:6f6f25e4f748[] (stable/draft) add nB + | + | o 6:354011cd103f[] (stable/draft) add cc + | | + | o 5:814c38b95e72[] (stable/draft) add bb + |/ + o 0:1f0dee641bb7[BABAR] (stable/public) add a + + +two old, two new (should be denied) + + $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")' + abort: Can't use multiple successors for multiple precursors + [255] + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) + +two old, one new: + + $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")' + 2 changesets pruned + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) + 814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (*) {'user': 'test'} (glob) + 354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (*) {'user': 'test'} (glob) + +two old, two new with --biject + + $ hg up 0 + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ mkcommit n1 + created new head + $ mkcommit n2 + + $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --biject + 2 changesets pruned + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + working directory now at 1f0dee641bb7 + $ hg debugobsolete + 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'} + 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob) + 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (*) {'user': 'test'} (glob) + 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob) + bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) + 814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (*) {'user': 'test'} (glob) + 354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (*) {'user': 'test'} (glob) + cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) + 21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) + +test hg prune -B bookmark +yoinked from test-mq-strip.t + + $ cd .. + $ hg init bookmarks + $ cd bookmarks + $ hg debugbuilddag '..<2.*1/2:m<2+3:c