[PATCH stable] largefiles: drop repo wrapping detection

Mads Kiilerich mads at kiilerich.com
Fri Apr 26 12:04:51 CDT 2013


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1366995841 -7200
#      Fri Apr 26 19:04:01 2013 +0200
# Branch stable
# Node ID c6e31b698ee21631c1aeb8d14e6f7c5836bbb3c3
# Parent  be207d9b7e4bc222f4ba72ad9a266df83d939ca4
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.

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -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 @@ def reposetup(ui, repo):
     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):
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -180,34 +180,6 @@ Test moving largefiles and verify that n
   $ 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 ..


More information about the Mercurial-devel mailing list