close
The Wayback Machine - https://web.archive.org/web/20201215052547/https://github.com/github/VisualStudio/pull/1719
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

[spike] Infer PR associated with current branch #1719

Closed
wants to merge 10 commits into from

Conversation

@jcansdale
Copy link
Collaborator

@jcansdale jcansdale commented Jun 7, 2018

This is a spike to experiment with infering the PR associated with the current branch.

What this PR does

  • Search current and parent repos for a PR with the same HEAD branch name as the current branch

TODO

Use associatedPullRequests property of ref.

Findings

There can be multiple PRs that use the same branch as their HEAD. We could up with a conservative strategy that minimizes false positives but that still works in most cases?

For example, say a user creates a PR using their master branch. They probably won't want this PR associated with their master branch forever!

There are attributes associated with a PR that we could take into account to infer when a PR is likely stale and shouldn't be automatically associated with the current branch. For example:

  • If the SHA a branch is different to the PR it might be stale
  • If a PR has been closed it is likely to be of less interest to a user to an open one

Fixes #1591

@jcansdale jcansdale changed the base branch from refactor/pr-models to master Jun 7, 2018
@jcansdale jcansdale changed the base branch from master to refactor/pr-models Jun 11, 2018
jcansdale added 9 commits Jun 11, 2018
Search PRs in current and parent repo for one that targets the current
branch name and owner.
BranchModel is always constructed using a local branch so IsRemote is
never true (it is passed repo.Head not repo.Remote.Head).
LocalBranchModel represents the local branch of a LocalRepositoryModel.
ILocalBranch includes extra information that is available when a branch
is from a local repository.
We're only interested in PRs that target the parent (upstream) or owner
(current) repo.
@jcansdale jcansdale changed the base branch from refactor/pr-models to master Jun 21, 2018
@jcansdale
Copy link
Collaborator Author

@jcansdale jcansdale commented Nov 22, 2018

We're planning to warn the user with a call-out notification (see #2026) rather than having alternative logic to choose the default remote when "origin" isn't defined. This will make it obvious what's going on and avoid any magic.

@jcansdale jcansdale closed this Nov 22, 2018
@jcansdale jcansdale deleted the jcansdale:fixes/1591-infer-active-PR branch Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

1 participant
You can’t perform that action at this time.