Staging instance, all changes can be removed at any time

Skip to content

Draft: Expose headBranch attribute in the snapshot object

Jayesh requested to merge head-branch-snapshot into master

This MR will make accessing the headBranch easier by exposing a new attribute. Will return null in case the target branch is missing.

eg: query

query latestSnapshot {
  origin(url: "https://github.com/python/cpython") {
    latestSnapshot {
      headBranch {
        type
      	target {
          type
          swhid
          resolveChain {
            text
          }
        }
        name {
          text
        }
      }
    }
  }
}

response

{
  "data": {
    "origin": {
      "latestSnapshot": {
        "headBranch": {
          "type": "alias",
          "target": {
            "type": "revision",
            "swhid": "swh:1:rev:810d5d87d9fe8d86aad99e48cef4f78a72e16ccf",
            "resolveChain": [
              {
                "text": "refs/heads/main"
              }
            ]
          },
          "name": {
            "text": "HEAD"
          }
        }
      }
    }
  }
}
Edited by Jayesh

Merge request reports

Loading