# HG changeset patch # User Pierre-Yves David # Date 1380229811 -7200 # Node ID a194a33f8cb230c3e2bd8c4a0105b992e9d48ce4 # Parent baab785e3ecfaf07e287af0e1a02bcaaf9dc38b4 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. diff -r baab785e3ecf -r a194a33f8cb2 hgext/mq.py --- 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 diff -r baab785e3ecf -r a194a33f8cb2 hgext/strip.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/strip.py Thu Sep 26 23:10:11 2013 +0200 @@ -0,0 +1,5 @@ +from mercurial import cmdutil + +cmdtable = {} +command = cmdutil.command(cmdtable) +testedwith = 'internal' diff -r baab785e3ecf -r a194a33f8cb2 tests/test-extension.t --- a/tests/test-extension.t Thu Sep 26 14:47:19 2013 +0200 +++ b/tests/test-extension.t Thu Sep 26 23:10:11 2013 +0200 @@ -406,13 +406,16 @@ > EOF $ echo "debugissue811 = $debugpath" >> $HGRCPATH $ echo "mq=" >> $HGRCPATH + $ echo "strip=" >> $HGRCPATH $ echo "hgext.mq=" >> $HGRCPATH $ echo "hgext/mq=" >> $HGRCPATH Show extensions: +(note that mq force load strip, also checking it's not loaded twice) $ hg debugextensions debugissue811 + strip mq Disabled extension commands: