Skip to content

First time importing pull request from public to private #107

@maksyche

Description

@maksyche

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions