Mercurial > hg
changeset 35735:693e3bcae19e
lfs: defer registering the pre-push hook until blobs are committed
The hook searches outgoing commits for blobs, and uploads them before letting
the push occur. No reason to search for that which isn't there.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 18 Jan 2018 21:18:10 -0500 |
parents | b4e1d0654736 |
children | 29f57ce416ed |
files | hgext/lfs/__init__.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/lfs/__init__.py Thu Jan 18 18:04:56 2018 -0500 +++ b/hgext/lfs/__init__.py Thu Jan 18 21:18:10 2018 -0500 @@ -160,9 +160,6 @@ repo.svfs.lfslocalblobstore = blobstore.local(repo) repo.svfs.lfsremoteblobstore = blobstore.remote(repo) - # Push hook - repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) - class lfsrepo(repo.__class__): @localrepo.unfilteredmethod def commitctx(self, ctx, error=False): @@ -185,10 +182,13 @@ if any(ctx[f].islfs() for f in ctx.files() if f in ctx): repo.requirements.add('lfs') repo._writerequirements() + repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) break ui.setconfig('hooks', 'commit.lfs', checkrequireslfs, 'lfs') ui.setconfig('hooks', 'pretxnchangegroup.lfs', checkrequireslfs, 'lfs') + else: + repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) def _trackedmatcher(repo, ctx): """Return a function (path, size) -> bool indicating whether or not to