Mercurial > hg
comparison hgext/largefiles/reposetup.py @ 28876:79b8f052ee51
localrepo: refactor prepushoutgoinghook to take a pushop
prepushoutgoinghook was introduced in 6c383c871fdb and largefiles is the only
in-tree use of it. Refactor it to be more useful for other use cases in
largefiles.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 13 Apr 2016 01:09:11 +0200 |
parents | 5c14af475f61 |
children | a75c9665ef06 |
comparison
equal
deleted
inserted
replaced
28875:2e9f5453ab5a | 28876:79b8f052ee51 |
---|---|
350 # Stack of status writer functions taking "*msg, **opts" arguments | 350 # Stack of status writer functions taking "*msg, **opts" arguments |
351 # like "ui.status()". Only last element ("_lfstatuswriters[-1]") | 351 # like "ui.status()". Only last element ("_lfstatuswriters[-1]") |
352 # is used to write status out. | 352 # is used to write status out. |
353 repo._lfstatuswriters = [ui.status] | 353 repo._lfstatuswriters = [ui.status] |
354 | 354 |
355 def prepushoutgoinghook(local, remote, outgoing): | 355 def prepushoutgoinghook(pushop): |
356 if outgoing.missing: | 356 if pushop.outgoing.missing: |
357 toupload = set() | 357 toupload = set() |
358 addfunc = lambda fn, lfhash: toupload.add(lfhash) | 358 addfunc = lambda fn, lfhash: toupload.add(lfhash) |
359 lfutil.getlfilestoupload(local, outgoing.missing, addfunc) | 359 lfutil.getlfilestoupload(pushop.repo, pushop.outgoing.missing, |
360 lfcommands.uploadlfiles(ui, local, remote, toupload) | 360 addfunc) |
361 lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload) | |
361 repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook) | 362 repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook) |
362 | 363 |
363 def checkrequireslfiles(ui, repo, **kwargs): | 364 def checkrequireslfiles(ui, repo, **kwargs): |
364 if 'largefiles' not in repo.requirements and any( | 365 if 'largefiles' not in repo.requirements and any( |
365 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()): | 366 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()): |