PoweredByPorkers
PoweredByPorkers

Reputation: 243

TFS build definition associated commits

Can anyone help me get the list of git commits out of TFS 2013 that are associated with the build I'm currently creating?

Currently I'm doing

What I'd also like to do is include the list of commits, that is already attached to the build definition summary page in TFS, to the release notes section of my nuspec so it gets include in the octopus release.

Anyone point me in the right direction?

Thanks!

EDIT

So let's tweak the question slightly, does anyone know how to get the GiT commit associated with the last build of a given build definition? It must be stored in TFS somewhere as that has to be the method it uses to produce its list.

If I can get hold of that then I can run

git log <last commit>^..HEAD --format="%ci - %cn - [%h](<path to my TFS>/commit/%H) %s%n" > rn.txt

which will allow me to then change my octo create-release command to

octo create-release --server=<server> --version=<version> --project=<proj> --apikey=<key> --releasenotefiles=rn.txt

And be happy :-)

EDIT 2 I'm using TFS not VSO so I can't access the REST API

Upvotes: 3

Views: 645

Answers (1)

PoweredByPorkers
PoweredByPorkers

Reputation: 243

So I've likely been down voted as I could use git to do it all, but a comment pointing that out would've been nice.

Anyway,

As I'm brand new to git I missed the fact I can create a tag and use that in place of the commit id and then run up to the HEAD version to get all commits between them

git log <last tag>..HEAD --format="%ci - %cn - [%h](<path to my TFS>/commit/%H) %s%n" > rn.txt

works perfectly for my purposes.

Upvotes: 1

Related Questions