# HG changeset patch # User Pierre-Yves David # Date 1524128157 -7200 # Node ID e2a91d4d207d0407686274fa859b9ff8d81acd4e # Parent b12c5d107187f3bf96d455934ba9843f04651e12 evolve: handle wireproto module deletion for registering new commands Module have been deleted in b4d85bc122bd. We can no longer import it blindly. diff -r b12c5d107187 -r e2a91d4d207d hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Thu Apr 19 10:53:59 2018 +0200 +++ b/hgext3rd/evolve/compat.py Thu Apr 19 10:55:57 2018 +0200 @@ -18,7 +18,6 @@ obsolete, revset, util, - wireproto, ) from mercurial.hgweb import hgweb_mod @@ -284,17 +283,23 @@ parsedate = mercurial.util.parsedate def wireprotocommand(exthelper, name, args='', permission='pull'): + try: + # Since b4d85bc1 + from mercurial.wireprotov1server import wireprotocommand + return wireprotocommand(name, args, permission=permission) + except (ImportError, AttributeError): + from mercurial import wireproto + if 3 <= len(wireproto.wireprotocommand.func_defaults): return wireproto.wireprotocommand(name, args, permission=permission) - else: - # <= hg-4.5 permission must be registered in dictionnary - def decorator(func): - @eh.extsetup - def install(ui): - hgweb_mod.perms[name] = permission - wireproto.commands[name] = (func, args) - return decorator + # <= hg-4.5 permission must be registered in dictionnary + def decorator(func): + @eh.extsetup + def install(ui): + hgweb_mod.perms[name] = permission + wireproto.commands[name] = (func, args) + return decorator # mercurial <= 4.5 do not have the updateresult object try: