[PATCH 2 of 3] lfs: prefetch lfs blobs when applying merge updates
Yuya Nishihara
yuya at tcha.org
Mon Feb 5 08:44:50 EST 2018
On Sun, 04 Feb 2018 01:18:24 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1517711172 18000
> # Sat Feb 03 21:26:12 2018 -0500
> # Node ID e779b0c34d6989e45cabbf8da8cdfeb060134dbd
> # Parent 359c61b92d8b47b866a8b527829643f45bba8970
> lfs: prefetch lfs blobs when applying merge updates
Seems good, but a couple of nits.
> --- a/hgext/lfs/wrapper.py
> +++ b/hgext/lfs/wrapper.py
> @@ -249,6 +249,34 @@
> if 'lfs' in destrepo.requirements:
> destrepo.vfs.append('hgrc', util.tonativeeol('\n[extensions]\nlfs=\n'))
>
> +def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite, labels):
Nit: labels=None for API compatibility.
> + """Ensure that the required LFS blobs are present before applying updates,
> + fetching them as a group if needed.
> +
> + This has the effect of ensuring all necessary LFS blobs are present before
> + making working directory changes during an update (including after clone and
> + share) or merge."""
> +
> + pointers = []
> + localstore = repo.svfs.lfslocalblobstore
> +
> + # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they
> + # don't touch mctx. 'cd' is skipped, because changed/deleted never resolves
> + # to something from the remote side.
> + for a in 'g dc dg m'.split():
> + l = actions[a]
> + if len(l) > 0:
Any reason to test the length here?
> + for f, msg, args in l:
^^^^^^^^^^^^
f, args, msg
> + p = pointerfromctx(mctx, f)
> + if p and not localstore.has(p.oid()):
> + p.filename = f
> + pointers.append(p)
> +
> + if pointers:
> + repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore)
> +
> + return orig(repo, actions, wctx, mctx, overwrite, labels)
More information about the Mercurial-devel
mailing list