Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

[spike] Infer PR associated with current branch#1719

Closed
jcansdale wants to merge 10 commits intogithub:masterfrom
jcansdale:fixes/1591-infer-active-PR
Closed

[spike] Infer PR associated with current branch#1719
jcansdale wants to merge 10 commits intogithub:masterfrom
jcansdale:fixes/1591-infer-active-PR

Conversation

@jcansdale
Copy link
Copy Markdown
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 June 7, 2018 10:55
@jcansdale jcansdale changed the base branch from master to refactor/pr-models June 11, 2018 19:42
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 June 21, 2018 09:01
@jcansdale
Copy link
Copy Markdown
Collaborator Author

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 fixes/1591-infer-active-PR branch November 22, 2018 11:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Current PR doesn't appear on status bar when checked out from command line

1 participant