pass def mount(cell, mode="rw"): filename = os.path.join(mount_dir, cell._path[-1]) + ".txt" auth = "file" if "r" in mode else "cell" cell.mount(filename, mode=mode, authority=auth, persistent=True) ctx = Context() ctx.include(mylib.merge) ctx.upstream = Cell("text").set("Initial version") mount(ctx.upstream) ctx.modified = Cell("text") mount(ctx.modified) ctx.conflict = Cell("text") mount(ctx.conflict) ctx.merged = Cell("text") mount(ctx.merged, "w") ctx.state = Cell("str") mount(ctx.state, "w") ctx.compute() ctx.merge = ctx.lib.merge( upstream=ctx.upstream, modified=ctx.modified, conflict=ctx.conflict, merged=ctx.merged,
merge.io.handle.add_validator(validate_fallback) merge.code_start = set_resource("cell-merge-START.py") merge.code_update = set_resource("cell-merge-UPDATE.py") merge.code_stop = "" # Public cells ctx.upstream = Cell() ctx.upstream.celltype = "text" merge.upstream = ctx.upstream ctx.modified = Cell() ctx.modified.celltype = "text" ctx.link_modified = Link(ctx.modified, merge.modified) ctx.conflict = Cell() ctx.conflict.celltype = "text" ctx.link_conflict = Link(ctx.conflict, merge.conflict) ctx.fallback = merge.fallback.value ctx.fallback.celltype = "text" merge.fallback = ctx.fallback ctx.merged = merge.merged ctx.merged.celltype = "text" if __name__ == "__main__": #Mounting of graph and cells import os, tempfile mount_dir = os.path.join(tempfile.gettempdir(), "seamless-merge")