Bug in action Team Foundation Latest Version Number

 I am running an action Team Foundation Latest Version Number. It succeeds, but doesn't return the changeset number in the variable. The variable is empty, although it was set to "0" before the action ran.

It has "Use Folder" set to the correct folder, and if I try another folder, the action fails. It has "Save changeset number to variable" set to the correct variable. I am logging the variable after the erroneous action runs. I have little doubt that the action is correctly configured.

I am running the command manually:

 

"c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" history * /recursive /noprompt

This results in the following output:

 

========= begin output ===============
Changeset User          Date       Comment
--------- ------------- ---------- ------------------------------------------------------------------------------------------------------------------
14        Bent          14.02.2012 Moved and renamed YourClass.cs.
13        Bent          14.02.2012 Renamed MyClass.cs to YourClass.cs.
12        Bent          14.02.2012 Added MyClass.cs.
11        Bent          13.02.2012 Added the third button, using SvnBridge.
10        Bent          07.02.2012 Deleted the DummyClass.cs again.
9         Bent          07.02.2012 Added a class to experiment with.
8         Bent          07.02.2012 Added another button and event handler.
7         Bent          07.02.2012 Added an event handler for button1.
6         Bent          07.02.2012 Added a button to the main form.
5         Bent          30.01.2012 
4         Bent          30.01.2012 Check-in the Lab default template
3         Bent          30.01.2012 Checking in new Team Foundation Build Automation files.
========= end output ===============

 

My guess is the action parses something the wrong way, and if so then the most likely candidate is the date, since this probably changes depending on the user's preferred locale settings.

 

 

 

Hi Bent,
The parsing is a very simple - it basically just matches this regex against the 3rd line of the output: ^(?[0-9])\s.* (ie, get the number that starts the string, followed by whitespace). I’ve tested the parsing code against your example output above, and it correctly returns ‘14’.

It is a bit naive though - eg perhaps there’s an errant newline in your output. The action should also fail if it doesn’t find a value. I’ll make a few changes and get a test build to you later today.

Cheers,

Ben

Hi Bent,
Can you please try the following test build and see if it resolves your issue? https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700_1773.exe

If not, you should see the action fail and the TF.exe output should be written to the build log.

Please let me know how you go.

Cheers,

Ben

It works in test build 1773 which you sent me. The action returns 1015, and a manual run of the TF command outputs this:

Changeset User Date Comment
--------- ------------- ---------- --------------------------------------------
1015 bent 09.02.2012 FinalBuilder build script for Detec Next.
1014 bjorn 06.02.2012 Fixed some bugs. Changed the "global user se
and so on

Thanks.

The action doesn't output the result - the latest version number - in the log, which I find a bit annoying. I would have liked to have a green line with that number in it.

I ran into some other issues while working on a workaround for this. I'll write some other posts.

Glad it’s working. I’ve added logging of the result, which will be included in the next release build. If you need it now let me know and I can send you another test build.

Cheers,

Ben