Mercurial > hg
view hgext/largefiles/uisetup.py @ 41062:0a7f582f6f1f
largefiles: port wrapped functions to exthelper
Things get interesting in the commit. I hadn't seen issue6033 on Windows, and
yet it is now reproducible 100% of the time on Windows 10 with this commit. I
didn't test Linux. (For comparison, after seeing this issue, I tested on the
parent with --loop, and it failed 5 times out of over 1300 tests.)
The strange thing is that largefiles has nothing to do with that test (it's not
even mentioned there). It isn't autoloading run amuck- it occurs even if
largefiles is explicitly disabled, and also if the entry in afterhgrcload() is
commented out. It's also not the import of lfutil- I disabled that by copying
the function into lfs and removing the import, and the problem still occurs.
Experimenting further, it seems that the problem is isolated to 3 entries:
exchange.pushoperation, hg.clone, and cmdutil.revert. If those decorators are
all commented out, the test passes when run in a loop for awhile. (Obviously,
some largefiles tests will fail.) But if any one is commented back in, the test
fails immediately.
I left one method related to wrapping the wire protocol, because it seemed more
natural with the TODO. Also, exthelper doesn't support wrapping functions from
another extension, only commands in another extension. I didn't try to figure
out why rebase is both command wrapped and function wrapped.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 23 Dec 2018 22:57:03 -0500 |
parents | 98681293c890 |
children |
line wrap: on
line source
# 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)