diff hgext/mq.py @ 19822:a194a33f8cb2

mq: prepare a strip extension for extraction Strip will lives in its own extension. The extension is surprisingly called `strip`. (as discussed in issue3824) The `mq` extension force the use of the strip extension when its enabled. This will both necessary for backward compatibility (people expect `mq` to comes with strip) and become some utility function used by `mq` will move in the strip extension.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 26 Sep 2013 23:10:11 +0200
parents 8cf0e2c32901
children 6fb14d21fe9d
line wrap: on
line diff
--- a/hgext/mq.py	Thu Sep 26 14:47:19 2013 +0200
+++ b/hgext/mq.py	Thu Sep 26 23:10:11 2013 +0200
@@ -77,6 +77,17 @@
 command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
+# force load strip extension formely included in mq and import some utility
+try:
+    stripext = extensions.find('strip')
+except KeyError:
+    # note: load is lazy so we could avoid the try-except,
+    # but I (marmoute) prefer this explicite code.
+    class dummyui(object):
+        def debug(self, msg):
+            pass
+    stripext = extensions.load(dummyui(), 'strip', '')
+
 # Patch names looks like unix-file names.
 # They must be joinable with queue directory and result in the patch path.
 normname = util.normpath