uisetup.py
56 lines
| 2.0 KiB
| text/x-python
|
PythonLexer
various
|
r15168 | # 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''' | ||||
liscju
|
r29315 | from __future__ import absolute_import | ||
various
|
r15168 | |||
liscju
|
r29315 | from mercurial import ( | ||
cmdutil, | ||||
extensions, | ||||
httppeer, | ||||
sshpeer, | ||||
Gregory Szorc
|
r37803 | wireprotov1server, | ||
liscju
|
r29315 | ) | ||
from . import ( | ||||
overrides, | ||||
proto, | ||||
) | ||||
various
|
r15168 | |||
def uisetup(ui): | ||||
Matt Harbison
|
r16515 | |||
FUJIWARA Katsunori
|
r21052 | cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook) | ||
FUJIWARA Katsunori
|
r21048 | cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook) | ||
various
|
r15168 | |||
# create the new wireproto commands ... | ||||
Gregory Szorc
|
r37803 | wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')( | ||
Gregory Szorc
|
r36818 | proto.putlfile) | ||
Gregory Szorc
|
r37803 | wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')( | ||
Gregory Szorc
|
r36818 | proto.getlfile) | ||
Gregory Szorc
|
r37803 | wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')( | ||
Gregory Szorc
|
r36818 | proto.statlfile) | ||
Gregory Szorc
|
r37803 | wireprotov1server.wireprotocommand('lheads', '', permission='pull')( | ||
wireprotov1server.heads) | ||||
various
|
r15168 | |||
Gregory Szorc
|
r37803 | extensions.wrapfunction(wireprotov1server.commands['heads'], 'func', | ||
proto.heads) | ||||
Gregory Szorc
|
r37311 | # TODO also wrap wireproto.commandsv2 once heads is implemented there. | ||
various
|
r15168 | |||
# can't do this in reposetup because it needs to have happened before | ||||
# wirerepo.__init__ is called | ||||
Gregory Szorc
|
r35995 | proto.ssholdcallstream = sshpeer.sshv1peer._callstream | ||
Peter Arrenbrecht
|
r17192 | proto.httpoldcallstream = httppeer.httppeer._callstream | ||
Gregory Szorc
|
r35995 | sshpeer.sshv1peer._callstream = proto.sshrepocallstream | ||
Peter Arrenbrecht
|
r17192 | httppeer.httppeer._callstream = proto.httprepocallstream | ||
various
|
r15168 | |||
# override some extensions' stuff as well | ||||
for name, module in extensions.extensions(): | ||||
if name == 'rebase': | ||||
Matt Harbison
|
r41092 | # TODO: teach exthelper to handle this | ||
FUJIWARA Katsunori
|
r23182 | extensions.wrapfunction(module, 'rebase', | ||
overrides.overriderebase) | ||||