diff hgext3rd/evolve/evolvecmd.py @ 3466:0a8e3130ad00

evolvecmd: move more core from __init__.py to evolvecmd.py We are done with moving helper code, we will now be moving the evolve command in the new module.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 19 Jan 2018 16:44:00 +0530
parents ffe566999920
children e97bfd529e72
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Fri Jan 19 16:00:21 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Jan 19 16:44:00 2018 +0530
@@ -843,6 +843,52 @@
 
     fm.end()
 
+def _checkevolveopts(repo, opts):
+    """ check the options passed to `hg evolve` and warn for deprecation warning
+    if any """
+
+    if opts['continue']:
+        if opts['any']:
+            raise error.Abort('cannot specify both "--any" and "--continue"')
+        if opts['all']:
+            raise error.Abort('cannot specify both "--all" and "--continue"')
+
+    if opts['rev']:
+        if opts['any']:
+            raise error.Abort('cannot specify both "--rev" and "--any"')
+        if opts['all']:
+            raise error.Abort('cannot specify both "--rev" and "--all"')
+
+    # Backward compatibility
+    if opts['unstable']:
+        msg = ("'evolve --unstable' is deprecated, "
+               "use 'evolve --orphan'")
+        repo.ui.deprecwarn(msg, '4.4')
+
+        opts['orphan'] = opts['divergent']
+
+    if opts['divergent']:
+        msg = ("'evolve --divergent' is deprecated, "
+               "use 'evolve --content-divergent'")
+        repo.ui.deprecwarn(msg, '4.4')
+
+        opts['content_divergent'] = opts['divergent']
+
+    if opts['bumped']:
+        msg = ("'evolve --bumped' is deprecated, "
+               "use 'evolve --phase-divergent'")
+        repo.ui.deprecwarn(msg, '4.4')
+
+        opts['phase_divergent'] = opts['bumped']
+
+    return opts
+
+def _cleanup(ui, repo, startnode, showprogress):
+    if showprogress:
+        ui.progress(_('evolve'), None)
+    if repo['.'] != startnode:
+        ui.status(_('working directory is now at %s\n') % repo['.'])
+
 def divergentsets(repo, ctx):
     """Compute sets of commits divergent with a given one"""
     cache = {}