First time importing pull request from public to private
See original GitHub issueHello!
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!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Selectively importing other people's pull requests in your own ...
First make a fork. Then clone the fork locally. Apply patches from Pull Request's. So for instance if your pull requests is on...
Read more >How to Use a Private Go Module in Your Own Project
Many Go modules are open-source, which means they can be freely accessed and used. However, sometimes you need to make a module private....
Read more >Use pull requests for code review - Bitbucket - Atlassian Support
After you've added files and made updates to existing code, it's time to merge that code into your Bitbucket Cloud repository. Before you...
Read more >Getting started with merge requests - GitLab Docs
Delete feature branches on merge or after merging them to keep your repository clean. Take one thing at a time and ship the...
Read more >Import a Git repo into your project - Azure - Microsoft Learn
User name to specify when the git repository is private. Example. The following command imports the public repo fabrikam-open-source to the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I took a shot at adding smart_prune support in #112. At least for my use case it has allowed importing PRs from github when scrubbing was used in the export process.
We don’t have. Here is an example:
Assuming you have this file structure:
You would add:
or
The advantage of the git origin version is that if you generate the patch from the origin repo ( maybe do an initial temporary and local git apply of the internal patch to the external repo and then save that patch) it will use 3way merge when applying the patch.