Have PullRequestForBranch accept "owner:branch" value for forks

When on a `patch-1` branch locally, `gh pr view` would happily open the
first open PR it finds with "patch-1" as its head, even those coming
from forks.
This commit is contained in:
Mislav Marohnić 2019-11-18 20:52:34 +01:00
parent c7a38b6331
commit 508f6787f0
5 changed files with 77 additions and 81 deletions

View file

@ -7,7 +7,11 @@
"number": 10,
"title": "Blueberries are a good fruit",
"url": "https://github.com/github/gh-cli/pull/10",
"headRefName": "[blueberries]"
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "OWNER"
},
"isCrossRepository": false
}
}
]
@ -20,7 +24,7 @@
"number": 8,
"title": "Strawberries are not actually berries",
"url": "https://github.com/github/gh-cli/pull/8",
"headRefName": "[strawberries]"
"headRefName": "strawberries"
}
}
],
@ -33,7 +37,7 @@
"number": 9,
"title": "Apples are tasty",
"url": "https://github.com/github/gh-cli/pull/9",
"headRefName": "[apples]"
"headRefName": "apples"
}
},
{
@ -41,7 +45,7 @@
"number": 11,
"title": "Figs are my favorite",
"url": "https://github.com/github/gh-cli/pull/1",
"headRefName": "[figs]"
"headRefName": "figs"
}
}
],

View file

@ -1,50 +1,30 @@
{"data":{
"repository": {
"pullRequests": {
"edges": [
{
"node": {
{
"data": {
"repository": {
"pullRequests": {
"nodes": [
{
"number": 12,
"title": "Blueberries are from a fork",
"url": "https://github.com/OWNER/REPO/pull/12",
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "hubot"
},
"isCrossRepository": true
},
{
"number": 10,
"title": "Blueberries are a good fruit",
"url": "https://github.com/OWNER/REPO/pull/10",
"headRefName": "[blueberries]"
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "OWNER"
},
"isCrossRepository": false
}
}
]
]
}
}
},
"viewerCreated": {
"edges": [
{
"node": {
"number": 8,
"title": "Strawberries are not actually berries",
"url": "https://github.com/OWNER/REPO/pull/8",
"headRefName": "[strawberries]"
}
}
],
"pageInfo": { "hasNextPage": false }
},
"reviewRequested": {
"edges": [
{
"node": {
"number": 9,
"title": "Apples are tasty",
"url": "https://github.com/OWNER/REPO/pull/9",
"headRefName": "[apples]"
}
},
{
"node": {
"number": 11,
"title": "Figs are my favorite",
"url": "https://github.com/OWNER/REPO/pull/1",
"headRefName": "[figs]"
}
}
],
"pageInfo": { "hasNextPage": false }
}
}}
}