1
votes

I have the following structure in SVN

Code
|- DEV-BusinessLayer
|- DEV-DataModel
|- DEV-Engine
|- Dev-Main
    |- src
        |-BusinessLayer
        |-DataModel
        |-Engine
        |-Engine.sln
    |- lib

I need to SVN switch my Engine, BusinessLayer and Datamodel subdirectories in DEV-Main to DEV-ENgine, DEV-BusinessLayer and DEV-DataModel, before building the solution file. The idea is, if i switch, I'm working on the dev branch, and if I don't, I'm on the main branch. Note that there is only one solution file.

I'm trying to add the following checkout rules in TeamCity, but the files that are checked out are not from the correct branch (I logged into the teamcity server, took the file and compared with my manual checkout). What is disturbing is, randomly it is the correct version. These are my checkout rules, what should I change to ensure correct checkout?

+:Code/DEV-BusinessLayer=>./src/BusinessLayer
+:Code/DEV-DataModel=>./src/DataModel
+:Code/DEV-Engine=>./src/Engine
+:Code/DEV-Main/src=>./src
+:Code/DEV-Main/lib=>./lib

This is what I see in the build log, I'm suspicious of the src\ folder appearing multiple times. Are the DEV-* folders getting overwritten somehow?

[18:20:00][Updating sources] Removing C:\BuildAgent\work\6148493fca83a584
[18:20:00][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src\BusinessLayer
[18:20:00][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src\DataModel
[18:20:00][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src\Engine
[18:20:01][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\lib
[18:20:04][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src
[18:20:04][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src\Engine
[18:20:04][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src
[18:20:04][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src\BusinessLayer
[18:20:05][Updating sources] Updating C:\BuildAgent\work\6148493fca83a584\src

Update 1: The documentation says "For each file the most specific rule will apply if the file is included, regardless of what order the rules are listed in." So if I say DEV-Main/src as a whole, and then also specify src/Engine, the second one should be picked right?

Update 2: Does SVN externals refer to this kind of replacing directories? Should I be setting the properties of those folders to make them as SVN externals?

1

1 Answers

0
votes

I got it working finally. The trick is to simply exclude those directories (explicitly) that you are going to replace from another svn location. So my checkout rules became:

+:Code/DEV-Main/src=>./src
+:Code/DEV-Main/lib=>./lib

-:Code/DEV-Main/src/BusinessLayer
-:Code/DEV-Main/src/DataModel
-:Code/DEV-Main/src/Engine

+:Code/DEV-BusinessLayer=>./src/BusinessLayer
+:Code/DEV-DataModel=>./src/DataModel
+:Code/DEV-Engine=>./src/Engine

I believe only when you explicitly specify the exclusion rule, does the "For each file the most specific rule will apply if the file is included, regardless of what order the rules are listed in." kick in. Note that once you add an exclude rule, you cannot use the checkout on agent property. Use "Automatically on server"