Mercurial > hg > evolve
changeset 1545:9be1cadf7a07
next: add a --evolve option
When on a topological head, this option will trigger the evolution of a unstable
changeset that will result in a children of the current working copy parent.
This should ease stacked changesets workflow by allowing to stick to prev and
next to move through a stack of diff, evolving part of it on demand when needed.
In case of ambiguity, the command will ask the user to choose. We need a better
definition of "the stack of changesets I'm working on" to be able to seamlessly
handling branching.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 24 Jun 2015 20:06:45 -0700 |
parents | 3c113c097339 |
children | 5f6e78aea094 8ca31deb8db7 |
files | README hgext/evolve.py tests/test-prev-next.t |
diffstat | 3 files changed, 39 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/README +++ b/README @@ -68,6 +68,7 @@ enabling - next/prev: requires `--merge` to move with uncommited changes - next: significantly reword error messages +- next: add a --evolve flag to evolve aspiring children when on a head 5.1.5 -- 2015-06-23
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -2005,10 +2005,15 @@ @command('^next', [('B', 'move-bookmark', False, _('Move active bookmark after update')), - ('', 'merge', False, _('bring uncommited change along'))], + ('', 'merge', False, _('bring uncommited change along')), + ('', 'evolve', False, _('evolve the next changeset if necessary'))], '[-B]') def cmdnext(ui, repo, **opts): - """update to child and display summary lines""" + """update to next child + + You can use the --evolve flag to get unstable children evolved on demand. + + The summary line of the destination is displayed for clarity""" wkctx = repo[None] wparents = wkctx.parents() if len(wparents) != 1: @@ -2042,13 +2047,28 @@ ui.warn(_('explicitly update to one of them\n')) result = 1 else: - ui.warn(_('no children\n')) aspchildren = _aspiringchildren(repo, [repo['.'].rev()]) - if aspchildren: - msg = _('(%i unstable changesets to be evolved here, ' - 'do you want to evolve?)\n') - ui.warn(msg % len(aspchildren)) - result = 1 + if not opts['evolve']: + ui.warn(_('no children\n')) + if aspchildren: + msg = _('(%i unstable changesets to be evolved here, ' + 'do you want --evolve?)\n') + ui.warn(msg % len(aspchildren)) + result = 1 + elif 1 < len(aspchildren): + ui.warn("ambigious next (unstable) changeset:\n") + for c in aspchildren: + displayer.show(repo[c]) + ui.warn(_('(run "hg evolve --rev REV" on one of them)\n')) + return 1 + else: + cmdutil.bailifchanged(repo) + result = _solveone(ui, repo, repo[aspchildren[0]], False, + False, lambda:None, category='unstable') + if not result: + ui.status(_('working directory now at %s\n') % repo['.']) + return result + return 1 return result def _reachablefrombookmark(repo, revs, mark):
--- a/tests/test-prev-next.t +++ b/tests/test-prev-next.t @@ -147,12 +147,12 @@ 1 new unstable changesets $ hg next no children - (1 unstable changesets to be evolved here, do you want to evolve?) + (1 unstable changesets to be evolved here, do you want --evolve?) [1] - $ hg evolve + $ hg next --evolve move:[2] added c atop:[3] added b (2) - working directory is now at e3b6d5df389b + working directory now at e3b6d5df389b next with ambiguity @@ -179,12 +179,14 @@ 2 new unstable changesets $ hg next no children - (2 unstable changesets to be evolved here, do you want to evolve?) + (2 unstable changesets to be evolved here, do you want --evolve?) [1] - $ hg evolve - abort: multiple evolve candidates - (select one of e3b6d5df389b, 9df671ccd2c7 with --rev) - [255] + $ hg next --evolve + ambigious next (unstable) changeset: + [4] added c + [5] added d + (run "hg evolve --rev REV" on one of them) + [1] $ hg evolve -r 5 move:[5] added d atop:[6] added b (3)