# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1545624111 18000 # Sun Dec 23 23:01:51 2018 -0500 # Node ID 7598b362dfbf7cb43a14fdd9296f0d1f4fd67627 # Parent 6603de284b0aaa030f180d28b809e4cc764c0ac1 largefiles: drop the uisetup module
This is small enough to live in the __init__ module. diff --git a/hgext/largefiles/__init__.py b/hgext/largefiles/__init__.py --- a/hgext/largefiles/__init__.py +++ b/hgext/largefiles/__init__.py @@ -107,10 +107,15 @@ command. from __future__ import absolute_import from mercurial import ( + cmdutil, configitems, + extensions, exthelper, hg, + httppeer, localrepo, + sshpeer, + wireprotov1server, ) from . import ( @@ -118,7 +123,6 @@ from . import ( overrides, proto, reposetup, - uisetup as uisetupmod, ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -156,6 +160,36 @@ def featuresetup(ui, supported): def _uisetup(ui): localrepo.featuresetupfuncs.add(featuresetup) hg.wirepeersetupfuncs.append(proto.wirereposetup) - uisetupmod.uisetup(ui) + + cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook) + cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook) + + # create the new wireproto commands ... + wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')( + proto.putlfile) + wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')( + proto.getlfile) + wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')( + proto.statlfile) + wireprotov1server.wireprotocommand('lheads', '', permission='pull')( + wireprotov1server.heads) + + extensions.wrapfunction(wireprotov1server.commands['heads'], 'func', + proto.heads) + # TODO also wrap wireproto.commandsv2 once heads is implemented there. + + # can't do this in reposetup because it needs to have happened before + # wirerepo.__init__ is called + proto.ssholdcallstream = sshpeer.sshv1peer._callstream + proto.httpoldcallstream = httppeer.httppeer._callstream + sshpeer.sshv1peer._callstream = proto.sshrepocallstream + httppeer.httppeer._callstream = proto.httprepocallstream + + # override some extensions' stuff as well + for name, module in extensions.extensions(): + if name == 'rebase': + # TODO: teach exthelper to handle this + extensions.wrapfunction(module, 'rebase', + overrides.overriderebase) revsetpredicate = overrides.revsetpredicate diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py deleted file mode 100644 --- a/hgext/largefiles/uisetup.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2009-2010 Gregory P. Ward -# Copyright 2009-2010 Intelerad Medical Systems Incorporated -# Copyright 2010-2011 Fog Creek Software -# Copyright 2010-2011 Unity Technologies -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. - -'''setup for largefiles extension: uisetup''' -from __future__ import absolute_import - -from mercurial import ( - cmdutil, - extensions, - httppeer, - sshpeer, - wireprotov1server, -) - -from . import ( - overrides, - proto, -) - -def uisetup(ui): - - cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook) - cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook) - - # create the new wireproto commands ... - wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')( - proto.putlfile) - wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')( - proto.getlfile) - wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')( - proto.statlfile) - wireprotov1server.wireprotocommand('lheads', '', permission='pull')( - wireprotov1server.heads) - - extensions.wrapfunction(wireprotov1server.commands['heads'], 'func', - proto.heads) - # TODO also wrap wireproto.commandsv2 once heads is implemented there. - - # can't do this in reposetup because it needs to have happened before - # wirerepo.__init__ is called - proto.ssholdcallstream = sshpeer.sshv1peer._callstream - proto.httpoldcallstream = httppeer.httppeer._callstream - sshpeer.sshv1peer._callstream = proto.sshrepocallstream - httppeer.httppeer._callstream = proto.httprepocallstream - - # override some extensions' stuff as well - for name, module in extensions.extensions(): - if name == 'rebase': - # TODO: teach exthelper to handle this - extensions.wrapfunction(module, 'rebase', - overrides.overriderebase) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel