How to get the latest commit from each branch?

Answered

Hi,

Imagine I have a SVN root like: /svn/project

then imagine I have 1 build configuration in: /svn/project/trunk using the above SVN root and the last commit on trunk was number 1000.

then imagine I have 1 build configuration in: /svn/project/branches/releaseBranches/3.3 using the above SVN root the last commit on 3.3 was number 995.

 

Now when I click build on both configurations to run the build, both will try to pick up SVN revision 1000 wich is the latest from the root, but since branch 3.3 last commit was 995, teamcity refuses to start the build on the 3.3 branch saying ("on the folder  /svn/project/branches/releaseBranches/3.3 there's no svn revision number 1000").

 

How can I tell Teamcity to get only the latest SVN revision for the current folder being checked out?

 

Thanks,

Miguel

10 comments
Official comment

Hello everyone,

  TeamCity does not officially support feature branches for Subversion. If you want to mimic the behaviour by using a custom parameter, this parameter will work only if it is a part of URL in the VCS Root. It won't work in checkout rules, unfortunately.

   We have a couple of related issues in our tracker, please take a look:

    - https://youtrack.jetbrains.com/issue/TW-46696 - this is related to the solution proposed by Murfee25 (thanks a lot!)

    - https://youtrack.jetbrains.com/issue/TW-18911 - feature branches support in Subversion (not implemented yet)

  Hope this helps,

Hello Miguel,

Could you please describe in detail how build configurations in TeamCity are configured? What VCS roots and VCS settings/checkout rules they use? Please attach screenshots. 

0

Just one VCS root for all configurations: /svn/project/

 

checkout rules: In configuration 1: trunk => trunk, In configuration 2: branches/releaseBranches/3.3 => branches/releaseBranches/3.3

 

Why do you need a screenshot?

0

Hello Miguel,

How do you start the build on the 3.3 branch? Could you please attach teamcity-server.log and teamcity-vcs.log files?

0

Hi Alina,

 

I start the build by clicking the Run button and I have a variable where I configure the branch version, in this case %Version%=3.3. I can't attach the log files at moment because of time restrictions to get this working I had to create one VCS root for each branch.

But I'm very keen to know how can I overcome this problem (getting the latest commit for each branch folder, with only 1 VCS root configured), so if you can help me I appreciate.

 

Thanks,

Miguel

0

I am experiencing the exact same issue.

 

I have 1 VCS root used by 1 build configuration

Instead of the %version% parameter I have a %branch% parameter instead.

My %branch% is defaulted to 'Beta' to build a Beta branch and push to testing.

But if I want to quickly push out a patch, I'd create a short lived 'hotfix' branch (e.g. v2.3) and when running the build configuration I'd just change the %branch% to 'v2.3'

Thats the theory anyway... and I remember it working pretty well against TFS at least.

 

I can happily build Beta and push to testing. The issue appears to come about when I create a hotfix and then later update the hotfix again and build again.

hotfix (1) revision 900 build by changing the %branch% to 'v2.3'

hotfix (2) revision 950 build by changing the %branch% again... in meantime the root head revision is 1000 and this is reflected in the build log 'collecting changes for revision 1000' but it finds nothing.

Then once the build is complete the parameters tab shows the build.vcs.number as 900 ?? and this is the revision it builds... missing out my second hotfix!

 

If we can't find a solution to this, I'm just going to have to create 2 build configurations and keep updating the hotfix path

 

0

Could you please describe the issue in all the details:
- note your VCS settings: the VCS roots checkout locations, checkout rules used
- describe the change in question: it's revision and paths of all the files in it
- attach screenshots of the Change Log of the build configuration (with file paths) and screenshot of the build's Changes tab ?

Thank you!

0

Hi Alina,

I thought that was what I had done...

I have 1 VCS root

|- root (VSC root)

  |- MyProject

    |- Branch1

    |- Branch2

 

1 Build configuration with Parameter %Branch% defaulted to 'Branch1'.

VCS checkout rules to pull down relevant projects use this parameter

+:MyProject/%Branch%/projecta
+:MyProject/%Branch%/projectb
+:MyProject/%Branch%/MySolution.sln

So by default Branch1 is build when I click run.

When I click the ellipsis on the run button and change the parameter to Branch2 I expect it to get latest revision of the Branch2 code.

 

I did some tests to see when it happens and I believe its when I make changes in both branches and build Branch1 then try to build Branch2

root (rev. 1000)

Create Branch1 (rev 1001)

Create Branch2 (rev 1002)

Change branch 1 (rev 1003)

Change branch 2 (rev 1004)

Build branch1, correctly gets rev 1003

try to build branch2 by changing parameter... 

Verbose build log correctly says it 

[Collecting changes in 1 VCS root] VCS revisions for 'root' - 1004_2016/11/16 08:16:47 +0000..35939_2016/11/16 08:17:04 +0000

But when build finished the Parameters tab shows 3 variables all with the wrong rev number

e.g

build.vcs.number 1003

And sure enough the 1004 changes will not be in the build.

0

Hi,

I'm not 100% sure but I was able to reproduce the issue as described above until I made some changes.

I changed the configuration as follows:

VCS root is now setup to svn://svnhost/root/MyProject/%Branch%

My checkout rules are now simpler and don't include the parameters.

+:projecta
+:projectb
+:MySolution.sln

 

Since making these changes and following the same process of changes and builds... I cannot reproduce the issue.

so it might be worth a try for you Miguel ?

0

How would this work with labelling? Previously, I've used svn://svnhost/root/MyProject as the VCS root and set up a checkout rule of +:%branch%, and set the labelling rule as trunk => tags, but I'm starting to see this error, where commits I know have been made to the repository are not being detected by TeamCity.

0

Please sign in to leave a comment.