Mercurial > hg-stable
changeset 40313:ef0baff11aea
merge with stable
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 16 Oct 2018 08:16:11 -0400 |
parents | 5644f7c8982e (current diff) 535fc8a22365 (diff) |
children | 73c2b9c9cd3c |
files | hgext/lfs/__init__.py tests/test-lfs-serve.t |
diffstat | 2 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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?
--- 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