[PATCH 5 of 6] lfs: infer the blob store URL from an explicit push source or default-push

Yuya Nishihara yuya at tcha.org
Mon Apr 9 09:43:24 EDT 2018


On Mon, 09 Apr 2018 00:26:45 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1523211732 14400
> #      Sun Apr 08 14:22:12 2018 -0400
> # Node ID b8c871c097d3153d1eb71e0072cb7edf3356360c
> # Parent  2aecf5b7dfdaeb12a6f6ac151d40c3b60f789abc
> lfs: infer the blob store URL from an explicit push source or default-push
> 
> Same idea as pull, but the push command needs to hold onto the '_subtopath'
> field slightly longer.  Since this code has already resolved an explicit path or
> 'default-push' or 'default', it seems reasonable to make this simple tweak to
> avoid recalculating that.

> +        opargs = dict(opts.get('opargs', {})) # copy opargs since it may mutate
> +        opargs.setdefault('pushvars', []).extend(opts.get('pushvars', []))
> +
> +        pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
> +                               newbranch=opts.get('new_branch'),
> +                               bookmarks=opts.get('bookmark', ()),
> +                               opargs=opargs)
> +        # _subtopath stays for this repo push to assist LFS server discovery
>      finally:
>          del repo._subtoppath
>  
> -    opargs = dict(opts.get('opargs', {})) # copy opargs since we may mutate it
> -    opargs.setdefault('pushvars', []).extend(opts.get('pushvars', []))
> -
> -    pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
> -                           newbranch=opts.get('new_branch'),
> -                           bookmarks=opts.get('bookmark', ()),
> -                           opargs=opargs)

Can't we wrap e.g. exchange.push/pull() to temporarily replace
repo.lfsremoteblobstore based on the remote repository?

I think the root problem is that we can't decide the remoteblobstore at
reposetup().


More information about the Mercurial-devel mailing list