Initialsetup-------------ThisMercurialconfigurationexampleisusedfortesting...Varioussetup$cat>>$HGRCPATH<<EOF>[ui]>logtemplate="{node|short} ({phase}): {desc}\n">[diff]>git=1>[alias]>#"-d '0 0'"meansthatthenewcommitwillbeatJanuary1st1970.>#Thisisusedforstablehashduringtest>amend=amend-d'0 0'>EOF$hginitlocal$cat>>local/.hg/hgrc<<EOF>[paths]>remote=../remote>other=../other>[ui]>user=BabartheKing>EOF$hginitremote$cat>>remote/.hg/hgrc<<EOF>[paths]>local=../local>[ui]>user=CelestinetheQueen>EOF$hginitother$cat>>other/.hg/hgrc<<EOF>[ui]>user=PrincessFlore>EOFThistutorialusesthefollowingconfigurationforMercurial:Acompactlogtemplatewithphasedata:$hgshowconfiguiui.slash=Trueui.logtemplate="{node|short} ({phase}): {desc}\n"Improvedgitformatdiff:$hgshowconfigdiffdiff.git=1Andofcourse,weenabletheexperimentalextensionsformutablehistory:$cat>>$HGRCPATH<<EOF>[extensions]>rebase=>evolve=$TESTDIR/../hgext/evolve.py>EOF-----------------------SingleDeveloperUsage-----------------------Thistutorialshowshowtouseevolutiontorewritehistorylocally.Fixingmistakewith`hgamend`--------------------------------Weareversionningashoppinglist$cdlocal$cat>>shopping<<EOF>Spam>Whizzobutter>Albatross>Rat(ratheralot)>Juggedfish>Blancmange>Salmonmousse>EOF$hgcommit-A-m"Monthy Python Shopping list"addingshoppingItsfirstversionissharedwiththeoutside.$hgpushremotepushingto$TESTTMP/remotesearchingforchangesaddingchangesetsaddingmanifestsaddingfilechangesadded1changesetswith1changesto1filesLaterIaddadditionalitemtomylist$cat>>shopping<<EOF>Egg>Suggar>Vinegar>Oil>EOF$hgcommit-m"adding condiment"$cat>>shopping<<EOF>Bananos>Pear>Apple>EOF$hgcommit-m"adding fruit"Thishistoryisverylinear$hglog-G@d85de4546133(draft):addingfruit|o4d5dc8187023(draft):addingcondiment|o7e82d3f3c2cb(public):MonthyPythonShoppinglistButatypowasmadeinBabanas!$hgexporttip # HG changeset patch # User test # Date 0 0 # Node ID d85de4546133030c82d257bbcdd9b1b416d0c31c # Parent 4d5dc81870237d492284826e21840b2ca00e26d1addingfruitdiff--gita/shoppingb/shopping---a/shopping+++b/shopping@@-9,3+9,6@@SuggarVinegarOil+Bananos+Pear+AppleThefaultychangesetisinthe"draft"phasebecauseithasnotbeenexchangedwiththeoutside.Thefirstonehasbeenexchangedandis"public"(immutable).$hglog-G@d85de4546133(draft):addingfruit|o4d5dc8187023(draft):addingcondiment|o7e82d3f3c2cb(public):MonthyPythonShoppinglisthopefully.Icanuse`hgcommit--amend`torewritemyfaultychangeset!$sed-i''-es/Bananos/Banana/shopping$hgdiffdiff--gita/shoppingb/shopping---a/shopping+++b/shopping@@-9,6+9,6@@SuggarVinegarOil-Bananos+BananaPearApple$hgcommit--amendAnewchangesetwiththerightdiffreplacethewrongone.$hglog-G@9d0363b81950(draft):addingfruit|o4d5dc8187023(draft):addingcondiment|o7e82d3f3c2cb(public):MonthyPythonShoppinglist$hgexporttip # HG changeset patch # User test # Date 0 0 # Node ID 9d0363b81950646bc6ad1ec5de8b8197ea586541 # Parent 4d5dc81870237d492284826e21840b2ca00e26d1addingfruitdiff--gita/shoppingb/shopping---a/shopping+++b/shopping@@-9,3+9,6@@SuggarVinegarOil+Banana+Pear+AppleGettingridofbranchyhistory----------------------------------WhileIwasworkingonmylist.someonehelpmadeachangeremotly.$cd../remote$hgup-q$sed-i''-e's/Spam/Spam Spam Spam/'shopping$hgci-m'SPAM'$cd../localI'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 'hgheads' to see heads, 'hgmerge' to merge)I now have a new heads. Note that this remote head is immutable $ hg log -G o 9ca060c80d74 (public): SPAM | | @ 9d0363b81950 (draft): adding fruit | | | o 4d5dc8187023 (draft): adding condiment |/ o 7e82d3f3c2cb (public): Monthy Python Shopping listinstead of merging my head with the new one. I'mgoingtorebasemywork$hgdiff$hgrebase-d9ca060c80d74-s4d5dc8187023mergingshoppingmergingshoppingMylocalworkisnowrebasedontheremoteone.$hglog-G@41aff6a42b75(draft):addingfruit|odfd3a2d7691e(draft):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistRemovingchangesets------------------------Iaddnewitemtomylist$cat>>shopping<<EOF>car>bus>plane>boat>EOF$hgci-m'transport'$hglog-G@1125e39fbf21(draft):transport|o41aff6a42b75(draft):addingfruit|odfd3a2d7691e(draft):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistIhaveanewcommitbutIrealizethatdon't want it. (transport shop list doesnot 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 41aff6a42b75The silly changeset is gone. $ hg log -G @ 41aff6a42b75 (draft): adding fruit | o dfd3a2d7691e (draft): adding condiment | o 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping listReordering changesets------------------------We create two changesets. $ cat >> shopping <<EOF>Shampoo>Toothbrush>...Morebathroomstufftocome>Towel>Soap>EOF$hgci-m'bathroom stuff'-q#XXXremovethe-q$sed-i''-e's/Spam/Spam Spam Spam/g'shopping$hgci-m'SPAM SPAM'$hglog-G@fac207dec9f5(draft):SPAMSPAM|o10b8aeaa8cc8(draft):bathroomstuff|o41aff6a42b75(draft):addingfruit|odfd3a2d7691e(draft):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglist..note:Wecan't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are immutable.I now want to push to remote all my changes except the bathroom one, which I'mnottotallyhappywithyet.Tobeabletopush"SPAM SPAM"Ineedaversionof"SPAM SPAM"whichisnotachildof"bathroom stuff"Youcanuse'rebase -r'or'graft -O'forthat:$hgup'p1(10b8aeaa8cc8)'#goingon"bathroom stuff"parent1filesupdated,0filesmerged,0filesremoved,0filesunresolved$hgrebase--revfac207dec9f5--dest.#moving"SPAM SPAM"totheworkingdirectoryparentmergingshopping$hglog-G@a224f2a4fb9f(draft):SPAMSPAM||o10b8aeaa8cc8(draft):bathroomstuff|/o41aff6a42b75(draft):addingfruit|odfd3a2d7691e(draft):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistWehaveanewSPAMSPAMversionwithoutthebathroomstuff$grepSpamshopping#enoughspamSpamSpamSpamSpamSpamSpamSpamSpamSpam$grepToothbrushshopping#noToothbrush[1]$hgexport. # HG changeset patch # User test # Date 0 0 # Node ID a224f2a4fb9f9f828f608959912229d7b38b26de # Parent 41aff6a42b7578ec7ec3cb2041633f1ca43cca96SPAMSPAMdiff--gita/shoppingb/shopping---a/shopping+++b/shopping@@-1,4+1,4@@-SpamSpamSpam+SpamSpamSpamSpamSpamSpamSpamSpamSpamWhizzobutterAlbatrossRat(ratheralot)TomakesureIdonotpushunreadychangesetbymistakeIsetthe"bathroomstuff"changesetinthesecretphase.$hgphase--force--secret10b8aeaa8cc8wecannowpushourchange:$hgpushremotepushingto$TESTTMP/remotesearchingforchangesaddingchangesetsaddingmanifestsaddingfilechangesadded3changesetswith3changesto1filesforsimplicityshakewegetthebathroomchangeinlineagain$hgrebase-r10b8aeaa8cc8-da224f2a4fb9fmergingshopping$hgphase--draft.$hglog-G@75954b8cd933(draft):bathroomstuff|oa224f2a4fb9f(public):SPAMSPAM|o41aff6a42b75(public):addingfruit|odfd3a2d7691e(public):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistSplittingchange------------------histeditoruncommitCollapsingchange------------------Thiscanbedonewithhgfoldbutthetutorialpartisnotwrittenyet.-----------------------Collaboration-----------------------sharingmutablechangeset----------------------------Tosharemutablechangesetwithothers,justcheckthattherepoyouinteractwithis"not publishing".Otherwiseyouwillgetthepreviouslyobservebehaviorwhereexchangedchangesetareautomaticallypublished.$cd../remote$hg-R../local/showconfigphasesthelocalrepodoesnothaveanyspecificconfigurationfor`phases.publish`.Itis``true``bydefault.$hgpulllocalpullingfrom$TESTTMP/localsearchingforchangesaddingchangesetsaddingmanifestsaddingfilechangesadded1changesetswith1changesto1files(run'hg update'togetaworkingcopy)$hglog-Go75954b8cd933(public):bathroomstuff|oa224f2a4fb9f(public):SPAMSPAM|o41aff6a42b75(public):addingfruit|odfd3a2d7691e(public):addingcondiment|@9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistWedonotwanttopublishthe"bathroom changeset".Let's rollback the last transaction $ hg rollback repository tip rolled back to revision 4 (undo pull) $ hg log -G o a224f2a4fb9f (public): SPAM SPAM | o 41aff6a42b75 (public): adding fruit | o dfd3a2d7691e (public): adding condiment | @ 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping listLet'smakethelocalrepo"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=falseI 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 'hgupdate' to get a working copy) $ hg log -G o 75954b8cd933 (draft): bathroom stuff | o a224f2a4fb9f (public): SPAM SPAM | o 41aff6a42b75 (public): adding fruit | o dfd3a2d7691e (public): adding condiment | @ 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping listRebasing unstable change after pull----------------------------------------------Remotely someone add a new changeset on top of the mutable "bathroom" on. $ hg up 75954b8cd933 -q $ cat >> shopping <<EOF>Giraffe>Rhino>Lion>Bear>EOF$hgci-m'animals'Butatthesametime,locally,thissame"bathroom changeset"wasupdated.$cd../local$hgup75954b8cd933-q$sed-i''-e's/... More bathroom stuff to come/Bath Robe/'shopping$hgcommit--amend$hglog-G@a44c85f957d3(draft):bathroomstuff|oa224f2a4fb9f(public):SPAMSPAM|o41aff6a42b75(public):addingfruit|odfd3a2d7691e(public):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistWhenwepullfromremoteagainwegetanunstablestate!$hgpullremotepullingfrom$TESTTMP/remotesearchingforchangesaddingchangesetsaddingmanifestsaddingfilechangesadded1changesetswith1changesto1files(+1heads)(run'hg heads'toseeheads,'hg merge'tomerge)1newunstablechangesetsThenewchangeset"animal"isbasedonanoldchangesetof"bathroom".Youcanseebothversionshowingupinthelog.$hglog-Gobf1b0d202029(draft):animals||@a44c85f957d3(draft):bathroomstuff||x|75954b8cd933(draft):bathroomstuff|/oa224f2a4fb9f(public):SPAMSPAM|o41aff6a42b75(public):addingfruit|odfd3a2d7691e(public):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistTheolderversion75954b8cd933neverceasedtoexistinthelocalrepo.Itwasjusthiddenandexcludedfrompullandpush...note::Inhgviewthereisanicedottedrelationhighlightinga44c85f957d3asanewversionof75954b8cd933.thisisnotyetportedto``hglog-G``.Thereisnowan**unstable**changesetinthishistory.Mercurialwillrefusetoshareitwiththeoutside:$hgpushotherpushingto$TESTTMP/othersearchingforchangesabort:pushincludesunstablechangeset:bf1b0d202029!(use'hg evolve'togetastablehistoryor--forcetoignorewarnings)[255]Toresolvethisunstablestate,youneedtorebasebf1b0d202029ontoa44c85f957d3.The"hg evolve"commandwilldothisforyou.Ithasa--dry-runoptiontoonlysuggestthenextmove.$hgevolve--dry-runmove:[15]animalsatop:[14]bathroomstuffhgrebase-rbf1b0d202029-da44c85f957d3Let's do it $ hg evolve move:[15] animals atop:[14] bathroom stuff merging shoppingThe old version of bathroom is hidden again. $ hg log -G @ ee942144f952 (draft): animals | o a44c85f957d3 (draft): bathroom stuff | o a224f2a4fb9f (public): SPAM SPAM | o 41aff6a42b75 (public): adding fruit | o dfd3a2d7691e (public): adding condiment | o 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping listWe 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 ee942144f952 1 files updated, 0 files merged, 0 files removed, 0 files unresolvedRelocating unstable change after prune----------------------------------------------The remote guy keep working $ sed -i'' -e 's/Spam/SpamSpamSpamSpam/g' shopping $ hg commit -m "SPAM SPAM SPAM"I'mpullingitsworklocally.$cd../local$hgpullremotepullingfrom$TESTTMP/remotesearchingforchangesaddingchangesetsaddingmanifestsaddingfilechangesadded1changesetswith1changesto1files(run'hg update'togetaworkingcopy)$hglog-Go99f039c5ec9e(draft):SPAMSPAMSPAM|@ee942144f952(draft):animals|oa44c85f957d3(draft):bathroomstuff|oa224f2a4fb9f(public):SPAMSPAM|o41aff6a42b75(public):addingfruit|odfd3a2d7691e(public):addingcondiment|o9ca060c80d74(public):SPAM|o7e82d3f3c2cb(public):MonthyPythonShoppinglistInthemeantimeInoticedyoucan't buy animals in a super market and I prune the animal changeset: $ hg prune ee942144f952 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory now at a44c85f957d3 1 new unstable changesetsThe animals changeset is still displayed because the "SPAM SPAM SPAM" changesetis neither dead or obsolete. My repository is in an unstable state again. $ hg log -G o 99f039c5ec9e (draft): SPAM SPAM SPAM | x ee942144f952 (draft): animals | @ a44c85f957d3 (draft): bathroom stuff | o a224f2a4fb9f (public): SPAM SPAM | o 41aff6a42b75 (public): adding fruit | o dfd3a2d7691e (public): adding condiment | o 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping list $ hg log -r 'unstable()' 99f039c5ec9e (draft): SPAM SPAM SPAM $ hg evolve move:[17] SPAM SPAM SPAM atop:[14] bathroom stuff merging shopping $ hg log -G @ 40aa40daeefb (draft): SPAM SPAM SPAM | o a44c85f957d3 (draft): bathroom stuff | o a224f2a4fb9f (public): SPAM SPAM | o 41aff6a42b75 (public): adding fruit | o dfd3a2d7691e (public): adding condiment | o 9ca060c80d74 (public): SPAM | o 7e82d3f3c2cb (public): Monthy Python Shopping listHandling Conflicting amend----------------------------------------------We can detect that multiple diverging/conflicting amendments have been made. Therewill be a "evol-merge" command to merge conflicting amendments.This section needs to be written.