Skip to content

Comment on Google copybara: moving code between repositories

Comments

I already shared git-fetch-file in another comment here, but the .git-remote-files manifests seem a lot nicer than whatever this thing does:

    [file "lib/util.py" from "https://github.com/example/tools.git"]
    commit = a1b2c3d4e5f6789abcdef0123456789abcdef01
    branch = master
    comment = Common utility function

    [file "config.json" from "https://github.com/example/tools.git"]
    commit = b2c3d4e5f6789abcdef0123456789abcdef012
    branch = master
    target = vendor
    comment = Configuration from tools repo

    [file "helper.js" from "https://github.com/another/project.git"]
    commit = c3d4e5f6789abcdef0123456789abcdef0123
    branch = main
    comment = Helper from another project
vs
    core.workflow(
        name = "default",
        origin = git.github_origin(
        url = "https://github.com/google/copybara.git",
        ref = "master",
        ),
        destination = git.destination(
            url = "file:///tmp/foo",
        ),

        # Copy everything but don't remove a README_INTERNAL.txt file if it exists.
        destination_files = glob(["third_party/copybara/**"], exclude = ["README_INTERNAL.txt"]),

        authoring = authoring.pass_thru("Default email <default@default.com>"),
        transformations = [
            core.replace(
                    before = "//third_party/bazel/bashunit",
                    after = "//another/path:bashunit",
                    paths = glob(["**/BUILD"])),
            core.move("", "third_party/copybara")
        ],
    )
There seems to be an absolute ton of reference at https://github.com/google/copybara/blob/master/docs/referenc..., whereas I feel like all the people using git-fetch-file just want files from other repos, and sometimes to make some changes on those.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.