Git Product home page Git Product logo

copybara's Introduction

Copybara

A tool for transforming and moving code between repositories.

Copybara is a tool used internally at Google. It transforms and moves code between repositories.

Often, source code needs to exist in multiple repositories, and Copybara allows you to transform and move source code between these repositories. A common case is a project that involves maintaining a confidential repository and a public repository in sync.

Copybara requires you to choose one of the repositories to be the authoritative repository, so that there is always one source of truth. However, the tool allows contributions to any repository, and any repository can be used to cut a release.

The most common use case involves repetitive movement of code from one repository to another. Copybara can also be used for moving code once to a new repository.

Examples uses of Copybara include:

  • Importing sections of code from a confidential repository to a public repository.

  • Importing code from a public repository to a confidential repository.

  • Importing a change from a non-authoritative repository into the authoritative repository. When a change is made in the non-authoritative repository (for example, a contributor in the public repository), Copybara transforms and moves that change into the appropriate place in the authoritative repository. Any merge conflicts are dealt with in the same way as an out-of-date change within the authoritative repository.

One of the main features of Copybara is that it is stateless, or more specifically, that it stores the state in the destination repository (As a label in the commit message). This allows several users (or a service) to use Copybara for the same config/repositories and get the same result.

Currently, the only supported type of repository is Git. Copybara is also able to read from Mercurial repositories, but the feature is still experimental. The extensible architecture allows adding bespoke origins and destinations for almost any use case. Official support for other repositories types will be added in the future.

Example

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 <[email protected]>"),
    transformations = [
        core.replace(
                before = "//third_party/bazel/bashunit",
                after = "//another/path:bashunit",
                paths = glob(["**/BUILD"])),
        core.move("", "third_party/copybara")
    ],
)

Run:

$ (mkdir /tmp/foo ; cd /tmp/foo ; git init --bare)
$ copybara copy.bara.sky

Getting Started using Copybara

Copybara doesn't have a release process yet, so you need to compile from HEAD. In order to do that, you need to do the following:

  • Install JDK 11.
  • Install Bazel.
  • Clone the copybara source locally:
    • git clone https://github.com/google/copybara.git
  • Build:
    • bazel build //java/com/google/copybara
    • bazel build //java/com/google/copybara:copybara_deploy.jar to create an executable uberjar.
  • Tests: bazel test //... if you want to ensure you are not using a broken version. Note that certain tests require the underlying tool to be installed(e.g. Mercurial, Quilt, etc.). It is fine to skip those tests if your Pull Request is unrelated to those modules (And our CI will run all the tests anyway).

System packages

These packages can be installed using the appropriate package manager for your system.

Arch Linux

Using Intellij with Bazel plugin

If you use Intellij and the Bazel plugin, use this project configuration:

directories:
  copybara/integration
  java/com/google/copybara
  javatests/com/google/copybara
  third_party

targets:
  //copybara/integration/...
  //java/com/google/copybara/...
  //javatests/com/google/copybara/...
  //third_party/...

Note: configuration files can be stored in any place, even in a local folder. We recommend using a VCS (like git) to store them; treat them as source code.

Building Copybara in an external Bazel workspace

There are convenience macros defined for all of Copybara's dependencies. Add the following code to your WORKSPACE file, replacing {{ sha256sum }} and {{ commit }} as necessary.

http_archive(
  name = "com_github_google_copybara",
  sha256 = "{{ sha256sum }}",
  strip_prefix = "copybara-{{ commit }}",
  url = "https://github.com/google/copybara/archive/{{ commit }}.zip",
)

load("@com_github_google_copybara//:repositories.bzl", "copybara_repositories")

copybara_repositories()

load("@com_github_google_copybara//:repositories.maven.bzl", "copybara_maven_repositories")

copybara_maven_repositories()

load("@com_github_google_copybara//:repositories.go.bzl", "copybara_go_repositories")

copybara_go_repositories()

You can then build and run the Copybara tool from within your workspace:

bazel run @com_github_google_copybara//java/com/google/copybara -- <args...>

Using Docker to build and run Copybara

NOTE: Docker use is currently experimental, and we encourage feedback or contributions.

You can build copybara using Docker like so

docker build --rm -t copybara .

Once this has finished building, you can run the image like so from the root of the code you are trying to use Copybara on:

docker run -it -v "$(pwd)":/usr/src/app copybara help

Environment variables

In addition to passing cmd args to the container, you can also set the following environment variables as an alternative:

  • COPYBARA_SUBCOMMAND=migrate
    • allows you to change the command run, defaults to migrate
  • COPYBARA_CONFIG=copy.bara.sky
    • allows you to specify a path to a config file, defaults to root copy.bara.sky
  • COPYBARA_WORKFLOW=default
    • allows you to specify the workflow to run, defaults to default
  • COPYBARA_SOURCEREF=''
    • allows you to specify the sourceref, defaults to none
  • COPYBARA_OPTIONS=''
    • allows you to specify options for copybara, defaults to none
docker run \
    -e COPYBARA_SUBCOMMAND='validate' \
    -e COPYBARA_CONFIG='other.config.sky' \
    -v "$(pwd)":/usr/src/app \
    -it copybara

Git Config and Credentials

There are a number of ways by which to share your git config and ssh credentials with the Docker container, an example is below:

docker run \
    -v ~/.gitconfig:/root/.gitconfig:ro \
    -v ~/.ssh:/root/.ssh \
    -v ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK} -e SSH_AUTH_SOCK
    -v "$(pwd)":/usr/src/app \
    -it copybara

Documentation

We are still working on the documentation. Here are some resources:

Contact us

If you have any questions about how Copybara works, please contact us at our mailing list.

Optional tips

  • If you want to see the test errors in Bazel, instead of having to cat the logs, add this line to your ~/.bazelrc:

    test --test_output=streamed
    

copybara's People

Contributors

12wrigja avatar adonovan avatar amralaa10 avatar androbin avatar benjaminp avatar chris-campos avatar chriscrisscross avatar cpovirk avatar cushon avatar darthhater avatar denian avatar durin42 avatar gmngeoffrey avatar hagbard avatar hsudhof avatar ittaiz avatar jessieliu1 avatar jeyoungk avatar jordanlin00 avatar joshgoldman-google avatar kluever avatar martyrubin avatar matvore avatar mering avatar mikaylahutchinson avatar mikelalcon avatar ovidiugrigore avatar qfc avatar vladmos avatar yannic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

copybara's Issues

metadata.add_header() documentation incorrectly formatted

In the metadata.add_header() documentation, the last code block for Add a header that uses a label is improperly closed. The "```" is at the end of a line instead of on its own line. This causes the block to extend to the end of the first block in the next subsection.

It's a minor issue but docs are important. :)

should copybara info (or a related sibling) use the same semantics migrate does?

Currently one can think there are pending changes when migrate will fail (for example when you have empty commits).
@mikelalcon referenced this in #3 when he wrote: "Ideally we should honor origin_files. At least the glob roots. Would be great if we could honor the excludes too.
Probably this involves an option to origin.changes() to return the list of files in a change too."
Maybe what we need is "expensive info" since it will cost more or "migrate --dry-run" to reflect the pending commits

Is there a way to pass a GitHub API Token?

I am getting rate limited by GitHub when moving a bunch of commits:

% copybara copy.bara.sky export_to_github_pr
Nov 06, 2019 4:16:36 PM com.google.copybara.Main configureLog
INFO: Setting up LogManager
Copybara source mover (Version: Unknown version)
...
ERROR: Migration of origin revision '<commit_sha1>' failed with error: GitHub API call failed with code 403 The request was GET <redacted> Response:
{"message":"API rate limit exceeded for <ip_address>. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://developer.github.com/v3/#rate-limiting"}

Excluding Files

I tried to copy a Java project repository (GitHub) from one to another and I want to exclude some files in the original repository when moving it as well. I tried to add those files to exclude array but I still see the files are being copied to the new repository. Can you add a good example on how to do this?

Thanks!

Maybe not the most appropriate use of an issue, but I just wanted to let you know we've been using Copybara over at @sonatype for exporting our community projects. I've yet to bring any code in yet, but the export has been great. Thanks for creating this, and pass this on!

getInfo returns changes `getAvailableToMigrate` for the ones which already migrated

Hi,

we are using copybara as embedded one.
our use case next:

  1. we are using .getInfo for getting list of changes that available for migration
  2. if there are some changes -> notify user about it
  3. user triggering migration process
  4. our service creating branch
  5. migrating code to this branch
  6. opening PR
  7. merge with rebase if passing checks

problem that .getInfo provides list of changes available to migrate even when they already migrated. we are using lastRevision as starting point, but no updating it after migration.
I know that we are doing something wrong which not allowed to get info correctly.

migration for this case throwing expected exception Iterative workflow produced no changes in the destination for resolved ref:

I know that it's not trivial use case of copybara, but I would really appreciate if you will advice something.

Thanks!!!

Cheers,
Pavel

Publish copybara to maven central

Hi folks!

So we are gearing up to use this internally in a more than "Jeffry runs it on his laptop occasionally" sort of manner. We were curious if this project can get published to maven central so that we can fetch it (and new versions in the future) for use in stuff like Jenkins, etc...

Thanks again for all the great work, we've gotten a good amount of utility out of this and it's rad that you contributed this out to the open source world!

Working with LFS repositries

Hi there,

Can copybara operate with repositories with files managed by Git LFS? My scenario is as follows:

  • I have a private repository on github that has many artifacts (some of which are large files which are managed by LFS). This repository acts as a source repository.
  • I also have another private repository on github which acts as the target repository.
  • The source repository gets frequent pushes, and from time to time we need to selectively copy certain files from it to the target repository.
  • when using copybara to do so, we get an error message during the task: "Git Destination: Checking out master":
Error downloading object: (...): batch request: missing protocol: ""
Errors logged to (...)
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: (...): smudge filter lfs failed

which seems as a problem with relevant to git-lfs.

So does copybara support repositories with LFS-managed files?

Unable to migrate a new github repo

I am trying to migrate an existing local git repo to a fresh github repo and I am getting the following error:

ERROR: Previous revision label GitOrigin-RevId could not be found in GitDestination{repoUrl=https://github.com/jawsthegame/myrepo.git, fetch=master, push=master} and --last-rev or --init-history flags were not passed

Adding those flags doesn't change the result, and I am using --force.

I have also tried initializing the github repo with a README, still no luck.

Has anyone else seen this issue?

Files already exist in <location> when migrating a repo.

Ok, back again :)

I was able to get copybara working using the copybara repo, and now I'm switching over to the @sonatype repo I want to migrate to a public one.

I'm running copybara copy.bara.sky --force

My copy.bara.sky looks like:

url = "[email protected]:sonatype/INTERNAL_REPO.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = url,
        ref = "master",
    ),
    destination = git.destination(
        url = "file:///tmp/foo",
        fetch = "master",
        push = "master",
    ),
    destination_files = glob(["matthew/py-iq-reports/IQreport/**"], exclude = ["README_INTERNAL.txt"]),

    authoring = authoring.pass_thru("Jeffry Hesse <[email protected]>"),
    transformations = [
	    core.move("", ""),
	],
)

I end up with this:

764 jeffryhesse:IQreport (master *)$ copybara copy.bara.sky --force
Copybara source mover (Version: Unknown version)
Task: Git Origin: Initializing local repo
Enter passphrase for key '/Users/jeffryhesse/.ssh/id_rsa': 
WARN: Cannot find last imported revision, but proceeding because of --force flag
Task: Moving 
ERROR: Files already exist in /Users/jeffryhesse/copybara/temp/workdir2564596437170999916/checkout:

I've truncated the filelist since it's a lot of internal stuff, plus likely not going to give much actual detail on the issue. I'm not sure what's quite going on here, and I'm sure I'm missing something. Any help is appreciated.

Loading copybara into another bazel WORKSPACE

I'm trying to load Copybara into my internal Bazel WORKSPACE.
I added a http_archive statement to my WORKSPACE file:

http_archive(
    name = "copybara",
    url = "https://github.com/google/copybara/archive/4f8904964283a405beb9612eb30a5ef693d3f4f3.zip",
    type = "zip",
    sha256 = "b5f321ebc4932ed9b5673b80ea88fcccfad93dce68c76c81ce306c1ebf2b6b34",
    strip_prefix = "copybara-4f8904964283a405beb9612eb30a5ef693d3f4f3"
)

and then trying to build copybara: bazel build @copybara//java/com/google/copybara:copybara. At which point I get an error:

ERROR: Analysis of target โ€˜@copybara//java/com/google/copybara:copybaraโ€™ failed; build aborted: no such package โ€˜@flogger//jarโ€™: The repository could not be resolved
INFO: Elapsed time: 0.194s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

I know this is not the main use-case of Copybara, but by having copybara part of my repo (as in, defined and pinned in my WORKSPACE file), I will be able to more easily create run targets that use Copybara.

First time importing pull request from public to private

Hello!

I'm stuck on importing PRs.

  • I have private and public repositories.
  • Before release I need to import some PRs from public to private repository. There have been zero migrations using Copybara before and repositories have zero commits in common.
  • Copybara obviously cannot find parent commit. I tell it to use latest master commit as parent and it replaces new code in private with the old one from public which is not the part of the PR.

But I need to migrate only PR changes. I think I can use something like patch. Is there any solutions for doing it using Copybara?

Here's my current config:

core.workflow(
  name = "import_pr_from_oss",

  origin = git.github_pr_origin(
    url = publicRepoUrl,
    state = "ALL",
    use_merge = True,
  ),
  destination = git.github_pr_destination(
    url = internalRepoUrl,
    destination_ref = "master-internal", # TODO: Update to master after test
    integrates = [],
  ),
  mode = "CHANGE_REQUEST",
  set_rev_id = False,

  authoring = authoring.pass_thru("**authoring here**"),

  # Including/excluding files
  origin_files = glob(["**"], exclude = [

    # exclude hidden files
    ".**",
    "**/.**",

    # exclude all private sources
    "private/**",

    # exclude helper scripts and related
    "**.sh",
    "**.log",
    "**.rc",
    "revision.txt",

    # exclude generated bits
    "**/target/**",
    "**/node_modules/**",

  ]) + glob([

    # keep some specified files
    ".circleci/config.yml",
    "**/.placeholder",
    ".mvn/**",
  ]),

  destination_files = glob(["**"], exclude = [

    # exclude hidden files
    ".**",
    "**/.**",

    # exclude all private sources
    "private/**",

    # exclude helper scripts and related
    "**.sh",
    "**.log",
    "**.rc",
    "revision.txt",

    # exclude generated bits
    "**/target/**",
    "**/node_modules/**",
  ]) + glob([

    # keep some specified files
    ".circleci/config.yml",
    "**/.placeholder",
    ".mvn/**",
  ]),

  transformations = [
    metadata.save_author(),
    metadata.expose_label("COPYBARA_INTEGRATE_REVIEW")
    metadata.replace_message("${GITHUB_PR_TITLE}\n\n${GITHUB_PR_BODY}\n\nSubmitted by: @${GITHUB_PR_USER}\n\nExternal PR number: #${GITHUB_PR_NUMBER}"),
  ],

Thank you!

Can't set lastRevision programatically

To use Copybara programatically one needs the ability to pass the lastRevision.
Currently I think that's not possible.

val generalOptions =  new GeneralOptions(
      System.getenv(),
      FileSystems.getDefault,
      VerboseLoggingOff,
      LogConsole.writeOnlyConsole(System.out, VerboseLoggingOff)
val options = new Options((moduleSupplier.newOptions().asScala :+ generalOptions).asJava)
options.get(classOf[WorkflowOptions]).lastRevision = lastRev //visibility problem

copybara: command not found

Hi, I am installing copybara on Centos 7 according to your documentation. But in the end, I am taking "copybara: command not found" error. How can I solve this problem?

Pull requests and confidential blocks

There is an example in the documentation which uses core.replace to remove a confidential block.
This transformation works perfectly fine in one direction. But I don't understand how to make it work with pull requests.

Such transformation is not reversible. So if pull modifies a file with a cofidential block, then the block itself gets removed.

Is there some easy way to apply such pull requests with copybara?

destination_files behaviour

I am attempting to use copybara to migrate many standalone repos into a monorepo, and use copybara to keep them in step while we are in the process of migration. However I am hitting an issue with the behaviour of destination_files, or perhaps my understanding of it.

The following in the config used

core.workflow(
    name = "default",
    origin = git.origin(
        url = origin_url,
        ref = "master",
    ),
    destination = git.destination(
        url = dest_url,
        fetch = "master",
        push = "copybara/microtime_import",
    ),
    ask_for_confirmation = True,
    destination_files = glob(["libs/microtime/**"]),
    origin_files = glob(["**"]),
    authoring = authoring.pass_thru("Copybara <cc@internal>"),
    transformations = [
	    core.move("", "libs/microtime"),
    ],
)

When this runs, it removes all other files in the destination repo, unless they are matched by an exclude in destination_files, which seems to go against the line in the docs:

A glob relative to the root of the destination repository that matches files that are part of the migration. Files NOT matching this glob will never be removed, even if the file does not exist in the source.

How can I get copybara to import from the the origin repo and only affect the destination folder?
Using copybara built from ea42789

Add default http.useragent flag

Hi Copybara team,

I'd like to be able to identify calls to our Git service which come from your awesome tool. The simplest way to do this seems to be adding a default http.useragent="copybara" flag in the Git command line you build.

Does that sound OK? A quick look through your code suggests that shouldn't be to hard.

Thanks!

Usage question

I'm evaluating Copybara but the lack of documentation makes it a bit hard to understand some basic concepts.

Let's suppose there a private repo A and a public repo B, both hosted on Github. B is a filtered version of A, in the sense that some files and folders are removed. Most work (internal) will happen on A, but some public contributions might happen on B as pull requests. My understanding so far is that I would have to setup webhooks on both repos. On A to mirror branches to B on commits, and on B to mirror PRs to A.

Is my understanding correct?

thank you for the product and your attention!

Merges as commits when first_parent=False

Hello,

I trying to bring gitlab support to copybara for my company, but in the process I discovered issue with git -> git synchronization.

In default configuration merges are squashed to single commit and in branch based workflows this disrupts whole git history, therefore I tried first_parent=False option in git.origin and it copies both sides of merge as it should, but it isn't able to copy merges, as they are treated as usual commits and they usually doesn't contain any changes.

This disrupts closing github PR when branch is merged on gitlab side and it caused also merge conflicts when on other branches after one of them was merged.

I tried to find a way to fix that in cohybara source code, but it looks like isMerge info is lost many calls up in stack trace before it reaches writer.

authoring not working

We want to use copybara with Gitlab. The workflow I imagine, since copybare doesn't support Gitlab as good as Github, is the following:

  1. A user creates a pull request on the external repo.
  2. We use copybara to copy (CHANGE_REQUEST) the branch of the pull request to our internal repo.
  3. We do a pull request.
  4. We merge this pull request.
  5. We sync back (ITERATIVE) our internal source to the external repo.

However, I tried this and the only thing that gets displayed at the external repo is a commit of the "Merge branch 'external-001' into 'master'". There is no sign of the original author or of the original commit of the author.

I only see the commit of the original author in our internal repo.

My copy.bara.sky looks like this:

internalUrl = "[email protected]:example/internal_test_repo.git"
externalUrl = "[email protected]:example/external_test_repo.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = internalUrl,
        ref = "master",
    ),
    destination = git.destination(
        url = externalUrl,
        fetch = "master",
        push = "master",
    ),
    origin_files = glob(["project_001/share_001/**", "project_001/share_002/**", "project_002/subproject_002/**", "external/README.md"], exclude = ["**/key.txt"]),

    destination_files = glob(["**"], exclude = ["external_only.txt"]),

    mode = "ITERATIVE",
    authoring = authoring.pass_thru(default = "Example <[email protected]>"),
    transformations = [
        # Move to root of OSS repo.
        core.move("external/README.md", "README.md"),
        core.move("project_002", ""),
        metadata.restore_author(label='ORIGINAL_AUTHOR', search_all_changes=True),
    ],
)
core.workflow(
    name = "import_branch",
    origin = git.origin(
        url = externalUrl,
        ref = "external-001"
    ),
    destination = git.destination(
        url = internalUrl,
        fetch = "master",
        push = "external/external-001",
    ),
    origin_files = glob(["**"], exclude = ["bla.txt"]),

    destination_files = glob(["project_001/share_001/**", "project_001/share_002/**", "project_002/subproject_002/**", "external/README.md"], exclude = ["**/key.txt"]),

    mode = "CHANGE_REQUEST",
    authoring = authoring.pass_thru(default = "Example <[email protected]>"),
    transformations = [
        # Move from root of OSS repo.
        core.move("README.md", "external/README.md"),
        core.move("subproject_002", "project_002/subproject_002"),
        metadata.save_author(label='ORIGINAL_AUTHOR'),
    ],
)

Document building copybara uberjar (copybara_deploy.jar)

Most users will probably want to build not with the command in the README.md, but instead use

bazel build //java/com/google/copybara:copybara_deploy.jar

This produces an uberjar at

[,,,]
Target //java/com/google/copybara:copybara_deploy.jar up-to-date:
  bazel-bin/java/com/google/copybara/copybara_deploy.jar
[....]

I believe this is the typical way how one would want to build copybara. Figuring this out may be needlessly difficult for people unfamiliar with the build system.

Published docker image?

It would be super helpful to have a copy of the latest master or release published as a docker image to Docker Hub or Google Container Registry so others can simply docker pull rather than rebuilding. It seems others have copybara images built, so it would be nice to have an official mirror.

How to overlay a file such as README.md

Hi there Copybara friends!

I'm working on another project using this fabulous tool, and I was wondering about a particular use case and how to best accomplish it.

core.workflow(
    name = "default",
    origin = git.origin(
        url = sourceUrl,
        ref = "master",
    ),
    destination = git.destination(
        url = destinationUrl,
        fetch = "master",
        push = "master",
    ),
    mode = "ITERATIVE",
    # Change path to the folder you want to publish publicly
    origin_files = glob(["**"], exclude = ["copy.bara.sky", ".copybara/**", "Jenkinsfile", "README.md"]),
    destination_files = glob(["**"]),

    authoring = authoring.pass_thru("THIS GUY <[email protected]>"),
    transformations = [
      metadata.squash_notes(prefix = 'Public export of code:\n\n', show_description = False),
      core.copy(".copybara/public", "", paths = glob(["README.md"]))
    ],
)

I was wondering if this is the best way to accomplish overlaying a public README.md from an internal repo. I'm asking this publicly because I'm not 100% sure how to dry run the copybara stuff and see what a public repo will look like, and as well to just see if there is a better way to accomplish this. I think the core.replace stuff is a bit too granular, in this case replacing the file completely seems to make the most sense.

Thanks!

Submodule not registered registered in destination

When trying to copybara a repository with submodules in the origin, the git destination does not receive the submodule registered as such, i.e., the git submodule status returns nothing.
I've tried with 2 kinds of submodules, one in the workspace root and one nested, both reference a github repository and are named like their path.

Configuration:

  • copybara version 6e798f9 (HEAD on 2019-04-10)

  • git version 2.21.0

  • config

      core.workflow(
          name = "test",
          origin = git.origin(url = "file:///<path-to-origin>", ref = "HEAD", submodules = "RECURSIVE"),
          destination = git.destination("file:///<path-to-destination>", "<ref>"),
          origin_files = glob(["**"]),
          destination_files = glob(["**"]),
          mode = "ITERATIVE",
          authoring = authoring.pass_thru(default = ""),
      )
    

No new changes to import for resolved ref: ITERATIVE move

Having a bit of an issue getting copybara to move changes for an internal repo. We recreated an external repo and I keep getting this (external repo is empty). I imagine there is a local repo on my laptop that is keeping track of all this and is like "I ALREADY MOVED THIS!" but I don't know what it is to blow it away. Maybe I'm not right though :)

copy.bara.sky:

# Update these references to your orginzations repos
sourceUrl = "[email protected]:sonatype/nexus-repository-p2-internal.git"
destinationUrl = "[email protected]:sonatype/nexus-repository-p2.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = sourceUrl,
        ref = "master",
    ),
    destination = git.destination(
        url = destinationUrl,
        fetch = "master",
        push = "master",
    ),
    mode = "ITERATIVE",
    # Change path to the folder you want to publish publicly
    origin_files = glob(["**"], exclude = ["copy.bara.sky"]),
    destination_files = glob(["**"]),

    authoring = authoring.pass_thru("Me <[email protected]>"),
)
nexus-repository-p2-internal  master โœ…  ~/code/tools/copybara/bazel-bin/java/com/google/copybara/copybara copy.bara.sky --force --last-rev=8b55debc2b4820f5f287dde93afe4be1b969e793
Copybara source mover (Version: Unknown version)
Task: Git Origin: Initializing local repo
WARN: No new changes to import for resolved ref: 8b55debc2b4820f5f287dde93afe4be1b969e793

Appreciate any help, as per usual.

Any future for SSH git access with passphrase?

I see in the docs this is not supported, but wonder if its an eminent feature or a if there is a work around. I'm specifically using the docker integration to run copybara, but my ssh key has a pretty long passphrase.

(FTR I'm stoked this exists, its what I always hoped MOE would be, but this unlike MOE just worked pretty much OOTB, so thanks!)

Importing a Pull Request

Hi there!

I'm gearing up to do a demo of copybara for @sonatype tomorrow, and I was curious, what do you all do to import a pull request? I can add this to the docs as an example as well.

What I basically want to do is:

  • I have a private source repo
  • PR comes in from public destination repo
  • Run copybara to bring the PR in to the source repo (so we can noodle on it, make adjustments if we need to)
  • Merge that PR
  • Run copybara and have the changes make it out to the destination

I see some stuff around the source PR, etc... but figured I would ask more so about workflow related to this.

Thanks!

Include labels in GitHub PR body

Is there a way to add the labels of a change to the body of the PullRequest created by git.github_pr_destination?

If there isn't, I'd be happy to contribute a patch implementing this if that's something you'd want to support.

Integration tests fail if copybara is imported

//copybara/integration:reference_doc_test and //copybara/integration:tool_test fail due to wrong path if copybara is imported into other repo.

bazel test @copybara//...
[...]
@copybara//javatests/com/google/copybara/transform:metadata/RevisionMigratorTest PASSED in 0,0s
@copybara//javatests/com/google/copybara/util/console:ConsoleTest        PASSED in 0,0s
@copybara//javatests/com/google/copybara/util/console:ConsolesTest       PASSED in 0,0s
@copybara//javatests/com/google/copybara/util/console/testing:TestingConsoleTest PASSED in 0,0s
@copybara//copybara/integration:reference_doc_test                       FAILED in 0,9s
  /.../testlogs/external/copybara/copybara/integration/reference_doc_test/test.log
@copybara//javatests/com/google/copybara/git:GitDestinationTest          PASSED in 0,0s
  Stats over 5 runs: max = 0,0s, min = 0,0s, avg = 0,0s, dev = 0,0s
@copybara//copybara/integration:tool_test                                FAILED in 30 out of 30 in 0,6s
  Stats over 30 runs: max = 0,6s, min = 0,3s, avg = 0,3s, dev = 0,1s
  /.../testlogs/external/copybara/copybara/integration/tool_test/shard_29_of_30/test.log
[...]
  /.../testlogs/external/copybara/copybara/integration/tool_test/shard_14_of_30/test.log

Executed 68 out of 70 tests: 68 tests pass and 2 fail locally.
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
/.../external/copybara/copybara/integration/reference_doc_test.runfiles/XXX/external/copybara/copybara/integration/reference_doc_test: line 17: third_party/bazel/bashunit/unittest.bash: No such file or directory
/.../external/copybara/copybara/integration/reference_doc_test.runfiles/XXX/external/copybara/copybara/integration/reference_doc_test: line 37: run_suite: command not found

Unexpected merge importing a pull request

When trying to import a pull request using the workflow:

core.workflow(
    name = "import_pr",
    mode = "CHANGE_REQUEST",
    origin = git.github_pr_origin(
        url = github_public_url,
        branch = "master",
    ),
    destination = git.destination(
        url = github_sot_url,
        fetch = "master",
    ),
    origin_files = glob(["**"]),
    destination_files = glob(
        ["somedir/**"],
        exclude = [
            "somedir/bfile",
        ],
    ),
    authoring = authoring.pass_thru("Default email <[email protected]>"),
    transformations = [
        core.move("", "somedir"),
        metadata.save_author(),
        metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),
        metadata.expose_label("GITHUB_PR_NUMBER", new_name = "Closes", separator = " #"),
    ],
)

I get:

% copybara copy.bara.sky import_pr 1
Nov 09, 2019 2:51:27 PM com.google.copybara.Main configureLog
INFO: Setting up LogManager
Copybara source mover (Version: Unknown version)
Task: Integrating change from https://github.com/ob/cb-sot-public/pull/1 from ob:ob-patch-1 21171d13a57703bae681c45dd57b2e76bffb1ab5
ERROR: Conflict detected while rebasing /Users/obonilla/copybara/temp/workdir109556842962639907/checkout to d0b3be83ebc842c8dd6feae051391d7a82adf9b8. Please sync or update the change in the origin and retry. Git output was:
First, rewinding head to replay your work on top of it...
Applying: Project import generated by Copybara.
Applying: Project import generated by Copybara.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
CONFLICT (add/add): Merge conflict in .gitignore
Auto-merging .gitignore
Patch failed at 0002 Project import generated by Copybara.
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

However, that pull request didn't change the .gitignore file so I didn't expect this to be a problem.

SoT repo: https://github.com/ob/cb-sot, exported repo: https://github.com/ob/cb-sot-public, PR that I'm trying to import: https://github.com/ob/cb-sot-public/pull/1

I don't see why Copybara is trying to merge the two .gitignore files, are they treated specially by globs?

Mirroring tags between github repos

It isn't clear to me how to mirror tags between two github repositories. Our current workflow for exporting source looks like this:

core.workflow(
    name = "exportSourceToPublic",
    origin = git.github_origin(
        url = privateUrl,
        ref = "master",
    ),
    destination = git.github_destination(
        url = publicUrl,
        fetch = "master",
        push = "master",
    ),
    origin_files = filesToPublish,
    mode = "ITERATIVE",
    authoring = authoring.pass_thru(defaultAuthor),
    transformations = [
        metadata.restore_author(),
    ],
)

All of our tags are for commits on master. I assumed that I could simply run this with origin.ref = "refs/tags/<tag>" and destination.push = "refs/tags/<tag>". When I do this I get this output:

Task: Git Origin: Initializing local repo
WARN: No new changes to import for resolved ref: 1809e6d8aa53af7fa30146277f9b8740ab38771c

This makes sense as the commit already exists on destination:master, but I would still expect it to push it to the tag. Am I holding it wrong / is there a better way to handle this use case? Or is it a bug and it should still push to the tag?

InsecureRecursiveDeleteException: Issue when running on OS X

Hi there,

Trying to set this up on OS X 10.12.3 and anytime I run copybara, I get something akin to the following:

581 jeffryhesse:reports (master *)$ copybara copy.bara.sky 
Copybara source mover (Version: Unknown version)
Task: Cleaning working directory
ERROR: /Users/jeffryhesse/copybara/out/workdir101393186198424635: unable to guarantee security of recursive delete (com.google.common.io.InsecureRecursiveDeleteException: /Users/jeffryhesse/copybara/out/workdir101393186198424635: unable to guarantee security of recursive delete)

I'm a bit murky on how to resolve this issue. From my detective work (AKA using Google) all I've found is that exception is thrown when SecureDirectoryStream is not supported by the OS. I'm having trouble finding a list of supported OS for this purpose, and I'm also curious why it's not working on OS X, since Oracle does support Java in this context. This may be more of a Guava issue from what I can tell, but the use here seems to impede use of Copybara on OS X.

As well, in running bazel tests, these are the failures I get:

BazelTestRunner exiting with a return value of 1
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.

-- JVM shutdown starting at 2017-07-06 16:32:59 --

FAIL: //javatests/com/google/copybara/git:SubmodulesInDestinationTest (see /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/SubmodulesInDestinationTest/test.log).
INFO: Elapsed time: 30.382s, Critical Path: 20.58s
//copybara/integration:reference_doc_test                       (cached) PASSED in 0.2s
//javatests/com/google/copybara:CommandTest                     (cached) PASSED in 0.4s
//javatests/com/google/copybara:CoreReverseTest                 (cached) PASSED in 0.6s
//javatests/com/google/copybara:CoreTransformTest               (cached) PASSED in 0.6s
//javatests/com/google/copybara:ExamplesTest                    (cached) PASSED in 0.7s
//javatests/com/google/copybara:LabelFinderTest                 (cached) PASSED in 0.3s
//javatests/com/google/copybara:MainArgumentsTest               (cached) PASSED in 0.4s
//javatests/com/google/copybara:MainTest                        (cached) PASSED in 0.6s
//javatests/com/google/copybara:authoring/AuthorParserTest      (cached) PASSED in 0.3s
//javatests/com/google/copybara:authoring/AuthorTest            (cached) PASSED in 0.4s
//javatests/com/google/copybara:authoring/AuthoringTest         (cached) PASSED in 0.6s
//javatests/com/google/copybara/config:CapturingConfigFileTest  (cached) PASSED in 0.3s
//javatests/com/google/copybara/config:MapConfigFileTest        (cached) PASSED in 0.3s
//javatests/com/google/copybara/config:PathBasedConfigFileTest  (cached) PASSED in 0.4s
//javatests/com/google/copybara/config:SkylarkParserTest        (cached) PASSED in 0.7s
//javatests/com/google/copybara/config/base:SkylarkUtilTest     (cached) PASSED in 0.3s
//javatests/com/google/copybara:folder/FolderDestinationTest    (cached) PASSED in 0.7s
//javatests/com/google/copybara:folder/FolderOriginTest         (cached) PASSED in 0.7s
//javatests/com/google/copybara/git:GerritChangeFinderTest      (cached) PASSED in 0.3s
//javatests/com/google/copybara/git:GerritOptionsTest           (cached) PASSED in 0.3s
//javatests/com/google/copybara/git:GerritOriginTest            (cached) PASSED in 2.2s
//javatests/com/google/copybara/git:GitOriginSubmodulesTest     (cached) PASSED in 2.5s
//javatests/com/google/copybara/git:GitOriginTest               (cached) PASSED in 6.3s
//javatests/com/google/copybara/git:GitRepoTypeTest             (cached) PASSED in 1.3s
//javatests/com/google/copybara/git:RefspecTest                 (cached) PASSED in 0.5s
//javatests/com/google/copybara:modules/PatchTransformationTest (cached) PASSED in 0.6s
//javatests/com/google/copybara/profiler:ProfilerTest           (cached) PASSED in 0.4s
//javatests/com/google/copybara:testing/DummyOriginTest         (cached) PASSED in 0.5s
//javatests/com/google/copybara:testing/SkylarkTestExecutorTest (cached) PASSED in 0.6s
//javatests/com/google/copybara/transform:ExplicitReversalTest  (cached) PASSED in 0.4s
//javatests/com/google/copybara/transform:MoveTest              (cached) PASSED in 0.7s
//javatests/com/google/copybara/transform:ReplaceTest           (cached) PASSED in 0.7s
//javatests/com/google/copybara/transform:SequenceTest          (cached) PASSED in 0.5s
//javatests/com/google/copybara/transform:VerifyMatchTest       (cached) PASSED in 0.7s
//javatests/com/google/copybara/transform:metadata/RevisionMigratorTest (cached) PASSED in 0.8s
//javatests/com/google/copybara:treestate/TreeStateTest         (cached) PASSED in 0.5s
//javatests/com/google/copybara:util/DiffUtilTest               (cached) PASSED in 0.4s
//javatests/com/google/copybara:util/FileUtilTest               (cached) PASSED in 0.5s
//javatests/com/google/copybara:util/GlobTest                   (cached) PASSED in 0.7s
//javatests/com/google/copybara:util/RenameDetectorTest         (cached) PASSED in 0.4s
//javatests/com/google/copybara/util/console:ConsoleTest        (cached) PASSED in 0.4s
//javatests/com/google/copybara/util/console:ConsolesTest       (cached) PASSED in 0.4s
//javatests/com/google/copybara/util/console/testing:TestingConsoleTest (cached) PASSED in 0.4s
//copybara/integration:tool_test                                         FAILED in 20.5s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/copybara/integration/tool_test/test.log
//javatests/com/google/copybara:TransformWorkTest                        FAILED in 0.8s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/TransformWorkTest/test.log
//javatests/com/google/copybara:WorkflowTest                             FAILED in 1.4s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/WorkflowTest/test.log
//javatests/com/google/copybara/git:GerritDestinationTest                FAILED in 1.0s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/GerritDestinationTest/test.log
//javatests/com/google/copybara/git:GitDestinationTest                   FAILED in 1.9s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/GitDestinationTest/test.log
//javatests/com/google/copybara/git:GitMirrorTest                        FAILED in 0.9s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/GitMirrorTest/test.log
//javatests/com/google/copybara/git:GitRepositoryTest                    FAILED in 0.5s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/GitRepositoryTest/test.log
//javatests/com/google/copybara/git:SubmodulesInDestinationTest          FAILED in 0.8s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/git/SubmodulesInDestinationTest/test.log
//javatests/com/google/copybara/transform:metadata/MetadataModuleTest    FAILED in 0.8s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/transform/metadata/MetadataModuleTest/test.log
//javatests/com/google/copybara:util/OutputDirFactoryTest                FAILED in 0.4s
  /private/var/tmp/_bazel_jeffryhesse/f5baa568c1bab50fda34d59d99a6c6eb/execroot/copybara/bazel-out/darwin_x86_64-fastbuild/testlogs/javatests/com/google/copybara/util/OutputDirFactoryTest/test.log

Executed 10 out of 53 tests: 43 tests pass and 10 fail locally.

ITERATIVE workflow overrides changes, CHANGE_REQUEST workflow only succeeded for a first change

Hi, I'm experimenting with git-to-git export-import scenario.
For exporting from private repo to public repo I'm using ITERATIVE workflow with git.github_origin and git.github_destination.
And for importing form public repo to private repo I'm using CHANGE_REQUEST workflow with git.github_origin and git.github_pr_destination.

This setup does work for me in some cases, however in some other cases it doesn't.

Issue 1
When running ITERATIVE workflow (exporting priv-->pub), copybara replaces all files changed in the destination with their earlier revisions existing in the origin. Copybara probably fails to find the baseline commit in this scenario but I don't see any errors or warnings.

Issue 2
When running CHANGE_REQUEST workflow (importing priv<--pub) it works perfect for a first change but fails for subsequent change.
Consider the following scenario:

  1. in the dest repo add 'line 1' to dest.txt file.
  2. run copybara import --> PR in the origin githab repo is created.
  3. accept the PR (merge or rebase - it doesn't matter), delete the branch
  4. optionally (the entire scenario fails either way) run copybara export --> "Iterative workflow produced no changes in the destination for resolved ref: 1234"
  5. in the dest repo add 'line 2' to dest.txt file.
  6. run copybara import --> ERROR: Conflict detected while rebasing <usr>/copybara/temp/workdir2115951859017918467/checkout to 1234.

Checking the failed patch at <usr>/copybara/cache/git_repos/<repo url>/rebase-apply/patch
reveals that it contains additions for both 'line 1' and 'line 2' to dest.txt file.

The only fix I've found for this condition is to remove the patch and run copybara export. This time change '1234' (the first one) would pass through and be pushed to the dest. But this will effectively destroy all the recent changes in the dest ('line 2' in our case) - see Issue 1.

Are these issues really a bugs or desired behavior?
Is there anything I can try to work around at least one of those?
Thank you.

DateTime parsing error

While evaluating Copybara I ran into this:

bazel-bin/java/com/google/copybara/copybara migrate copy.bara.sky --force
Copybara source mover (Version: Unknown version)
Task: Git Destination: Fetching: https://github.com/<undisclosed>.git master
WARN: Git Destination: 'master' doesn't exist in 'https://github.com/<undisclosed>.git'
WARN: Cannot find last imported revision, but proceeding because of --force flag
java.time.format.DateTimeParseException: Text '%aI' could not be parsed at index 0
	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1947)
	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1849)
	at java.time.ZonedDateTime.parse(ZonedDateTime.java:597)
	at java.time.ZonedDateTime.parse(ZonedDateTime.java:582)
	at com.google.copybara.git.GitRepository$LogCmd.parseLog(GitRepository.java:1351)
	at com.google.copybara.git.GitRepository$LogCmd.run(GitRepository.java:1307)
	at com.google.copybara.git.ChangeReader.run(ChangeReader.java:73)
	at com.google.copybara.git.GitOrigin$ReaderImpl.changes(GitOrigin.java:222)
	at com.google.copybara.git.GitOrigin$ReaderImpl.changes(GitOrigin.java:120)
	at com.google.copybara.WorkflowRunHelper.getChanges(WorkflowRunHelper.java:313)
	at com.google.copybara.WorkflowMode$1.run(WorkflowMode.java:56)
	at com.google.copybara.Workflow.run(Workflow.java:192)
	at com.google.copybara.Copybara.run(Copybara.java:58)
	at com.google.copybara.Main.runInternal(Main.java:171)
	at com.google.copybara.Main.run(Main.java:106)
	at com.google.copybara.Main.main(Main.java:85)
ERROR: Unexpected error (please file a bug): Text '%aI' could not be parsed at index 0 (java.time.format.DateTimeParseException: Text '%aI' could not be parsed at index 0)

Workflow best practices for migration of GitHub code into internal repo

This looks like a great tool, and would be of use to us on some upcoming projects. Thanks for open sourcing it!

One question I have (I can't seem to find a better forum for Q's) is around best practices for integrating changes from GitHub with an internal authoritative repo.

This is mentioned in the README:

Importing a change from a non-authoritative repository into the authoritative repository. When a change is made in the non-authoritative repository (for example, a contributor in the public repository), Copybara transforms and moves that change into the appropriate place in the authoritative repository. Any merge conflicts are dealt with in the same way as an out-of-date change within the authoritative repository.

Concretely, say someone opens a PR on your GitHub repo. What does the process look like for integrating that change into the internal repo? Is the change first merged into the GitHub repo then migrated to the internal repo? Or is there some way to do some kind of initial vetting to know that the change is compatible with the internal repo before merging the change in GitHub, then moving? I've often wondered how this is done on some of the PRs I've submitted to Google GitHub projects.

Happy to offer up some documentation in a PR once I grok this concept.

Thanks again for open sourcing the tool!

$HOME not found in Windows

From : https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/copybara-discuss/XPTFivEHJUg/B_mlkpc5CgAJ

Hi Mikel,

Thanks for replying. Yes, I am using windows. Here is the stack trace:

Task: Cleaning output directory.
java.lang.NullPointerException: $HOME environment var is not set
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at com.google.copybara.GeneralOptions.getDirFactory(GeneralOptions.java:208)
at com.google.copybara.Main.lambda$cleanupOutputDir$0(Main.java:351)
at com.google.copybara.GeneralOptions.ioRepoTask(GeneralOptions.java:189)
at com.google.copybara.Main.cleanupOutputDir(Main.java:345)
at com.google.copybara.Main.initEnvironment(Main.java:337)
at com.google.copybara.Main.runInternal(Main.java:160)
at com.google.copybara.Main.run(Main.java:107)
at com.google.copybara.Main.main(Main.java:86)

Better support for updating dependencies

Currently Copybara allows to move code from one repo to another. It can be used with some hacks to update a repo based on changes from another repo (see #84 for details). We should improve this and make it less hacky. Some ideas:

  • Multiple sources origin

  • Don't require origin/destination files and/or don't require a checkout.

  • Custom RevId that contains the dependency.

Customize git binary path

We need to customize the git binary path since we want to actually use a wrapper that:
exports some environment properties for Copybara to leverage (username, email, etc).

We tried setting GIT_EXEC_PATH in the env but that confuses git since we can't have wrapper sit in the actual GIT_EXEC_PATH.

I experimented in my repo in changing GitRepository#resolveGitBinary to try and first read GIT_BINARY_PATH from the environment and if not fallback to GIT_EXEC_PATH and then back to git (like it does today).

That solved my problem.

I'd be really happy to send a PR for this. WDYT?

Migration#getInfo is not generified

Hi,
Migration#getInfo is not generified which means that when one uses it programatically they need to cast it to Info<Revision> or Info<O> where O extends Revision.
This is not blocking me since Scala somehow bypasses this but I didn't like the cast I needed to do in 3466829

How do I wipe out the commit message, but maintain sha1, etc...

This is what I've ended up with:

# Update these references to your orginzations repos
sourceUrl = "[email protected]:sonatype/nexus-repository-p2-internal.git"
destinationUrl = "[email protected]:sonatype/nexus-repository-p2.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = sourceUrl,
        ref = "master",
    ),
    destination = git.destination(
        url = destinationUrl,
        fetch = "master",
        push = "master",
    ),
    mode = "ITERATIVE",
    # Change path to the folder you want to publish publicly
    origin_files = glob(["**"], exclude = ["copy.bara.sky"]),
    destination_files = glob(["**"]),

    authoring = authoring.pass_thru("DarthHater <[email protected]>"),
    transformations = [
      metadata.squash_notes("Changes for Project Nexus Repository - P2:\n"),
    ],
)

I'd like to wipe out the commit message or make it generic. Origin sha1 is good to have. Is that possible with my setup? I'm using squash_notes out of ignorance, currently.

Migrate initial repo into empy repo: ERROR: Unknown option: --git-first-commit

Hello again!

I'm trying to run Copybara like so: copybara copy.bara.sky --git-first-commit

I get:

Copybara source mover (Version: Unknown version)
ERROR: Unknown option: --git-first-commit

ERROR: Try 'copybara --help'.

I'm following the instructions in pretty much verbatim minus some tiny differences: https://github.com/google/copybara/blob/master/docs/examples.md#basic-git-to-git-import

My local differences are:

  • using SSH over https for git repo
  • using one of @sonatype 's internal repos to test this on versus Copybara

I don't think either have any impact here, as I think this is just an old command flag that no longer exists? I'd be curious what the steps are now to get copybara working on pushing an existing repo to a new bare one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.