# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1527972979 -19800
# Node ID 084038b98cd7d4023c0a93058c27752647d4670f
# Parent  1bf0d353f99990c931fc119f63a55baa8c729ed4
next: bail out early in `hg next --evolve` if dirty wdir

This patch adds logic to bail out early when --evolve is passed with next
command and the working directory is dirty.

This will help us in preventing the message saying `do you want --merge` which
is useless and misleading when `--evolve` is passed.

diff -r 1bf0d353f999 -r 084038b98cd7 hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Sun Jun 03 02:24:28 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Sun Jun 03 02:26:19 2018 +0530
@@ -1103,6 +1103,11 @@
         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)
diff -r 1bf0d353f999 -r 084038b98cd7 tests/test-prev-next.t
--- a/tests/test-prev-next.t	Sun Jun 03 02:24:28 2018 +0530
+++ b/tests/test-prev-next.t	Sun Jun 03 02:26:19 2018 +0530
@@ -375,5 +375,4 @@
 
   $ hg next --evolve
   abort: uncommitted changes
-  (do you want --merge?)
   [255]