evolve: show unfinished information in `hg status -v` (issue5886)
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 06 Jun 2018 04:29:05 +0530
changeset 3839 ac0717f23921
parent 3838 2808c899bc10
child 3840 231f593ccd5f
evolve: show unfinished information in `hg status -v` (issue5886) `hg status -v` shows information about unfinished states or `hg status` shows it when `commands.status.verbose=True` is set. Before this patch, information about interrupted evolve does not show up because evolve does not resgiters in cmdutil.STATES. This patch make sure we register evolve related information there. There has been an idea to unify cmdutil.unfinishedstates and cmdutil.STATES which needs some work and the resulting state does looks a bit complicated. So till the time we unify them, let's fix this bug by registering in cmdutil.STATES.
CHANGELOG
hgext3rd/evolve/__init__.py
tests/test-evolve-abort-contentdiv.t
tests/test-evolve-abort-orphan.t
tests/test-evolve-abort-phasediv.t
--- a/CHANGELOG	Tue Jun 12 13:58:14 2018 +0200
+++ b/CHANGELOG	Wed Jun 06 04:29:05 2018 +0530
@@ -7,6 +7,7 @@
   * evolve: handle branch changes when solving content divergence,
   * evolve: add a help section dedicated to interrupted evolve,
   * evolve: merge commit messages when resolving content divergence (issue5877)
+  * evolve: show unfinished state information in `hg status -v` (issue5886)
 
 8.0.1 -- 2018-06-11
 -------------------
--- a/hgext3rd/evolve/__init__.py	Tue Jun 12 13:58:14 2018 +0200
+++ b/hgext3rd/evolve/__init__.py	Wed Jun 06 04:29:05 2018 +0530
@@ -1387,6 +1387,13 @@
 
 evolvestateversion = 0
 
+def _evolvemessage():
+    _msg = _('To continue:    hg evolve --continue\n'
+             'To abort:       hg evolve --abort\n'
+             'To stop:        hg evolve --stop\n'
+             '(also see `hg help evolve.interrupted`)')
+    return cmdutil._commentlines(_msg)
+
 @eh.uisetup
 def setupevolveunfinished(ui):
     data = ('evolvestate', False, False, _('evolve in progress'),
@@ -1398,6 +1405,10 @@
     cmdutil.afterresolvedstates.append(afterresolved)
     cmdutil.afterresolvedstates.append(grabresolved)
 
+    statedata = ('evolve', cmdutil.fileexistspredicate('evolvestate'),
+                 _evolvemessage)
+    cmdutil.STATES = (statedata, ) + cmdutil.STATES
+
 @eh.wrapfunction(hg, 'clean')
 def clean(orig, repo, *args, **kwargs):
     ret = orig(repo, *args, **kwargs)
--- a/tests/test-evolve-abort-contentdiv.t	Tue Jun 12 13:58:14 2018 +0200
+++ b/tests/test-evolve-abort-contentdiv.t	Wed Jun 06 04:29:05 2018 +0530
@@ -81,6 +81,22 @@
   abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort
   [255]
 
+  $ hg status -v
+  M d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     d
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
   $ hg evolve --abort
   evolve aborted
   working directory is now at 9c1631e352d9
--- a/tests/test-evolve-abort-orphan.t	Tue Jun 12 13:58:14 2018 +0200
+++ b/tests/test-evolve-abort-orphan.t	Wed Jun 06 04:29:05 2018 +0530
@@ -154,6 +154,24 @@
   abort: unresolved merge conflicts (see hg help resolve)
   [255]
 
+testing that interrupted evolve shows up in morestatus
+  $ hg status -v
+  M c
+  A d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     c
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
   $ hg glog
   @  8:0c41ec482070 added b
   |   () draft
--- a/tests/test-evolve-abort-phasediv.t	Tue Jun 12 13:58:14 2018 +0200
+++ b/tests/test-evolve-abort-phasediv.t	Wed Jun 06 04:29:05 2018 +0530
@@ -92,6 +92,24 @@
   abort: unresolved merge conflicts (see hg help resolve)
   [255]
 
+testing that interrupted evolve shows up in morestatus
+  $ hg status -v
+  M c
+  A d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     c
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
   $ hg evolve --abort
   evolve aborted
   working directory is now at ddba58020bc0