largefiles: drop repo wrapping detection stable
authorMads Kiilerich <madski@unity3d.com>
Fri, 26 Apr 2013 19:04:01 +0200
branchstable
changeset 19088 ce4472b2edb2
parent 19087 7d82ad4b3727
child 19089 0509ae083ec1
largefiles: drop repo wrapping detection After 257afe5489d4 I see: $ hg id -q largefiles: repo method 'commit' appears to have already been wrapped by another extension: largefiles may behave incorrectly largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly be207d9b7e4b The warning is bad: * The message gives no hint what the problem is and how it can be resolved. The message is useless. * Largefiles do have its share of problems, but I don't think I ever have seen a problem where this warning would have helped. The 'may' in the warning seems like an exaggeration of the risk. Having largefiles enabled in combination with for instance mq, hggit and hgsubversion causes a warning (depending on the configuration order) but do not cause problems. Extensions might of course be incompatible, but they can be that in many other ways. The check and the message are incorrect. It would thus be better to remove the check and the warning completely. Before 257afe5489d4 the check always failed. That change made the check work more like intended ... but the intention was wrong. This change will thus also back that change out.
hgext/largefiles/reposetup.py
tests/test-largefiles.t
--- a/hgext/largefiles/reposetup.py	Fri Apr 26 23:36:12 2013 +0900
+++ b/hgext/largefiles/reposetup.py	Fri Apr 26 19:04:01 2013 +0200
@@ -8,7 +8,6 @@
 
 '''setup for largefiles repositories: reposetup'''
 import copy
-import types
 import os
 
 from mercurial import context, error, manifest, match as match_, util, \
@@ -27,16 +26,6 @@
     if not repo.local():
         return proto.wirereposetup(ui, repo)
 
-    origclass = localrepo.localrepository
-    repoclass = repo.__class__
-    for name in ('status', 'commitctx', 'commit', 'push'):
-        if (getattr(origclass, name) != getattr(repoclass, name) or
-            isinstance(getattr(repo, name), types.FunctionType)):
-            ui.warn(_('largefiles: repo method %r appears to have already been'
-                    ' wrapped by another extension: '
-                    'largefiles may behave incorrectly\n')
-                    % name)
-
     class lfilesrepo(repo.__class__):
         lfstatus = False
         def status_nolfiles(self, *args, **kwargs):
--- a/tests/test-largefiles.t	Fri Apr 26 23:36:12 2013 +0900
+++ b/tests/test-largefiles.t	Fri Apr 26 19:04:01 2013 +0200
@@ -180,34 +180,6 @@
   $ cat sub/large4
   large22
 
-Test repo method wrapping detection
-
-  $ cat > $TESTTMP/wrapping1.py <<EOF
-  > from hgext import largefiles
-  > def reposetup(ui, repo):
-  >     class derived(repo.__class__):
-  >         def push(self, *args, **kwargs):
-  >             return super(derived, self).push(*args, **kwargs)
-  >     repo.__class__ = derived
-  >     largefiles.reposetup(ui, repo)
-  > uisetup = largefiles.uisetup
-  > EOF
-  $ hg --config extensions.largefiles=$TESTTMP/wrapping1.py status
-  largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
-
-  $ cat > $TESTTMP/wrapping2.py <<EOF
-  > from hgext import largefiles
-  > def reposetup(ui, repo):
-  >     orgpush = repo.push
-  >     def push(*args, **kwargs):
-  >         return orgpush(*args, **kwargs)
-  >     repo.push = push
-  >     largefiles.reposetup(ui, repo)
-  > uisetup = largefiles.uisetup
-  > EOF
-  $ hg --config extensions.largefiles=$TESTTMP/wrapping2.py status
-  largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
-
 Test copies and moves from a directory other than root (issue3516)
 
   $ cd ..