changeset 4700:6af77f89eac5

compat: fix `setupevolveunfinished` for upstream
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 30 Jun 2019 23:50:57 +0530
parents cba3db7d7e96
children e15dc6defc99
files hgext3rd/evolve/__init__.py
diffstat 1 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Tue Jul 02 10:17:42 2019 +0200
+++ b/hgext3rd/evolve/__init__.py	Sun Jun 30 23:50:57 2019 +0530
@@ -1355,14 +1355,26 @@
 
 @eh.uisetup
 def setupevolveunfinished(ui):
-    data = ('evolvestate', False, False, _('evolve in progress'),
-            _("use 'hg evolve --continue' or 'hg evolve --abort' to abort"))
-    cmdutil.unfinishedstates.append(data)
+    if not util.safehasattr(cmdutil, 'unfinishedstates'):
+        from mercurial import state as statemod
+        _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`)')
+        statemod.addunfinished('evolve', fname='evolvestate',
+                               continueflag=True, stopflag=True,
+                               statushint=_msg)
+        statemod.addunfinished('pick', fname='pickstate', continueflag=True)
+    else:
+        # compat <= hg-5.0 (5f2f6912c9e6)
+        data = ('evolvestate', False, False, _('evolve in progress'),
+                _("use 'hg evolve --continue' or 'hg evolve --abort' to abort"))
+        cmdutil.unfinishedstates.append(data)
 
-    afterresolved = ('evolvestate', _('hg evolve --continue'))
-    pickresolved = ('pickstate', _('hg pick --continue'))
-    cmdutil.afterresolvedstates.append(afterresolved)
-    cmdutil.afterresolvedstates.append(pickresolved)
+        afterresolved = ('evolvestate', _('hg evolve --continue'))
+        pickresolved = ('pickstate', _('hg pick --continue'))
+        cmdutil.afterresolvedstates.append(afterresolved)
+        cmdutil.afterresolvedstates.append(pickresolved)
 
     if util.safehasattr(cmdutil, 'STATES'):
         statedata = ('evolve', cmdutil.fileexistspredicate('evolvestate'),