# HG changeset patch # User Augie Fackler # Date 1539692171 14400 # Node ID ef0baff11aeaaa8424294982235a18c476728264 # Parent 5644f7c8982e805e53f56fcbfe0322e9de58a934# Parent 535fc8a2236542835d23dc37a1269e5079d680ba merge with stable diff -r 5644f7c8982e -r ef0baff11aea hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py Fri Aug 31 19:58:41 2018 +0100 +++ b/hgext/lfs/__init__.py Tue Oct 16 08:16:11 2018 -0400 @@ -237,13 +237,15 @@ if 'lfs' not in repo.requirements: def checkrequireslfs(ui, repo, **kwargs): - if 'lfs' not in repo.requirements: - last = kwargs.get(r'node_last') - _bin = node.bin - if last: - s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) - else: - s = repo.set('%n', _bin(kwargs[r'node'])) + if 'lfs' in repo.requirements: + return 0 + + last = kwargs.get(r'node_last') + _bin = node.bin + if last: + s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) + else: + s = repo.set('%n', _bin(kwargs[r'node'])) match = repo.narrowmatch() for ctx in s: # TODO: is there a way to just walk the files in the commit? diff -r 5644f7c8982e -r ef0baff11aea tests/test-lfs-serve.t --- a/tests/test-lfs-serve.t Fri Aug 31 19:58:41 2018 +0100 +++ b/tests/test-lfs-serve.t Tue Oct 16 08:16:11 2018 -0400 @@ -244,6 +244,30 @@ $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !) $TESTTMP/server/.hg/requires:lfs (lfsremote-on !) +Test that the commit/changegroup requirement check hook can be run multiple +times. + + $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3 + + $ cd ../cmdserve_client3 + + >>> from __future__ import absolute_import + >>> from hgclient import check, readchannel, runcommand + >>> @check + ... def addrequirement(server): + ... readchannel(server) + ... # change the repo in a way that adds the lfs requirement + ... runcommand(server, ['pull', '-qu']) + ... # Now cause the requirement adding hook to fire again, without going + ... # through reposetup() again. + ... with open('file.txt', 'wb') as fp: + ... fp.write('data') + ... runcommand(server, ['ci', '-Aqm', 'non-lfs']) + *** runcommand pull -qu + *** runcommand ci -Aqm non-lfs + + $ cd ../client + The difference here is the push failed above when the extension isn't enabled on the server. $ hg identify http://localhost:$HGPORT