-1

Here is the scenario. In a svn repository, there are multiple folders under same folder tree. Say structure is as:

ProjectA
 |
 | - Folder1
 | - Folder2

Now in a separate folder tree:

ProjectB
 | - FromExternalProject (needs all contents of Folder1 & Folder2 in ProjectA)

Preferably all content should remain at same folder level as externals. Using file externals is one options, but there are too many files (almost 25). We cannot have multiple folder externals from the same folder, can we? Is there any other way to achieve this?

dushyantp
  • 4,398
  • 7
  • 37
  • 59
  • Possible duplicate of http://stackoverflow.com/questions/3141538/how-to-bring-in-multiple-files-into-the-same-folder-using-svnexternals – pmod Mar 05 '14 at 22:33
  • So, it looks like the cleanest / most reliable solution is to restructure your ProjectB to accept only folder externals in FromExternalProject – pmod Mar 05 '14 at 22:36

1 Answers1

0

File externals was my initial idea and 25 files are not really that much. You set it up once and then just use it.

Another option would be to use client side hook scripts. Tortoise SVN client supports several of them. SVN client would work with files in their original folders, and hook scripts would synchronize these files with the corresponding files in your work folder in pre-commit, pre-update, and post-update scripts. Update phase would look like this:

  • pre-update: copy files from FromExternalProject to Folder1 and Folder2
  • post-update: copy files from Folder1 and Folder2 to FromExternalProject

Commit phase would look like this:

  • pre-commit: copy files from FromExternalProject to Folder1 and Folder2

There's no need for post-commit hook.

Yet another option would be to use features of the file system, like symbolic links in Windows and Linux. The case is identical to the previous one, but without the previous hooks, because the files are already synchronized (because they are the same files on the disk). You still need to create the links after the checkout, either manually running a script once, or in a post-update hook script.

Dialecticus
  • 16,400
  • 7
  • 43
  • 103
  • Subversion on Windows (actually, I think it's the underlying APR library) does not support symlinks last I checked. – alroc Mar 05 '14 at 17:17
  • @alroc OP should use anything that both SVN client and development tools would regard as a plain file that logically exists in two places. Some kind of script would run after checkout and create those special file system objects. – Dialecticus Mar 05 '14 at 17:57
  • 2
    The trouble you'll run into with any client-side scripting is that you have to ensure that it's distributed to and runs on *all* possible client environments, including your CI server(s). – alroc Mar 05 '14 at 18:00
  • @alroc nice comment. When making any kind of decision we have to know about the difficulties in implementing it, so that the costs don't outweigh the benefits. So, I gave three options. Have an idea about the forth? – Dialecticus Mar 05 '14 at 20:50
  • The symlinks? I already mentioned it - they don't work on Windows. Having a script that processes the plain text file that Subversion leaves in its place on Windows falls into the same category as any other scripting that's integral to your process IMHO. – alroc Mar 05 '14 at 20:54
  • @alroc I don't understand your last sentence. Could you please dumb it down for me? As for the [hard symbolic links](http://msdn.microsoft.com/en-us/library/windows/desktop/aa365006%28v=vs.85%29.aspx), they most certainly work. Maybe you meant to say that they don't work in all conceivable cases? That is probably true, but not the same as to say that they just don't work. I mentioned "symbolic links" in the answer as an umbrella term. Maybe I should have narrowed it down to hard links. – Dialecticus Mar 05 '14 at 21:33
  • Symbolic links (or links of any kind) do not work with Subversion on Windows; Subversion leaves a plain text file instead with the "destination" of that link. So if you're using those instead of externals, you will need to have a post-checkout/update script on all client systems to process that, otherwise your builds will not work properly. – alroc Mar 05 '14 at 21:43
  • @alroc, yes, my bad, I didn't write that links have to be made after the checkout, outside of SVN client. I'll update the answer. – Dialecticus Mar 05 '14 at 21:55
  • Thanks both of you for these comments. Very helpful. @Dialecticus as having the files at same level is important to the structure, I am using svn file externals (although it feels monotonous). Thanks. – dushyantp Mar 06 '14 at 09:18