def prepushoutgoinghook(pushop): """Push largefiles for pushop before pushing revisions.""" lfrevs = pushop.lfrevs if lfrevs is None: lfrevs = pushop.outgoing.missing if lfrevs: toupload = set() addfunc = lambda fn, lfhash: toupload.add(lfhash) lfutil.getlfilestoupload(pushop.repo, lfrevs, addfunc) lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload)
def outgoinghook(ui, repo, other, opts, missing): if opts.pop('large', None): toupload = set() lfutil.getlfilestoupload(repo, missing, lambda fn, lfhash: toupload.add(fn)) if not toupload: ui.status(_('largefiles: no files to upload\n')) else: ui.status(_('largefiles to upload:\n')) for file in sorted(toupload): ui.status(lfutil.splitstandin(file) + '\n') ui.status('\n')
def _getoutgoings(repo, other, missing, addfunc): """get pairs of filename and largefile hash in outgoing revisions in 'missing'. largefiles already existing on 'other' repository are ignored. 'addfunc' is invoked with each unique pairs of filename and largefile hash value. """ knowns = set() lfhashes = set() def dedup(fn, lfhash): k = (fn, lfhash) if k not in knowns: knowns.add(k) lfhashes.add(lfhash) lfutil.getlfilestoupload(repo, missing, dedup) if lfhashes: lfexists = basestore._openstore(repo, other).exists(lfhashes) for fn, lfhash in knowns: if not lfexists[lfhash]: # lfhash doesn't exist on "other" addfunc(fn, lfhash)
def summaryremotehook(ui, repo, opts, changes): largeopt = opts.get('large', False) if changes is None: if largeopt: return (False, True) # only outgoing check is needed else: return (False, False) elif largeopt: url, branch, peer, outgoing = changes[1] if peer is None: # i18n: column positioning for "hg summary" ui.status(_('largefiles: (no remote repo)\n')) return toupload = set() lfutil.getlfilestoupload(repo, outgoing.missing, lambda fn, lfhash: toupload.add(fn)) if not toupload: # i18n: column positioning for "hg summary" ui.status(_('largefiles: (no files to upload)\n')) else: # i18n: column positioning for "hg summary" ui.status(_('largefiles: %d to upload\n') % len(toupload))
def prepushoutgoinghook(local, remote, outgoing): if outgoing.missing: toupload = set() addfunc = lambda fn, lfhash: toupload.add(lfhash) lfutil.getlfilestoupload(local, outgoing.missing, addfunc) lfcommands.uploadlfiles(ui, local, remote, toupload)