changeset 4429:e10ebc58926e

compat: remove old vocabulary change fallbacks Mercurial 4.4 (minimal hg version evolve currently supports) already uses the new names and in fact has deprecation warnings saying that 4.4 is the last version of Mercurial to support the old names.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 06 Mar 2019 16:56:25 +0800
parents fe37721aa0d9
children 461b9a91b662
files hgext3rd/evolve/compat.py hgext3rd/topic/stack.py
diffstat 2 files changed, 5 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py	Thu Mar 07 10:51:48 2019 +0100
+++ b/hgext3rd/evolve/compat.py	Wed Mar 06 16:56:25 2019 +0800
@@ -16,7 +16,6 @@
     obsolete,
     obsutil,
     repair,
-    revset,
     scmutil,
     util,
     ui as uimod,
@@ -54,43 +53,11 @@
 
 # Evolution renaming compat
 
-TROUBLES = {}
-
-if not util.safehasattr(context.basectx, 'orphan'):
-    TROUBLES['ORPHAN'] = 'unstable'
-    context.basectx.orphan = context.basectx.unstable
-else:
-    TROUBLES['ORPHAN'] = 'orphan'
-
-if not util.safehasattr(context.basectx, 'contentdivergent'):
-    TROUBLES['CONTENTDIVERGENT'] = 'divergent'
-    context.basectx.contentdivergent = context.basectx.divergent
-else:
-    TROUBLES['CONTENTDIVERGENT'] = 'content-divergent'
-
-if not util.safehasattr(context.basectx, 'phasedivergent'):
-    TROUBLES['PHASEDIVERGENT'] = 'bumped'
-    context.basectx.phasedivergent = context.basectx.bumped
-else:
-    TROUBLES['PHASEDIVERGENT'] = 'phase-divergent'
-
-if not util.safehasattr(context.basectx, 'isunstable'):
-    context.basectx.isunstable = context.basectx.troubled
-
-if not util.safehasattr(revset, 'orphan'):
-    @eh.revsetpredicate('orphan')
-    def oprhanrevset(*args, **kwargs):
-        return revset.unstable(*args, **kwargs)
-
-if not util.safehasattr(revset, 'contentdivergent'):
-    @eh.revsetpredicate('contentdivergent')
-    def contentdivergentrevset(*args, **kwargs):
-        return revset.divergent(*args, **kwargs)
-
-if not util.safehasattr(revset, 'phasedivergent'):
-    @eh.revsetpredicate('phasedivergent')
-    def phasedivergentrevset(*args, **kwargs):
-        return revset.bumped(*args, **kwargs)
+TROUBLES = {
+    'ORPHAN': 'orphan',
+    'CONTENTDIVERGENT': 'content-divergent',
+    'PHASEDIVERGENT': 'phase-divergent',
+}
 
 if util.safehasattr(uimod.ui, 'makeprogress'):
     def progress(ui, topic, pos, item="", unit="", total=None):
@@ -103,26 +70,6 @@
     def progress(ui, topic, pos, item="", unit="", total=None):
         ui.progress(topic, pos, item="", unit="", total=None)
 
-if not util.safehasattr(context.basectx, 'instabilities'):
-    def instabilities(self):
-        """return the list of instabilities affecting this changeset.
-
-        Instabilities are returned as strings. possible values are:
-         - orphan,
-         - phase-divergent,
-         - content-divergent.
-         """
-        instabilities = []
-        if self.orphan():
-            instabilities.append('orphan')
-        if self.phasedivergent():
-            instabilities.append('phase-divergent')
-        if self.contentdivergent():
-            instabilities.append('content-divergent')
-        return instabilities
-
-    context.basectx.instabilities = instabilities
-
 # XXX: Better detection of property cache
 if 'predecessors' not in dir(obsolete.obsstore):
     @property
@@ -131,15 +78,6 @@
 
     obsolete.obsstore.predecessors = predecessors
 
-if not util.safehasattr(obsolete, '_computeorphanset'):
-    obsolete._computeorphanset = obsolete.cachefor('orphan')(obsolete._computeunstableset)
-
-if not util.safehasattr(obsolete, '_computecontentdivergentset'):
-    obsolete._computecontentdivergentset = obsolete.cachefor('contentdivergent')(obsolete._computedivergentset)
-
-if not util.safehasattr(obsolete, '_computephasedivergentset'):
-    obsolete._computephasedivergentset = obsolete.cachefor('phasedivergent')(obsolete._computebumpedset)
-
 def memfilectx(repo, ctx, fctx, flags, copied, path):
     # XXX Would it be better at the module level?
     varnames = context.memfilectx.__init__.__code__.co_varnames
--- a/hgext3rd/topic/stack.py	Thu Mar 07 10:51:48 2019 +0100
+++ b/hgext3rd/topic/stack.py	Wed Mar 06 16:56:25 2019 +0800
@@ -5,7 +5,6 @@
 from mercurial.i18n import _
 from mercurial import (
     destutil,
-    context,
     error,
     node,
     phases,
@@ -20,14 +19,6 @@
 
 short = node.short
 
-# TODO: compat
-
-if not util.safehasattr(context.basectx, 'orphan'):
-    context.basectx.orphan = context.basectx.unstable
-
-if not util.safehasattr(context.basectx, 'isunstable'):
-    context.basectx.isunstable = context.basectx.troubled
-
 def parseusername(user):
     """parses the ctx user and returns the username without email ID if
     possible, otherwise returns the mail address from that"""