Improve snapshot branch target object
- Use the new storage method
- Resolve to final branch target only on alias
query
fragment branchFragment on BranchConnection {
nodes {
type
name {
text
}
target {
type
swhid
resolveChain {
text
}
node {
__typename
}
}
}
}
query latestSnapshot {
origin(url: "https://github.com/python/cpython") {
latestSnapshot {
head: branches(first: 1, nameInclude: "HEAD") {
...branchFragment
}
master: branches(first: 1, nameInclude: "refs/heads/main") {
...branchFragment
}
}
}
}
Response
{
"data": {
"origin": {
"latestSnapshot": {
"head": {
"nodes": [
{
"type": "alias",
"name": {
"text": "HEAD"
},
"target": {
"type": "revision",
"swhid": "swh:1:rev:e35e0f15eba64a1dcbab10bbbd2ce276e190dcfa",
"resolveChain": [
{
"text": "HEAD"
},
{
"text": "refs/heads/main"
}
],
"node": {
"__typename": "Revision"
}
}
}
]
},
"master": {
"nodes": [
{
"type": "revision",
"name": {
"text": "refs/heads/main"
},
"target": {
"type": "revision",
"swhid": "swh:1:rev:e35e0f15eba64a1dcbab10bbbd2ce276e190dcfa",
"resolveChain": [
{
"text": "refs/heads/main"
}
],
"node": {
"__typename": "Revision"
}
}
}
]
}
}
}
}
}
Edited by Jayesh