-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
It is simple to do what you describe.
1) Create a svn repository (in the machine.
$ svnadmin create /path/to/repo/site2
2) Go to /data/webs/site2/
$ cd /data/webs/site2/
3) Checkout the repository.
$ svn checkout URL/site2 .
4) Check what svn sees in the base directory.
$ svn status
5) Set the ignore rules in the base directory (rules will match the files
and directories names and can use * wild card). In your case just "site" is
needed.
$ svn propset svn:ignore site .
6) Again, check what svn sees in the base directory, to confirm if the
ignore rules are correct.
$ svn status
7) Add all files and directories (except those ignored) to the repository.
$ svn add . --force
8) Explicitly add the "site" directory but not its content (by using the -N
flag).
$ svn add site -N --no-ignore
9) Set the ignore rules for the 'site' directory. In your case "site"
directory needs a ignore rule of "*" to ignore all content.
$ svn propset svn:ignore '*' site
10) Explicitly add the site/stub directory and its content.
$ svn add site/stub --no-ignore
11) Again, check what svn sees in the base directory, to confirm the result.
$ svn status
12) Finally, Commit the files to the repository
$ svn add site/stub
That should do it.
Yes, all sites can coexist in the same repository. The real question is
should they be in the same repository?
My rule of thumb is that if two projects are for the same client and are
related then they should be in the same repository, otherwise separate
repositories are my choice.
> There's then the question of folder structure in the repository.
>
> Can I (sort of) "mirror" the webserver layout from the /data folder
> downwards, bearing in mind that there exist existing files on the server
> that must not be included in the repository and, equally importantly,
> must not be overwritten when the repository contents are checked out or
> updated onto the respective webservers?
I always "mirror" the directory and file layout of the project(s) in the
repository, even when directories and/or files must not be touched/managed.
> (This would possibly involve some horrible 'ignore' properties, assuming
> I understand them properly and it would even be possible?)
>
> From my experience of svn so far, it appears that it expects you to
> create an empty folder where you then check out your working copy,
> which seems to suggest against being able to check out a copy into
> a folder containing existing files (which you do not want to overwrite).
svn has no problems making a checkout to a directory with existing content.
I frequently do that.
> Is my only option then to only start the file structure from the
> top-most folder that will be under version control? (So that the files
> that should not be tampered with are 'above' this level and so are
> safely out of the way?)
Make a backup before doing anything else! Just saying.
> (eg, svn would contain a folder 'php' corresponding to
> /data/webs/site2/php for site2, and [various] folders for the [various]
> "roots" for site1. If site1 had been following "the rules" then its code
> files would also have been in a corresponding 'php' folder, but this
> wouldn't be a unique name at this level, implying the need for site1/php
> and site2/php in the repository (but would that cause the problem that the
> other unmanaged files/folders on the webservers under site1 and site2
> wouldn't be "safe" from over-writing?))
I get the impression that the code you are working with will need some major
reorganization. I would do the following in this situation.
1) Make a backup.
2) Verify the backup.
3) Create a repository.
4) Create a "old" branch and put *all* files in it.
5) Start reorganizing the code by copying from the old branch to trunk and
change paths in code as needed. Use the "svn copy" instead of just file copy
to preserve file history.
Regards.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iF4EAREIAAYFAlGQ5sIACgkQGQjO2ccW76pYDwD/cNaTwVE/jaFBxKElG8K8eJ6p
jXIZP31MoQi+v/0LqAQA/0X/2D7wJNtT9G9OgET4J/K6f7hzAlgUFG1fr8eoyr0W
=sWVm
-----END PGP SIGNATURE-----