# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1528478573 -19800 # Node ID f8677cb11dcbcb167969a23fcd47b928887afca2 # Parent 5ca297e78f2cca497e2f516d051deb0bcf5dc7b4# Parent 2c4975390d83e225c46012c73b5a64ff7b7fb8db test-compat: merge mercurial-4.4 into mercurial-4.3 diff -r 2c4975390d83 -r f8677cb11dcb CHANGELOG --- a/CHANGELOG Wed Apr 25 14:09:36 2018 +0100 +++ b/CHANGELOG Fri Jun 08 22:52:53 2018 +0530 @@ -1,6 +1,14 @@ Changelog ========= +8.0.1 -- in-progress +--------------------- + + * next-prev: respect commands.update.check config option (issue5808) + * next-prev: fix `evolve --abort` on conflicts (issue5897) + * obslog: fix breakage when commit has no description + * amend: use context manager for locks (issue5887) + 8.0.0 -- 2018-04-25 ------------------- diff -r 2c4975390d83 -r f8677cb11dcb README --- a/README Wed Apr 25 14:09:36 2018 +0100 +++ b/README Fri Jun 08 22:52:53 2018 +0530 @@ -83,17 +83,25 @@ How to Contribute ================= +Discussion happens on the #hg-evolve IRC on freenode_. + +.. _freenode: https://freenode.net/ + Bugs are to be reported on the mercurial's bug tracker (component: `evolution`_): .. _evolution: https://bz.mercurial-scm.org/buglist.cgi?component=evolution&query_format=advanced&resolution=--- -Please use the patchbomb extension to send email to `mercurial devel +You can use the patchbomb extension to send email to `mercurial devel `_. Please make sure to use the evolve-ext flag when doing so. You can use a command like this:: $ hg email --to mercurial-devel@mercurial-scm.org --flag evolve-ext --rev '' +Some of development happens on a public bitbucket repository (`evolve-devel`_) using the topic extension. + +.. _`evolve-devel`: https://bitbucket.org/octobus/evolve-devel + For guidelines on the patch description, see the `official Mercurial guideline`_. .. _`official Mercurial guideline`: https://mercurial-scm.org/wiki/ContributingChanges#Patch_descriptions diff -r 2c4975390d83 -r f8677cb11dcb debian/rules --- a/debian/rules Wed Apr 25 14:09:36 2018 +0100 +++ b/debian/rules Fri Jun 08 22:52:53 2018 +0530 @@ -30,3 +30,4 @@ rm -rf html rm -f docs/static/logo-evolve.ico rm -f docs/tutorials/tutorial.rst + rm -f docs/tutorials/topic-tutorial.rst diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/__init__.py Fri Jun 08 22:52:53 2018 +0530 @@ -966,14 +966,25 @@ def _getcurrenttopic(repo): return getattr(repo, 'currenttopic', '') -def _prevupdate(repo, displayer, target, bookmark, dryrun): +def _prevupdate(repo, displayer, target, bookmark, dryrun, mergeopt): if dryrun: repo.ui.write(_('hg update %s;\n') % target) if bookmark is not None: repo.ui.write(_('hg bookmark %s -r %s;\n') % (bookmark, target)) else: - ret = hg.update(repo, target.rev()) + updatecheck = None + # --merge is passed, we don't need to care about commands.update.check + # config option + if mergeopt: + updatecheck = 'none' + try: + ret = hg.updatetotally(repo.ui, repo, target.node(), None, + updatecheck=updatecheck) + except error.Abort as exc: + # replace the hint to mention about --merge option + exc.hint = _('do you want --merge?') + raise if not ret: tr = lock = None try: @@ -1042,6 +1053,7 @@ Displays the summary line of the destination for clarity.""" wlock = None dryrunopt = opts['dry_run'] + mergeopt = opts['merge'] if not dryrunopt: wlock = repo.wlock() try: @@ -1049,12 +1061,16 @@ wparents = wkctx.parents() if len(wparents) != 1: raise error.Abort(_('merge in progress')) - if not opts['merge']: - try: - cmdutil.bailifchanged(repo) - except error.Abort as exc: - exc.hint = _('do you want --merge?') - raise + if not mergeopt: + # we only skip the check if noconflict is set + if ui.config('commands', 'update.check') == 'noconflict': + pass + else: + try: + cmdutil.bailifchanged(repo) + except error.Abort as exc: + exc.hint = _('do you want --merge?') + raise displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate}) @@ -1068,7 +1084,8 @@ if topic and _getcurrenttopic(repo) != _gettopic(target): repo.ui.setconfig('_internal', 'keep-topic', 'yes', source='topic-extension') - _prevupdate(repo, displayer, target, bookmark, dryrunopt) + _prevupdate(repo, displayer, target, bookmark, dryrunopt, + mergeopt) finally: repo.ui.restoreconfig(backup) return 0 @@ -1103,12 +1120,21 @@ wparents = wkctx.parents() if len(wparents) != 1: raise error.Abort(_('merge in progress')) + + # check for dirty wdir if --evolve is passed + if opts['evolve']: + cmdutil.bailifchanged(repo) + if not opts['merge']: - try: - cmdutil.bailifchanged(repo) - except error.Abort as exc: - exc.hint = _('do you want --merge?') - raise + # we only skip the check if noconflict is set + if ui.config('commands', 'update.check') == 'noconflict': + pass + else: + try: + cmdutil.bailifchanged(repo) + except error.Abort as exc: + exc.hint = _('do you want --merge?') + raise children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()] topic = _getcurrenttopic(repo) @@ -1195,7 +1221,19 @@ if shouldmove: ui.write(_('hg bookmark %s -r %s;\n') % (bm, children)) else: - ret = hg.update(repo, children) + updatecheck = None + # --merge is passed, we don't need to care about commands.update.check + # config option + if opts['merge']: + updatecheck = 'none' + try: + ret = hg.updatetotally(ui, repo, children.node(), None, + updatecheck=updatecheck) + except error.Abort as exc: + # replace the hint to mention about --merge option + exc.hint = _('do you want --merge?') + raise + if not ret: lock = tr = None try: @@ -1352,7 +1390,7 @@ @eh.uisetup def setupevolveunfinished(ui): data = ('evolvestate', False, False, _('evolve in progress'), - _("use 'hg evolve --continue' or 'hg update -C .' to abort")) + _("use 'hg evolve --continue' or 'hg evolve --abort' to abort")) cmdutil.unfinishedstates.append(data) afterresolved = ('evolvestate', _('hg evolve --continue')) diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/cmdrewrite.py Fri Jun 08 22:52:53 2018 +0530 @@ -140,15 +140,11 @@ opts['amend'] = True _resolveoptions(ui, opts) _alias, commitcmd = cmdutil.findcmd('commit', commands.table) - try: - wlock = repo.wlock() - lock = repo.lock() + with repo.wlock(), repo.lock(): if not (edit or opts['message'] or log): opts['message'] = repo['.'].description() rewriteutil.precheck(repo, [repo['.'].rev()], action='amend') return commitcmd[0](ui, repo, *pats, **opts) - finally: - lockmod.release(lock, wlock) def amendpatch(ui, repo, *pats, **opts): """logic for --patch flag of `hg amend` command.""" @@ -1083,7 +1079,7 @@ bookmarksmod.deactivate(repo) bmchanges = [(bookactive, newnode.node())] repo._bookmarks.applychanges(repo, tr, bmchanges) - commands.update(ui, repo, newnode.rev()) + commands.update(ui, repo, newnode.hex()) ui.status(_('working directory now at %s\n') % ui.label(str(newnode), 'evolve.node')) if movebookmark: diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/compat.py Fri Jun 08 22:52:53 2018 +0530 @@ -13,7 +13,9 @@ mdiff, obsolete, obsutil, + repair, revset, + scmutil, util, vfs as vfsmod, ) @@ -195,6 +197,14 @@ except (ImportError, AttributeError): updateresult = None +# 46c2b19a1263f18a5829a21b7a5053019b0c5a31 in hg moved repair.stripbmrevset to +# scmutil.bookmarkrevs +# This change is a part of 4.7 cycle, so drop this when we drop support for 4.6 +try: + bmrevset = repair.stripbmrevset +except AttributeError: + bmrevset = scmutil.bookmarkrevs + def hasconflict(upres): if updateresult is None: return bool(upres[-1]) diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/evolvecmd.py Fri Jun 08 22:52:53 2018 +0530 @@ -1231,6 +1231,14 @@ if not evolvestate: raise error.Abort(_('no interrupted evolve to stop')) evolvestate.load() + # `hg next --evolve` in play + if evolvestate['command'] != 'evolve': + pctx = repo['.'] + hg.updaterepo(repo, pctx.node(), True) + ui.status(_('evolve aborted\n')) + ui.status(_('working directory is now at %s\n') + % pctx.hex()[:12]) + return 0 return abortevolve(ui, repo, evolvestate) else: cmdutil.bailifchanged(repo) diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/metadata.py --- a/hgext3rd/evolve/metadata.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/metadata.py Fri Jun 08 22:52:53 2018 +0530 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -__version__ = '8.0.0' +__version__ = '8.0.1.dev' testedwith = '4.3.2 4.4.2 4.5.2 4.6' minimumhgversion = '4.3' buglink = 'https://bz.mercurial-scm.org/' diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/obshistory.py Fri Jun 08 22:52:53 2018 +0530 @@ -285,7 +285,7 @@ changectx = missingchangectx(repo, cand) childrens = [(graphmod.PARENT, x) for x in nodeprec.get(cand, ())] - yield (cand, 'M', changectx, childrens) + yield (cand, graphmod.CHANGESET, changectx, childrens) def _obshistorywalker_links(repo, revs, walksuccessors=False): """ Iterate the obs history tree starting from revs, traversing @@ -391,7 +391,9 @@ _debugobshistorydisplaymissingctx(fm, node) def _debugobshistorydisplayctx(fm, ctx): - shortdescription = ctx.description().splitlines()[0] + shortdescription = ctx.description().strip() + if shortdescription: + shortdescription = shortdescription.splitlines()[0] fm.startitem() fm.write('node', '%s', str(ctx), diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/rewriteutil.py --- a/hgext3rd/evolve/rewriteutil.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/rewriteutil.py Fri Jun 08 22:52:53 2018 +0530 @@ -22,7 +22,6 @@ node, obsolete, phases, - repair, revset, util, ) @@ -136,7 +135,7 @@ """prepare the working directory for a split (for topic hooking) """ hg.update(repo, prev) - commands.revert(ui, repo, rev=ctx.rev(), all=True) + commands.revert(ui, repo, rev=ctx.hex(), all=True) def reachablefrombookmark(repo, revs, bookmarks): """filter revisions and bookmarks reachable from the given bookmark @@ -155,7 +154,7 @@ nodetobookmarks.setdefault(bnode, []).append(mark) for marks in nodetobookmarks.values(): if bookmarks.issuperset(marks): - rsrevs = repair.stripbmrevset(repo, marks[0]) + rsrevs = compat.bmrevset(repo, marks[0]) revs = set(revs) revs.update(set(rsrevs)) revs = sorted(revs) diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/evolve/utility.py --- a/hgext3rd/evolve/utility.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/evolve/utility.py Fri Jun 08 22:52:53 2018 +0530 @@ -152,7 +152,7 @@ # ui.interactive is not set, fallback to default behavior and avoid showing # the prompt - if not ui.configbool('ui', 'interactive'): + if not ui.interactive(): return None promptmsg = customheader + "\n" diff -r 2c4975390d83 -r f8677cb11dcb hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Apr 25 14:09:36 2018 +0100 +++ b/hgext3rd/topic/__init__.py Fri Jun 08 22:52:53 2018 +0530 @@ -70,6 +70,8 @@ The extensions come with an option to enforce that there is only one heads for each name in the repository at any time. +:: + [experimental] enforce-single-head = yes @@ -80,15 +82,18 @@ phase usually happens on push, but it is possible to update that behavior. The server needs to have specific config for this. - # everything pushed become public (the default) +* everything pushed become public (the default):: + [phase] publish = yes - # nothing push turned public +* nothing push turned public:: + [phase] publish = no - # topic branches are not published, changeset without topic are +* topic branches are not published, changeset without topic are:: + [phase] publish = no [experimental] @@ -176,7 +181,7 @@ 'topic.active': 'green', } -__version__ = '0.9.0' +__version__ = '0.9.1.dev' testedwith = '4.3.3 4.4.2 4.5.2 4.6' minimumhgversion = '4.3' diff -r 2c4975390d83 -r f8677cb11dcb tests/test-evolve-abort.t --- a/tests/test-evolve-abort.t Wed Apr 25 14:09:36 2018 +0100 +++ b/tests/test-evolve-abort.t Fri Jun 08 22:52:53 2018 +0530 @@ -492,3 +492,24 @@ |/ () draft o 0:8fa14d15e168 added hgignore () draft + +Testing `--abort` when conflicts are caused due to `hg next --evolve` +===================================================================== + + $ hg next --evolve + move:[2] added b + atop:[5] added a + working directory now at c1f4718020e3 + $ hg next --evolve + move:[3] added c + atop:[6] added b + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ hg evolve --abort + evolve aborted + working directory is now at c1f4718020e3 diff -r 2c4975390d83 -r f8677cb11dcb tests/test-evolve-obshistory.t --- a/tests/test-evolve-obshistory.t Wed Apr 25 14:09:36 2018 +0100 +++ b/tests/test-evolve-obshistory.t Fri Jun 08 22:52:53 2018 +0530 @@ -16,6 +16,23 @@ > evolution.effect-flags = yes > EOF +Test simple common cases +======================== + +Test setup +---------- + $ hg init $TESTTMP/simple + $ cd $TESTTMP/simple + +Actual test +----------- + $ hg obslog -ap null + @ 000000000000 (-1) + + $ hg obslog 'wdir()' + abort: working directory revision cannot be specified + [255] + Test output on amended commit ============================= diff -r 2c4975390d83 -r f8677cb11dcb tests/test-evolve-stop-orphan.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-evolve-stop-orphan.t Fri Jun 08 22:52:53 2018 +0530 @@ -0,0 +1,384 @@ +Tests for the --stop flag for `hg evolve` command while resolving orphans +========================================================================= + +The `--stop` flag stops the interrupted evolution and delete the state file so +user can do other things and comeback and do evolution later on + +This is testing cases when `hg evolve` command is doing orphan resolution. + +Setup +===== + + $ cat >> $HGRCPATH < [alias] + > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}" + > [extensions] + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH + + $ hg init stoprepo + $ cd stoprepo + $ echo ".*\.orig" > .hgignore + $ hg add .hgignore + $ hg ci -m "added hgignore" + $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done; + + $ hg glog + @ 4:c41c793e0ef1 added d + | () draft + o 3:ca1b80f7960a added c + | () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + +Testing `--stop` when no evolve is interrupted +============================================== + + $ hg evolve --stop + abort: no interrupted evolve to stop + [255] + +Testing with wrong combinations of flags +======================================== + + $ hg evolve --stop --rev 1 + abort: cannot specify both "--rev" and "--stop" + [255] + + $ hg evolve --stop --continue + abort: cannot specify both "--stop" and "--continue" + [255] + + $ hg evolve --stop --all + abort: cannot specify both "--all" and "--stop" + [255] + + $ hg evolve --stop --any + abort: cannot specify both "--any" and "--stop" + [255] + +Testing when only one revision is to evolve +=========================================== + + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [3] added c + $ echo bar > d + $ hg add d + $ hg amend + 1 new unstable changesets + $ hg glog + @ 6:cb6a2ab625bb added c + | () draft + | o 4:c41c793e0ef1 added d + | | () draft + | x 3:ca1b80f7960a added c + |/ () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve + move:[4] added d + atop:[6] added c + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ hg evolve --stop + stopped the interrupted evolve + working directory is now at cb6a2ab625bb + +Checking whether evolvestate file exists or not + $ cat .hg/evolvestate + cat: .hg/evolvestate: No such file or directory + [1] + +Checking where we are + $ hg id + cb6a2ab625bb tip + +Checking working dir + $ hg status +Checking for incomplete mergestate + $ ls .hg/merge + ls: cannot access .?\.hg/merge.?: No such file or directory (re) + [2] + +Checking graph + $ hg glog + @ 6:cb6a2ab625bb added c + | () draft + | o 4:c41c793e0ef1 added d + | | () draft + | x 3:ca1b80f7960a added c + |/ () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + +Testing the stop flag in case conflicts are caused by `hg next --evolve` +======================================================================== + + $ hg next --evolve + move:[4] added d + atop:[6] added c + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ hg diff + diff -r cb6a2ab625bb d + --- a/d Thu Jan 01 00:00:00 1970 +0000 + +++ b/d Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,5 @@ + +<<<<<<< destination: cb6a2ab625bb - test: added c + bar + +======= + +foo + +>>>>>>> evolving: c41c793e0ef1 - test: added d + + $ hg evolve --stop + stopped the interrupted evolve + working directory is now at cb6a2ab625bb + + $ hg glog + @ 6:cb6a2ab625bb added c + | () draft + | o 4:c41c793e0ef1 added d + | | () draft + | x 3:ca1b80f7960a added c + |/ () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg status + +Checking when multiple revs need to be evolved, some revs evolve without +conflicts +========================================================================= + +Making sure obsmarkers should be on evolved changeset and not rest of them once +we do `evolve --stop` +-------------------------------------------------------------------------------- + + $ hg evolve + move:[4] added d + atop:[6] added c + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + $ echo foo > d + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve --continue + evolving 4:c41c793e0ef1 "added d" + working directory is now at 2a4e03d422e2 + $ hg glog + @ 7:2a4e03d422e2 added d + | () draft + o 6:cb6a2ab625bb added c + | () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg up .^^^^ + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ echo bar > c + $ hg add c + $ hg amend + 4 new unstable changesets + + $ hg glog + @ 9:21817cd42526 added hgignore + () draft + o 7:2a4e03d422e2 added d + | () draft + o 6:cb6a2ab625bb added c + | () draft + o 2:b1661037fa25 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + x 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[1] added a + atop:[9] added hgignore + move:[2] added b + atop:[10] added a + move:[6] added c + atop:[11] added b + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ hg status + M c + A d + + $ hg evolve --stop + stopped the interrupted evolve + working directory is now at aec285328e90 + +Only changeset which has a successor now are obsoleted + $ hg glog + @ 11:aec285328e90 added b + | () draft + o 10:fd00db71edca added a + | () draft + o 9:21817cd42526 added hgignore + () draft + o 7:2a4e03d422e2 added d + | () draft + o 6:cb6a2ab625bb added c + | () draft + x 2:b1661037fa25 added b + | () draft + x 1:c7586e2a9264 added a + | () draft + x 0:8fa14d15e168 added hgignore + () draft + +Making sure doing evolve again resumes from right place and does the right thing + + $ hg evolve --all + move:[6] added c + atop:[11] added b + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ echo foobar > c + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve --continue + evolving 6:cb6a2ab625bb "added c" + move:[7] added d + atop:[12] added c + working directory is now at cd0909a30222 + $ hg glog + @ 13:cd0909a30222 added d + | () draft + o 12:cb1dd1086ef6 added c + | () draft + o 11:aec285328e90 added b + | () draft + o 10:fd00db71edca added a + | () draft + o 9:21817cd42526 added hgignore + () draft + +Bookmarks should only be moved of the changesets which have been evolved, +bookmarks of rest of them should stay where they are are +------------------------------------------------------------------------- + + $ hg up .^ + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg bookmark b1 + $ hg up .^ + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + (leaving bookmark b1) + $ hg bookmark b2 + + $ hg glog + o 13:cd0909a30222 added d + | () draft + o 12:cb1dd1086ef6 added c + | (b1) draft + @ 11:aec285328e90 added b + | (b2) draft + o 10:fd00db71edca added a + | () draft + o 9:21817cd42526 added hgignore + () draft + + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [10] added a + $ echo tom > c + $ hg amend + 3 new unstable changesets + + $ hg glog + @ 15:a3cc2042492f added a + | () draft + | o 13:cd0909a30222 added d + | | () draft + | o 12:cb1dd1086ef6 added c + | | (b1) draft + | o 11:aec285328e90 added b + | | (b2) draft + | x 10:fd00db71edca added a + |/ () draft + o 9:21817cd42526 added hgignore + () draft + + $ hg evolve --all + move:[11] added b + atop:[15] added a + move:[12] added c + atop:[16] added b + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ hg evolve --stop + stopped the interrupted evolve + working directory is now at a3f4b95da934 + +Bookmarks of only the changeset which are evolved is moved + $ hg glog + @ 16:a3f4b95da934 added b + | (b2) draft + o 15:a3cc2042492f added a + | () draft + | o 13:cd0909a30222 added d + | | () draft + | o 12:cb1dd1086ef6 added c + | | (b1) draft + | x 11:aec285328e90 added b + | | () draft + | x 10:fd00db71edca added a + |/ () draft + o 9:21817cd42526 added hgignore + () draft diff -r 2c4975390d83 -r f8677cb11dcb tests/test-evolve-stop.t --- a/tests/test-evolve-stop.t Wed Apr 25 14:09:36 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -Tests for the --stop flag for `hg evolve` command -================================================= - -The `--stop` flag stops the interrupted evolution and delete the state file so -user can do other things and comeback and do evolution later on - -Setup -===== - - $ cat >> $HGRCPATH < [alias] - > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}" - > [extensions] - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH - - $ hg init stoprepo - $ cd stoprepo - $ echo ".*\.orig" > .hgignore - $ hg add .hgignore - $ hg ci -m "added hgignore" - $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done; - - $ hg glog - @ 4:c41c793e0ef1 added d - | () draft - o 3:ca1b80f7960a added c - | () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - o 0:8fa14d15e168 added hgignore - () draft - -Testing `--stop` when no evolve is interrupted -============================================== - - $ hg evolve --stop - abort: no interrupted evolve to stop - [255] - -Testing with wrong combinations of flags -======================================== - - $ hg evolve --stop --rev 1 - abort: cannot specify both "--rev" and "--stop" - [255] - - $ hg evolve --stop --continue - abort: cannot specify both "--stop" and "--continue" - [255] - - $ hg evolve --stop --all - abort: cannot specify both "--all" and "--stop" - [255] - - $ hg evolve --stop --any - abort: cannot specify both "--any" and "--stop" - [255] - -Testing when only one revision is to evolve -=========================================== - - $ hg prev - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - [3] added c - $ echo bar > d - $ hg add d - $ hg amend - 1 new unstable changesets - $ hg glog - @ 6:cb6a2ab625bb added c - | () draft - | o 4:c41c793e0ef1 added d - | | () draft - | x 3:ca1b80f7960a added c - |/ () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - o 0:8fa14d15e168 added hgignore - () draft - - $ hg evolve - move:[4] added d - atop:[6] added c - merging d - warning: conflicts while merging d! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - - $ hg evolve --stop - stopped the interrupted evolve - working directory is now at cb6a2ab625bb - -Checking whether evolvestate file exists or not - $ cat .hg/evolvestate - cat: .hg/evolvestate: No such file or directory - [1] - -Checking where we are - $ hg id - cb6a2ab625bb tip - -Checking working dir - $ hg status -Checking for incomplete mergestate - $ ls .hg/merge - ls: cannot access .?\.hg/merge.?: No such file or directory (re) - [2] - -Checking graph - $ hg glog - @ 6:cb6a2ab625bb added c - | () draft - | o 4:c41c793e0ef1 added d - | | () draft - | x 3:ca1b80f7960a added c - |/ () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - o 0:8fa14d15e168 added hgignore - () draft - -Testing the stop flag in case conflicts are caused by `hg next --evolve` -======================================================================== - - $ hg next --evolve - move:[4] added d - atop:[6] added c - merging d - warning: conflicts while merging d! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - - $ hg diff - diff -r cb6a2ab625bb d - --- a/d Thu Jan 01 00:00:00 1970 +0000 - +++ b/d Thu Jan 01 00:00:00 1970 +0000 - @@ -1,1 +1,5 @@ - +<<<<<<< destination: cb6a2ab625bb - test: added c - bar - +======= - +foo - +>>>>>>> evolving: c41c793e0ef1 - test: added d - - $ hg evolve --stop - stopped the interrupted evolve - working directory is now at cb6a2ab625bb - - $ hg glog - @ 6:cb6a2ab625bb added c - | () draft - | o 4:c41c793e0ef1 added d - | | () draft - | x 3:ca1b80f7960a added c - |/ () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - o 0:8fa14d15e168 added hgignore - () draft - - $ hg status - -Checking when multiple revs need to be evolved, some revs evolve without -conflicts -========================================================================= - -Making sure obsmarkers should be on evolved changeset and not rest of them once -we do `evolve --stop` --------------------------------------------------------------------------------- - - $ hg evolve - move:[4] added d - atop:[6] added c - merging d - warning: conflicts while merging d! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - $ echo foo > d - $ hg resolve -m - (no more unresolved files) - continue: hg evolve --continue - $ hg evolve --continue - evolving 4:c41c793e0ef1 "added d" - working directory is now at 2a4e03d422e2 - $ hg glog - @ 7:2a4e03d422e2 added d - | () draft - o 6:cb6a2ab625bb added c - | () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - o 0:8fa14d15e168 added hgignore - () draft - - $ hg up .^^^^ - 0 files updated, 0 files merged, 4 files removed, 0 files unresolved - $ echo bar > c - $ hg add c - $ hg amend - 4 new unstable changesets - - $ hg glog - @ 9:21817cd42526 added hgignore - () draft - o 7:2a4e03d422e2 added d - | () draft - o 6:cb6a2ab625bb added c - | () draft - o 2:b1661037fa25 added b - | () draft - o 1:c7586e2a9264 added a - | () draft - x 0:8fa14d15e168 added hgignore - () draft - - $ hg evolve --all - move:[1] added a - atop:[9] added hgignore - move:[2] added b - atop:[10] added a - move:[6] added c - atop:[11] added b - merging c - warning: conflicts while merging c! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - - $ hg status - M c - A d - - $ hg evolve --stop - stopped the interrupted evolve - working directory is now at aec285328e90 - -Only changeset which has a successor now are obsoleted - $ hg glog - @ 11:aec285328e90 added b - | () draft - o 10:fd00db71edca added a - | () draft - o 9:21817cd42526 added hgignore - () draft - o 7:2a4e03d422e2 added d - | () draft - o 6:cb6a2ab625bb added c - | () draft - x 2:b1661037fa25 added b - | () draft - x 1:c7586e2a9264 added a - | () draft - x 0:8fa14d15e168 added hgignore - () draft - -Making sure doing evolve again resumes from right place and does the right thing - - $ hg evolve --all - move:[6] added c - atop:[11] added b - merging c - warning: conflicts while merging c! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - - $ echo foobar > c - $ hg resolve -m - (no more unresolved files) - continue: hg evolve --continue - $ hg evolve --continue - evolving 6:cb6a2ab625bb "added c" - move:[7] added d - atop:[12] added c - working directory is now at cd0909a30222 - $ hg glog - @ 13:cd0909a30222 added d - | () draft - o 12:cb1dd1086ef6 added c - | () draft - o 11:aec285328e90 added b - | () draft - o 10:fd00db71edca added a - | () draft - o 9:21817cd42526 added hgignore - () draft - -Bookmarks should only be moved of the changesets which have been evolved, -bookmarks of rest of them should stay where they are are -------------------------------------------------------------------------- - - $ hg up .^ - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg bookmark b1 - $ hg up .^ - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - (leaving bookmark b1) - $ hg bookmark b2 - - $ hg glog - o 13:cd0909a30222 added d - | () draft - o 12:cb1dd1086ef6 added c - | (b1) draft - @ 11:aec285328e90 added b - | (b2) draft - o 10:fd00db71edca added a - | () draft - o 9:21817cd42526 added hgignore - () draft - - $ hg prev - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - [10] added a - $ echo tom > c - $ hg amend - 3 new unstable changesets - - $ hg glog - @ 15:a3cc2042492f added a - | () draft - | o 13:cd0909a30222 added d - | | () draft - | o 12:cb1dd1086ef6 added c - | | (b1) draft - | o 11:aec285328e90 added b - | | (b2) draft - | x 10:fd00db71edca added a - |/ () draft - o 9:21817cd42526 added hgignore - () draft - - $ hg evolve --all - move:[11] added b - atop:[15] added a - move:[12] added c - atop:[16] added b - merging c - warning: conflicts while merging c! (edit, then use 'hg resolve --mark') - evolve failed! - fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort - abort: unresolved merge conflicts (see hg help resolve) - [255] - - $ hg evolve --stop - stopped the interrupted evolve - working directory is now at a3f4b95da934 - -Bookmarks of only the changeset which are evolved is moved - $ hg glog - @ 16:a3f4b95da934 added b - | (b2) draft - o 15:a3cc2042492f added a - | () draft - | o 13:cd0909a30222 added d - | | () draft - | o 12:cb1dd1086ef6 added c - | | (b1) draft - | x 11:aec285328e90 added b - | | () draft - | x 10:fd00db71edca added a - |/ () draft - o 9:21817cd42526 added hgignore - () draft diff -r 2c4975390d83 -r f8677cb11dcb tests/test-prev-next.t --- a/tests/test-prev-next.t Wed Apr 25 14:09:36 2018 +0100 +++ b/tests/test-prev-next.t Fri Jun 08 22:52:53 2018 +0530 @@ -354,3 +354,25 @@ atop:[3] one working directory now at a7d885c75614 $ wait + +testing next --evolve when working directory is dirty + + $ hg log -GT "{rev}:{node|short} {desc|firstline}" + @ 4:a7d885c75614 two + | + o 3:c741983992fc one + + + $ hg up .^ + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ echo foobar > bar + $ hg add bar + $ hg amend + 1 new unstable changesets + + $ echo babar > bar + + $ hg next --evolve + abort: uncommitted changes + [255] diff -r 2c4975390d83 -r f8677cb11dcb tests/test-topic.t --- a/tests/test-topic.t Wed Apr 25 14:09:36 2018 +0100 +++ b/tests/test-topic.t Fri Jun 08 22:52:53 2018 +0530 @@ -12,6 +12,114 @@ > graphstyle.missing = | > EOF + $ hg help -e topic + topic extension - support for topic branches + + Topic branches are lightweight branches which disappear when changes are + finalized (move to the public phase). + + Compared to bookmark, topic is reference carried by each changesets of the + series instead of just the single head revision. Topic are quite similar to + the way named branch work, except they eventually fade away when the changeset + becomes part of the immutable history. Changeset can belong to both a topic + and a named branch, but as long as it is mutable, its topic identity will + prevail. As a result, default destination for 'update', 'merge', etc... will + take topic into account. When a topic is active these operations will only + consider other changesets on that topic (and, in some occurrence, bare + changeset on same branch). When no topic is active, changeset with topic will + be ignored and only bare one on the same branch will be taken in account. + + There is currently two commands to be used with that extension: 'topics' and + 'stack'. + + The 'hg topics' command is used to set the current topic, change and list + existing one. 'hg topics --verbose' will list various information related to + each topic. + + The 'stack' will show you information about the stack of commit belonging to + your current topic. + + Topic is offering you aliases reference to changeset in your current topic + stack as 't#'. For example, 't1' refers to the root of your stack, 't2' to the + second commits, etc. The 'hg stack' command show these number. + + Push behavior will change a bit with topic. When pushing to a publishing + repository the changesets will turn public and the topic data on them will + fade away. The logic regarding pushing new heads will behave has before, + ignore any topic related data. When pushing to a non-publishing repository + (supporting topic), the head checking will be done taking topic data into + account. Push will complain about multiple heads on a branch if you push + multiple heads with no topic information on them (or multiple public heads). + But pushing a new topic will not requires any specific flag. However, pushing + multiple heads on a topic will be met with the usual warning. + + The 'evolve' extension takes 'topic' into account. 'hg evolve --all' will + evolve all changesets in the active topic. In addition, by default. 'hg next' + and 'hg prev' will stick to the current topic. + + Be aware that this extension is still an experiment, commands and other + features are likely to be change/adjusted/dropped over time as we refine the + concept. + + topic-mode + ========== + + The topic extension can be configured to ensure the user do not forget to add + a topic when committing a new topic: + + [experimental] + # behavior when commit is made without an active topic + topic-mode = ignore # do nothing special (default) + topic-mode = warning # print a warning + topic-mode = enforce # abort the commit (except for merge) + topic-mode = enforce-all # abort the commit (even for merge) + topic-mode = random # use a randomized generated topic (except for merge) + topic-mode = random-all # use a randomized generated topic (even for merge) + + Single head enforcing + ===================== + + The extensions come with an option to enforce that there is only one heads for + each name in the repository at any time. + + [experimental] + enforce-single-head = yes + + Publishing behavior + =================== + + Topic vanish when changeset move to the public phases. Moving to the public + phase usually happens on push, but it is possible to update that behavior. The + server needs to have specific config for this. + + * everything pushed become public (the default): + + [phase] + publish = yes + + * nothing push turned public: + + [phase] + publish = no + + * topic branches are not published, changeset without topic are: + + [phase] + publish = no + [experimental] + topic.publish-bare-branch = yes + + In addition, the topic extension adds a "--publish" flag on 'hg push'. When + used, the pushed revisions are published if the push succeeds. It also applies + to common revisions selected by the push. + + list of commands: + + stack list all changesets in a topic and other information + topics View current topic, set current topic, change topic for a set + of revisions, or see all topics. + + (use 'hg help -v topic' to show built-in aliases and global options) $ hg help topics hg topics [TOPIC]