Giter VIP home page Giter VIP logo

Comments (4)

tedchamb avatar tedchamb commented on August 11, 2024

Going forward you can file your vsts-python-api issues directly in the vsts-python-api repo:
https://github.com/Microsoft/vsts-python-api/issues

I have forwarded your question to the git api team, and will get back to you.

from azure-devops-cli-extension.

tedchamb avatar tedchamb commented on August 11, 2024

On a side note, we have a new documentation site for the VSTS APIs with examples. Our python-sdk-api is just a wrapper for the REST apis, so you may find useful information here:

https://docs.microsoft.com/en-us/rest/api/vsts/git/commits

from azure-devops-cli-extension.

WilBrady avatar WilBrady commented on August 11, 2024

You can get all the tags from the /refs/tags endpoints. For example, tag1 below is annotated and tag2 is a lightweight:

{
value: [
{
name: "refs/tags/tag1",
objectId: "b0fa354e399adc227fe013e3a9e1b4947659beee",
},
{
name: "refs/tags/tag2",
objectId: "6d9ae2bf6883412bab2d389a3b5e1447003944eb",
}
],
count: 2
}

In the tag2 case, the objectId is the commit as it is a lightweight tag. In the tag1 case, if we want the commitId we need to crack the annotated tag, which you can do with the annotated tag endpoint (https://docs.microsoft.com/en-us/rest/api/vsts/git/Annotated%20Tags/Get). In my example, if I go to /annotatedtags/b0fa354e399adc227fe013e3a9e1b4947659beee off the repository REST API, I then get the response:

{
name: "refs/tags/tag1",
objectId: "b0fa354e399adc227fe013e3a9e1b4947659beee",
taggedObject: {
objectId: "6d9ae2bf6883412bab2d389a3b5e1447003944eb",
objectType: "commit"
},
message: "hello",
}

In this result we see that the annotated tag b0fa354e399adc227fe013e3a9e1b4947659beee points to the object 6d9ae2bf6883412bab2d389a3b5e1447003944eb which is a commit. Since annottated tags can point to annotated tags, you may have to follow the chain until you get to the taggedObject being of objectType commit.

from azure-devops-cli-extension.

vbossica avatar vbossica commented on August 11, 2024

@WilAtMSFT @tedchamb thanks for the answer.
It would have been handy to not need to fire another request to distinguish between simple and annotated tags, but it's not an additional request that will make a big difference.

from azure-devops-cli-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.