Ejemplo n.º 1
0
def reposetup(ui, repo):
    # Nothing to do with a remote repo
    if not repo.local():
        return

    threshold = repo.ui.configbytes("lfs", "threshold")

    repo.svfs.options["lfsthreshold"] = threshold
    if repo.ui.configbool("lfs", "localstore"):
        localstore = blobstore.local(repo)
    else:
        localstore = blobstoremod.memlocal()
    repo.svfs.lfslocalblobstore = localstore
    repo.svfs.lfsremoteblobstore = blobstore.remote(repo.ui)

    # Push hook
    repo.prepushoutgoinghooks.add("lfs", wrapper.prepush)

    if "lfs" not in repo.requirements:

        def checkrequireslfs(ui, repo, **kwargs):
            if "lfs" not in repo.requirements:
                ctx = repo[kwargs["node"]]
                # TODO: is there a way to just walk the files in the commit?
                if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
                    repo.requirements.add("lfs")
                    repo._writerequirements()

        ui.setconfig("hooks", "commit.lfs", checkrequireslfs, "lfs")
Ejemplo n.º 2
0
def _adhocstores(ui, url):
    """return local and remote stores for ad-hoc (outside repo) uses"""
    if url is not None:
        ui.setconfig("lfs", "url", url)
    return blobstoremod.memlocal(), blobstore.remote(ui)
Ejemplo n.º 3
0
def _handlebundle2part(orig, self, bundle, part):
    if part.type != bundleparts.snapshotmetadataparttype:
        return orig(self, bundle, part)
    self._snapshotbundlestore = blobstoremod.memlocal()
    for oid, data in bundleparts.binarydecode(part):
        self._snapshotbundlestore.write(oid, data)