Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[github_pr_destination] Don't require context reference if pr_branch is set#226

Open
Yannic wants to merge 1 commit intogoogle:master from
Yannic:yannic-pr-branch-destination
Open

[github_pr_destination] Don't require context reference if pr_branch is set #226
Yannic wants to merge 1 commit intogoogle:master from
Yannic:yannic-pr-branch-destination

Conversation

@Yannic
Copy link
Contributor

@Yannic Yannic commented Mar 8, 2023

This will allow copybara to succeed for the following origin:

git.origin(
 url = "https://github.com/google/copybara.git",
 ref = "b0f6c6bbb5828c95b2b1409b4e491865d969f679",
)

...` is set
This will allow copybara to succeed for the following origin:
```
git.origin(
 url = "https://github.com/google/copybara.git",
 ref = "b0f6c6bbb5828c95b2b1409b4e491865d969f679",
)
```
@Yannic Yannic force-pushed the yannic-pr-branch-destination branch from f52ff4e to 6ba12d2 Compare March 8, 2023 12:00
Copy link

@petemounce petemounce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

(Context; we're using copybara to automate vendoring of source-code into a monorepo, but don't always want to continuously track & sync upstream branches. Sometimes we just want to pin to specific revisions and deliberately change those as/when we want to take updates from upstreams. This is then conveniently wrapped up in a CI job that can be triggered when the choice to sync to a different revision happens and is reviewed).

(I don't know if my approve counts for anything, but there it is)

GitHubDestinationOptions.GITHUB_DESTINATION_PR_BRANCH);
String branchNameFromUser = getCustomBranchName(contextReference);

String branchNameFromUser = prBranch;
Copy link
Collaborator

@mikelalcon mikelalcon Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code is a bit confusing after this change.

When prBranch == null, we get branchNameFromUser == null (now the only reason to enter the if statement),

But then we call:

 if (prBranch == null) {
 return null;
 }
...

effectively returning null.

I would refactor this code to have something that makes sense overall.

Also, could you add a tests in GitHubPrDestinationTest?

Thanks for the contribution!!

Copy link

@restingbull restingbull Mar 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed changes in #229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mikelalcon mikelalcon mikelalcon requested changes

+2 more reviewers

@restingbull restingbull restingbull left review comments

@petemounce petemounce petemounce approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /