##// END OF EJS Templates
largefiles: improve repo wrapping detection...
FUJIWARA Katsunori -
r18969:257afe54 default
parent child Browse files
Show More
@@ -27,10 +27,11 b' def reposetup(ui, repo):'
27 27 if not repo.local():
28 28 return proto.wirereposetup(ui, repo)
29 29
30 origclass = localrepo.localrepository
31 repoclass = repo.__class__
30 32 for name in ('status', 'commitctx', 'commit', 'push'):
31 method = getattr(repo, name)
32 if (isinstance(method, types.FunctionType) and
33 method.func_name == 'wrap'):
33 if (getattr(origclass, name) != getattr(repoclass, name) or
34 isinstance(getattr(repo, name), types.FunctionType)):
34 35 ui.warn(_('largefiles: repo method %r appears to have already been'
35 36 ' wrapped by another extension: '
36 37 'largefiles may behave incorrectly\n')
@@ -180,6 +180,34 b' Test moving largefiles and verify that n'
180 180 $ cat sub/large4
181 181 large22
182 182
183 Test repo method wrapping detection
184
185 $ cat > $TESTTMP/wrapping1.py <<EOF
186 > from hgext import largefiles
187 > def reposetup(ui, repo):
188 > class derived(repo.__class__):
189 > def push(self, *args, **kwargs):
190 > return super(derived, self).push(*args, **kwargs)
191 > repo.__class__ = derived
192 > largefiles.reposetup(ui, repo)
193 > uisetup = largefiles.uisetup
194 > EOF
195 $ hg --config extensions.largefiles=$TESTTMP/wrapping1.py status
196 largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
197
198 $ cat > $TESTTMP/wrapping2.py <<EOF
199 > from hgext import largefiles
200 > def reposetup(ui, repo):
201 > orgpush = repo.push
202 > def push(*args, **kwargs):
203 > return orgpush(*args, **kwargs)
204 > repo.push = push
205 > largefiles.reposetup(ui, repo)
206 > uisetup = largefiles.uisetup
207 > EOF
208 $ hg --config extensions.largefiles=$TESTTMP/wrapping2.py status
209 largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
210
183 211 Test copies and moves from a directory other than root (issue3516)
184 212
185 213 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now