changeset 4247:820a25dcea58

next: make next command --evolve by default Before this patch, if we need to evolve to update to the next child, we were suggesting the user to use --evolve flag. This patch make some changes to evolve by default in that conditions. After making next command to evolve by default we have to consider the following points: 1) If we don't need to evolve while updating to the next child: a) And if wdir is dirty, we suggest to use --merge flag b) if wdir is clean, we simply update to next child (if ambiguous, prompt the user to select one) 2) If we need to evolve: a) when wdir is dirty, we suggest the user to use `hg shelve` first, to make wdir clean. As we don't support --merge while evovling. b) when wdir is clean, we evolve the next cset. Changes made in test-prev-next.t reflect the changed behaviour.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 10 Nov 2018 15:50:05 +0100
parents 2d9902f0ff17
children 51b69f3dfc0b
files CHANGELOG hgext3rd/evolve/__init__.py
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Mon Nov 05 19:56:33 2018 +0800
+++ b/CHANGELOG	Sat Nov 10 15:50:05 2018 +0100
@@ -5,6 +5,7 @@
 -------------------
 
   * push: have `--publish` overrule the `auto-publish` config
+  * next: evolve aspiring children by default (use --no-evolve to skip)
 
 8.3.2 - in progress
 -------------------
--- a/hgext3rd/evolve/__init__.py	Mon Nov 05 19:56:33 2018 +0800
+++ b/hgext3rd/evolve/__init__.py	Sat Nov 10 15:50:05 2018 +0100
@@ -1105,7 +1105,7 @@
     [('B', 'move-bookmark', False,
         _('move active bookmark after update')),
      ('m', 'merge', False, _('bring uncommitted change along')),
-     ('', 'evolve', False, _('evolve the next changeset if necessary')),
+     ('', 'evolve', True, _('evolve the next changeset if necessary')),
      ('', 'no-topic', False, _('ignore topic and move topologically')),
      ('n', 'dry-run', False,
       _('do not perform actions, just print what would be done'))],
@@ -1128,11 +1128,6 @@
         if len(wparents) != 1:
             raise error.Abort(_('merge in progress'))
 
-        # check for dirty wdir if --evolve is passed
-        if opts['evolve']:
-            hint = _('use `hg amend`, `hg revert` or `hg shelve`')
-            cmdutil.bailifchanged(repo, hint=hint)
-
         children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()]
         topic = _getcurrenttopic(repo)
         filtered = set()
@@ -1144,13 +1139,21 @@
         displayer = compat.changesetdisplayer(ui, repo, {'template': template})
 
         # check if we need to evolve while updating to the next child revision
+        needevolve = False
         aspchildren = evolvecmd._aspiringchildren(repo, [repo['.'].rev()])
         if topic:
             filtered.update(repo[c] for c in aspchildren
                             if repo[c].topic() != topic)
             aspchildren = [ctx for ctx in aspchildren if ctx not in filtered]
+        if aspchildren:
+            needevolve = True
 
-        if not opts['merge']:
+        # check if working directory is clean before we evolve the next cset
+        if needevolve and opts['evolve']:
+            hint = _('use `hg amend`, `hg revert` or `hg shelve`')
+            cmdutil.bailifchanged(repo, hint=hint)
+
+        if not (opts['merge'] or (needevolve and opts['evolve'])):
             # we only skip the check if noconflict is set
             if ui.config('commands', 'update.check') == 'noconflict':
                 pass