##// END OF EJS Templates
lfs: avoid a potential variable reference before assignment error in cmdserver...
Matt Harbison -
r40184:535fc8a2 stable
parent child Browse files
Show More
@@ -229,13 +229,15 b' def reposetup(ui, repo):'
229
229
230 if 'lfs' not in repo.requirements:
230 if 'lfs' not in repo.requirements:
231 def checkrequireslfs(ui, repo, **kwargs):
231 def checkrequireslfs(ui, repo, **kwargs):
232 if 'lfs' not in repo.requirements:
232 if 'lfs' in repo.requirements:
233 last = kwargs.get(r'node_last')
233 return 0
234 _bin = node.bin
234
235 if last:
235 last = kwargs.get(r'node_last')
236 s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last))
236 _bin = node.bin
237 else:
237 if last:
238 s = repo.set('%n', _bin(kwargs[r'node']))
238 s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last))
239 else:
240 s = repo.set('%n', _bin(kwargs[r'node']))
239 match = repo.narrowmatch()
241 match = repo.narrowmatch()
240 for ctx in s:
242 for ctx in s:
241 # TODO: is there a way to just walk the files in the commit?
243 # TODO: is there a way to just walk the files in the commit?
@@ -220,6 +220,30 b" should have an 'lfs' requirement after i"
220 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
220 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
221 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
221 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
222
222
223 Test that the commit/changegroup requirement check hook can be run multiple
224 times.
225
226 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3
227
228 $ cd ../cmdserve_client3
229
230 >>> from __future__ import absolute_import
231 >>> from hgclient import check, readchannel, runcommand
232 >>> @check
233 ... def addrequirement(server):
234 ... readchannel(server)
235 ... # change the repo in a way that adds the lfs requirement
236 ... runcommand(server, ['pull', '-qu'])
237 ... # Now cause the requirement adding hook to fire again, without going
238 ... # through reposetup() again.
239 ... with open('file.txt', 'wb') as fp:
240 ... fp.write('data')
241 ... runcommand(server, ['ci', '-Aqm', 'non-lfs'])
242 *** runcommand pull -qu
243 *** runcommand ci -Aqm non-lfs
244
245 $ cd ../client
246
223 The difference here is the push failed above when the extension isn't
247 The difference here is the push failed above when the extension isn't
224 enabled on the server.
248 enabled on the server.
225 $ hg identify http://localhost:$HGPORT
249 $ hg identify http://localhost:$HGPORT
General Comments 0
You need to be logged in to leave comments. Login now