Mercurial > evolve
diff hgext/evolve.py @ 1449: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 | 73eb4f33f9dc |
line wrap: on
line diff
--- a/hgext/evolve.py Wed Jun 24 19:42:01 2015 -0700 +++ b/hgext/evolve.py Wed Jun 24 20:06:45 2015 -0700 @@ -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):