annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
1 # Copyright 2009-2010 Gregory P. Ward
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
2 # Copyright 2009-2010 Intelerad Medical Systems Incorporated
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
3 # Copyright 2010-2011 Fog Creek Software
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
4 # Copyright 2010-2011 Unity Technologies
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
5 #
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
6 # This software may be used and distributed according to the terms of the
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
7 # GNU General Public License version 2 or any later version.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
8
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
9 '''setup for largefiles extension: uisetup'''
29315
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
10 from __future__ import absolute_import
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
11
29315
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
12 from mercurial import (
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
13 cmdutil,
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
14 extensions,
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
15 httppeer,
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
16 sshpeer,
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
17 wireprotov1server,
29315
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
18 )
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
19
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
20 from . import (
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
21 overrides,
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
22 proto,
2143266ecb65 py3: make largefiles/uisetup.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 28878
diff changeset
23 )
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
24
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
25 def uisetup(ui):
16515
12dabc22de77 largefiles: fix status -S reporting of subrepos (issue3231)
Matt Harbison <matt_harbison@yahoo.com>
parents: 16449
diff changeset
26
21052
cde32cb5a565 largefiles: use "outgoinghooks" to avoid redundant outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21048
diff changeset
27 cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook)
21048
ca7a57464fb3 largefiles: use "summaryremotehooks" to avoid redundant outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20638
diff changeset
28 cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
29
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
30 # create the new wireproto commands ...
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
31 wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')(
36800
0b18604db95e wireproto: declare permissions requirements in @wireprotocommand (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36760
diff changeset
32 proto.putlfile)
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
33 wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')(
36800
0b18604db95e wireproto: declare permissions requirements in @wireprotocommand (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36760
diff changeset
34 proto.getlfile)
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
35 wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')(
36800
0b18604db95e wireproto: declare permissions requirements in @wireprotocommand (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36760
diff changeset
36 proto.statlfile)
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
37 wireprotov1server.wireprotocommand('lheads', '', permission='pull')(
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
38 wireprotov1server.heads)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
39
37785
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
40 extensions.wrapfunction(wireprotov1server.commands['heads'], 'func',
b4d85bc122bd wireproto: rename wireproto to wireprotov1server (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37484
diff changeset
41 proto.heads)
37295
45b39c69fae0 wireproto: separate commands tables for version 1 and 2 commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36800
diff changeset
42 # TODO also wrap wireproto.commandsv2 once heads is implemented there.
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
43
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
44 # can't do this in reposetup because it needs to have happened before
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
45 # wirerepo.__init__ is called
35977
625038cb4b1d sshpeer: rename sshpeer class to sshv1peer (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35564
diff changeset
46 proto.ssholdcallstream = sshpeer.sshv1peer._callstream
17192
1ac628cd7113 peer: introduce real peer classes
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 16692
diff changeset
47 proto.httpoldcallstream = httppeer.httppeer._callstream
35977
625038cb4b1d sshpeer: rename sshpeer class to sshv1peer (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35564
diff changeset
48 sshpeer.sshv1peer._callstream = proto.sshrepocallstream
17192
1ac628cd7113 peer: introduce real peer classes
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 16692
diff changeset
49 httppeer.httppeer._callstream = proto.httprepocallstream
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
50
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
51 # override some extensions' stuff as well
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
52 for name, module in extensions.extensions():
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
53 if name == 'rebase':
41062
0a7f582f6f1f largefiles: port wrapped functions to exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41061
diff changeset
54 # TODO: teach exthelper to handle this
23182
9b6c3947b4a7 largefiles: wrap "rebase.rebase" for functions using it directly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22289
diff changeset
55 extensions.wrapfunction(module, 'rebase',
9b6c3947b4a7 largefiles: wrap "rebase.rebase" for functions using it directly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22289
diff changeset
56 overrides.overriderebase)