Search code examples
phpgitsvnversion-controlorganization

SVN Avoiding Duplicate Code


I am working on a project in php which has a 'toolkit' folder/repository of useful functions and classes and then several other folders/repositories called 'scrape', 'process', and 'serve' which each use the functions in 'toolkit'. The way it is now, I am using the property svn:externals to make sure whenever I checkout any of these that the toolkit repository comes with it. This has resulted in the toolkit folder with the same code showing up in each of the other repository folders which seems non-optimal. Here is what happens on checkout

/code
   /scrape
      /toolkit
      scrapefiles...
   /process
      /toolkit
      processfiles...
   /serve
      /toolkit
      servefiles...

and here is what I want to happen

/code
    /toolkit
    /scrape
        scrapefiles
    /process
        processfiles
    /serve
        servefiles

How can I do this so that I don't have multiple copies of the toolkit running around. I would prefer to use externals if possible but any solution would be great.


Solution

  • SVN:External has no deal with the final structure of your repo, if you want a structure of below, you can check in sources with the same structure.

    External means to have a folder on checking out exists in different folders but checking in is turn out the same places.

    You may try to remove those "symbolic links" in your current svn repo and add the real toolkit or the link to the root of "code"

    the way storing source on the server is folder based but it's totally independent to how it is seen on the local side.