Register the default http handler for all schemes we handle to force them to be non-local
authorTill Schneidereit <tschneidereit@gmail.com>
Fri, 30 Nov 2012 15:21:49 +0100
changeset 69 d2f36f9b40d9
parent 68 6237bc0a91fa
child 70 6fe550e5b4e3
push id50
push userMs2ger@gmail.com
push dateSat, 01 Dec 2012 09:31:33 +0000
Register the default http handler for all schemes we handle to force them to be non-local This is a workaround for a breaking change in hg 2.4
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -28,17 +28,17 @@ There are 7 pieces of patch metadata ava
   "filename" : the initial patch filename
   "bugdesc" : the bug description
 
 The default values are::
 
   patch_format = %(filename)s
   msg_format = Bug %(bugnum)s - "%(title)s" [%(flags)s]
 """
-from mercurial import commands, cmdutil, extensions, url, error
+from mercurial import hg, commands, cmdutil, extensions, url, error, httppeer
 from hgext import mq
 
 import re
 import os
 import urllib
 
 import bz
 import bzhandler
@@ -205,22 +205,27 @@ def extsetup(ui=None):
       newopts['name'] = checkpatchname(patch)
       path = makebzurl(patch.bug.num, patch.id)
 
       orig(ui, repo, path, **newopts)
 
   extensions.wrapcommand(cmdtable, 'qimport', qimporthook)
 
   # Here we setup the protocol handlers
-  processors = [bzhandler.Handler, pb.Handler, scp.Handler]
+  processors = {
+    'bz' : bzhandler.Handler,
+    'pb' : pb.Handler,
+    'scp' : scp.Handler
+  }
 
   # Mercurial 1.4 has an easy way to do this for bz://dddddd urls
-  if hasattr(url, 'handlerfuncs'):
-    for p in processors:
+  if hasattr(url, 'handlerfuncs') and hasattr(hg, 'schemes'):
+    for s, p in processors.items():
       url.handlerfuncs.append(p)
+      hg.schemes[s] = httppeer
   else: # monkey patching for 1.3.1 :(
     # patch in bz: and pb: url support
     def bzopener(orig, ui, authinfo=None):
       result = orig(ui, authinfo)
       for p in processors:
         result.add_handler(p(ui, authinfo))
       return result