question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

authoring not working

See original GitHub issue

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 = "git@gitlab.com:example/internal_test_repo.git"
externalUrl = "git@gitlab.com: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 <example@gmail.com>"),
    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 <example@gmail.com>"),
    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'),
    ],
)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
samuelbacommented, Mar 18, 2019

I think I found a solution, not sure though if this is the optimal/recommended solution. I use first_parent = False, in git.origin() and I use ITERATIVE mode for both processes. First for getting the external branch with all commits to the internal repository and than to sync back all commits from the internal repository to the external repository. This way I have not only the merge commits, but all commits, including the original author.

Maybe we could add an example like this to the examples? Of course only if this is the optimal/recommended solution for the task.

My copy.bara.sky looks like this now:

internalUrl = "git@gitlab.com:example/internal_test_repo.git"
externalUrl = "git@gitlab.com:example/external_test_repo.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = internalUrl,
        ref = "master",
        first_parent = False,
    ),
    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 <example@gmail.com>"),
    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",
        first_parent = False,
    ),
    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 = "ITERATIVE",
    authoring = authoring.pass_thru(default = "Example <example@gmail.com>"),
    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'),
    ],
)
0reactions
mikelalconcommented, Mar 18, 2019

I see. You could make it work with some scripting wrapping Copybara (that we could add native if this starts to be common pattern).

You import to a branch as you do now. Do the merge manually (but in the merge you add the integrate label or any text you want).

Then in the way out you run copybara and after that in the script you git log looking for that label and rewrite history to add a fake merge with the original PR. This would be ~40-50 lines of bash, no much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot co-authoring in Office - Microsoft Support
Troubleshoot co-authoring · Click the File tab on the ribbon, click Options to display the Word Options dialog box. · Click Trust Center,...
Read more >
Co-authoring troubleshooting tips - Breadcrumb Digital
Another reason why co-authoring may not be working is if a Word document does not have the 'Store random numbers to improve Combine...
Read more >
How SharePoint Co-authoring Works and Fixing Common ...
Common problems that cause co-authoring to not work · 1. Checking out the document · 2. Unsupported document format · 3. Using different...
Read more >
SharePoint co-authoring not working: How to fix
Common reasons why your co-authoring may not be working: · AutoSave is turned off · You're not using the right document format ·...
Read more >
Co-Authoring and Synced Documents | by Darrell as a Service
More often than not, colleagues bump into each other, exclaiming “oh, there's another user working on this document with me. I…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found