Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] az repos pr create should allow Azure Repos to dynamically choose targetRef #1431

Open
derrickstolee opened this issue Dec 30, 2024 · 0 comments
Labels
Feature Feature Work required.

Comments

@derrickstolee
Copy link

derrickstolee commented Dec 30, 2024

Is your feature request related to a problem? Please describe.

There is a new feature in Azure Repos where a repository can configure custom target branches. When these branches are configured, the PR create page in the Web UI will dynamically choose a target branch based on the first-parent commit history.

This issue's request is that this behavior becomes enabled in az repos pr create when the user does not specify a target branch in the CLI.

Describe the solution you'd like

I have a working implementation in my fork: see diff here. I started creating a PR but then saw that we needed signoff on the approach.

There are two main pieces here:

  1. Update the REST API data model to include the new IgnoreTargetRefAndChooseDynamically member to the GitPullRequest object. Since this is an addition to the object model, it will be included in the POST body of the request to create a PR. Older versions of Azure DevOps Server will ignore this member, but newer versions (and the Azure DevOps cloud service) will recognize it as a signal to ignore the TargetRef value and instead enable the new logic, when configured. This parameter was the decision of the Azure Repos team instead of making TargetRef optional, which was considered a backwards compatibility break. The current az repos pr create logic only interacts with the v5_0 model, but all existing models are updated. Further, the latest released model does not yet have this parameter (introduced in ~September 2024 clients).
  2. When selecting a target ref by falling back to the default ref, indicate that this was a "guess" and not something provided by the user. Then, when this guess occurs, we can set the optional member to indicate that the user has not specified a target and thus the given choice can be ignored.

Additional context

I'm the author of this feature in the Azure Repos backend (and of the linked docs). I assisted several major repositories within Microsoft to configure this setting, including the Windows and Office monorepos. I'm contributing client-side changes to az repos and the dev CLIs as we have users creating PRs with those tools.

@derrickstolee derrickstolee added the Feature Feature Work required. label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature Work required.
Projects
None yet
Development

No branches or pull requests

1 participant