changeset 5708:fdc540a9b94b stable

compat: wrap debugstrip from core hg if it exists Since the debugstrip command from core and strip command from the hgext.strip extension is now the same thing, we don't have to wrap them separately. Unless, of course, users have a copy of old (from hg 5.6 and earlier) hgext.strip laying around that they specifically want to use, but I don't think we want to support that use case.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 25 Nov 2020 13:50:37 +0100
parents 581203686284
children d0f73113fcc0
files hgext3rd/evolve/__init__.py
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Mon Nov 16 13:08:08 2020 -0800
+++ b/hgext3rd/evolve/__init__.py	Wed Nov 25 13:50:37 2020 +0100
@@ -1179,7 +1179,17 @@
     finally:
         lockmod.release(tr, lock, wlock)
 
-@eh.wrapcommand(b'strip', extension=b'strip', opts=[
+try:
+    from mercurial import strip
+    strip
+    stripcmd = b'debugstrip'
+    stripext = None
+except ImportError:
+    # hg <= 5.6 (d7a508a75d72)
+    stripcmd = b'strip'
+    stripext = b'strip'
+
+@eh.wrapcommand(stripcmd, extension=stripext, opts=[
     (b'', b'bundle', None, _(b"delete the commit entirely and move it to a "
                              b"backup bundle")),
     ])