Mercurial > hg
comparison hgext/largefiles/proto.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 | a81d02ea65db |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
41061:98681293c890 | 41062:0a7f582f6f1f |
---|---|
9 | 9 |
10 from mercurial.i18n import _ | 10 from mercurial.i18n import _ |
11 | 11 |
12 from mercurial import ( | 12 from mercurial import ( |
13 error, | 13 error, |
14 exthelper, | |
14 httppeer, | 15 httppeer, |
15 util, | 16 util, |
16 wireprototypes, | 17 wireprototypes, |
17 wireprotov1peer, | 18 wireprotov1peer, |
19 wireprotov1server, | |
18 ) | 20 ) |
19 | 21 |
20 from . import ( | 22 from . import ( |
21 lfutil, | 23 lfutil, |
22 ) | 24 ) |
25 urlreq = util.urlreq | 27 urlreq = util.urlreq |
26 | 28 |
27 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' | 29 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' |
28 '\n\nPlease enable it in your Mercurial config ' | 30 '\n\nPlease enable it in your Mercurial config ' |
29 'file.\n') | 31 'file.\n') |
32 | |
33 eh = exthelper.exthelper() | |
30 | 34 |
31 # these will all be replaced by largefiles.uisetup | 35 # these will all be replaced by largefiles.uisetup |
32 ssholdcallstream = None | 36 ssholdcallstream = None |
33 httpoldcallstream = None | 37 httpoldcallstream = None |
34 | 38 |
160 yield 2 | 164 yield 2 |
161 | 165 |
162 repo.__class__ = lfileswirerepository | 166 repo.__class__ = lfileswirerepository |
163 | 167 |
164 # advertise the largefiles=serve capability | 168 # advertise the largefiles=serve capability |
169 @eh.wrapfunction(wireprotov1server, '_capabilities') | |
165 def _capabilities(orig, repo, proto): | 170 def _capabilities(orig, repo, proto): |
166 '''announce largefile server capability''' | 171 '''announce largefile server capability''' |
167 caps = orig(repo, proto) | 172 caps = orig(repo, proto) |
168 caps.append('largefiles=serve') | 173 caps.append('largefiles=serve') |
169 return caps | 174 return caps |