[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 11:42:25 EDT 2018


On Mon, 9 Apr 2018 11:19:24 -0400, Matt Harbison wrote:
> 
> > On Apr 9, 2018, at 9:43 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> > 
> >> 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’ll take another look at it.  That was where I started, but it seemed confusing to pass in a path to blobstore.remote() (but only sometimes), and then use lfs.url or paths.default.  It also would require changing the parameters to uploadblobsfromrevs(), which is flagged as called by other (FB?) extensions. (Probably a path=None would work here.)

FWIW, thinking about paths.<name>:lfsurl, we might have to add a hook point to
commands.push/pull() such that a resolved "path" object can be intercepted.


More information about the Mercurial-devel mailing list