diff 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 diff
--- a/hgext/largefiles/uisetup.py	Sun Dec 23 17:26:25 2018 -0500
+++ b/hgext/largefiles/uisetup.py	Sun Dec 23 22:57:03 2018 -0500
@@ -9,25 +9,11 @@
 '''setup for largefiles extension: uisetup'''
 from __future__ import absolute_import
 
-from mercurial.hgweb import (
-    webcommands,
-)
-
 from mercurial import (
-    archival,
     cmdutil,
-    copies,
-    exchange,
     extensions,
-    filemerge,
-    hg,
     httppeer,
-    merge,
-    scmutil,
     sshpeer,
-    subrepo,
-    upgrade,
-    url,
     wireprotov1server,
 )
 
@@ -37,67 +23,10 @@
 )
 
 def uisetup(ui):
-    # Disable auto-status for some commands which assume that all
-    # files in the result are under Mercurial's control
-
-    # The scmutil function is called both by the (trivial) addremove command,
-    # and in the process of handling commit -A (issue3542)
-    extensions.wrapfunction(scmutil, 'addremove', overrides.scmutiladdremove)
-    extensions.wrapfunction(cmdutil, 'add', overrides.cmdutiladd)
-    extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
-    extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
-
-    extensions.wrapfunction(copies, 'pathcopies', overrides.copiespathcopies)
-
-    extensions.wrapfunction(upgrade, 'preservedrequirements',
-                            overrides.upgraderequirements)
-
-    extensions.wrapfunction(upgrade, 'supporteddestrequirements',
-                            overrides.upgraderequirements)
-
-    # Subrepos call status function
-    extensions.wrapfunction(subrepo.hgsubrepo, 'status',
-                            overrides.overridestatusfn)
 
     cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook)
     cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook)
 
-    extensions.wrapfunction(exchange, 'pushoperation',
-                            overrides.exchangepushoperation)
-
-    extensions.wrapfunction(hg, 'clone', overrides.hgclone)
-
-    extensions.wrapfunction(merge, '_checkunknownfile',
-                            overrides.overridecheckunknownfile)
-    extensions.wrapfunction(merge, 'calculateupdates',
-                            overrides.overridecalculateupdates)
-    extensions.wrapfunction(merge, 'recordupdates',
-                            overrides.mergerecordupdates)
-    extensions.wrapfunction(merge, 'update', overrides.mergeupdate)
-    extensions.wrapfunction(filemerge, '_filemerge',
-                            overrides.overridefilemerge)
-    extensions.wrapfunction(cmdutil, 'copy', overrides.overridecopy)
-
-    # Summary calls dirty on the subrepos
-    extensions.wrapfunction(subrepo.hgsubrepo, 'dirty', overrides.overridedirty)
-
-    extensions.wrapfunction(cmdutil, 'revert', overrides.overriderevert)
-
-    extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
-    extensions.wrapfunction(subrepo.hgsubrepo, 'archive',
-                            overrides.hgsubrepoarchive)
-    extensions.wrapfunction(webcommands, 'archive', overrides.hgwebarchive)
-    extensions.wrapfunction(cmdutil, 'bailifchanged',
-                            overrides.overridebailifchanged)
-
-    extensions.wrapfunction(cmdutil, 'postcommitstatus',
-                            overrides.postcommitstatus)
-    extensions.wrapfunction(scmutil, 'marktouched',
-                            overrides.scmutilmarktouched)
-
-    extensions.wrapfunction(url, 'open',
-                            overrides.openlargefile)
-
     # create the new wireproto commands ...
     wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')(
         proto.putlfile)
@@ -108,16 +37,10 @@
     wireprotov1server.wireprotocommand('lheads', '', permission='pull')(
         wireprotov1server.heads)
 
-    # ... and wrap some existing ones
     extensions.wrapfunction(wireprotov1server.commands['heads'], 'func',
                             proto.heads)
     # TODO also wrap wireproto.commandsv2 once heads is implemented there.
 
-    extensions.wrapfunction(webcommands, 'decodepath', overrides.decodepath)
-
-    extensions.wrapfunction(wireprotov1server, '_capabilities',
-                            proto._capabilities)
-
     # can't do this in reposetup because it needs to have happened before
     # wirerepo.__init__ is called
     proto.ssholdcallstream = sshpeer.sshv1peer._callstream
@@ -128,5 +51,6 @@
     # 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)