tags:

views:

31

answers:

1

We have the following development model for a web site:

  • Developers work new stuff on their workstations, and commit to a central repository
  • A post-commit hook automatically updates a checkout of this repo on the test web server so they can see the effect of the changes
  • When a feature is considered stable enough, individual files are svn up-ed on the production web server
  • Files in the checked out copies on the test and production servers are never modified and as such never used to make commits back to the repo

Granted, this could be done much better, but the process started small and evolved to this point gradually. However we now want to introduce the "standard" trunk/branches/tags repo organization.

This question solved our initial concerns, and we now have the new directory structure in the repo and the test web server was switched to using the trunk. The problem is that we can't do the same for the production server, because svn switch would get us the HEAD revision of all files and we want current revisions.

I saw you can use -r BASE with svn switch, but when I do that, I get:

$ svn switch -r BASE https://old_URL/trunk
svn: 'https://old_URL' is not a working copy
svn: 'https://old_URL' does not exist

Any suggestions?

+1  A: 

Try the @PEGREV syntax:

C:\>svn help switch
switch (sw): Update the working copy to a different URL.
usage: 1. switch URL[@PEGREV] [PATH]
       2. switch --relocate FROM TO [PATH...]

Update

Please note that the branches, tags and trunk system is merely a naming convention. There's nothing special about those items in Subversion: they're only directories. So you have this:

r1: Add: /site/
    Add: /site/css
    Add: /site/img

    Repo:
        /site/
        /site/css
        /site/img

r2: Add: /branches
    Add: /tags
    Add: /trunk

    Repo:
        /branches
        /site/
        /site/css
        /site/img
        /tags
        /trunk

r3: Copy: /site/ to /trunk
    Delete: /site/

    Repo:
        /branches
        /tags
        /trunk
        /trunk/site/
        /trunk/site/css
        /trunk/site/img

If you have a working copy that points to /site r1, you cannot switch it /trunk/site r1: that path does not exist in the directory tree of r1.

As soon as your decide to release a new version, let's say r4, you'll be able to switch to /trunk/site r4; not before.

IMHO, you should probably create a branch (e.g. live or release) and make the live server point to its latest release. When you want to push new changes, you do a merge into that branch.

Álvaro G. Vicario
I get the exact same error...
Prof. Moriarty
I admit I'm not really sure of your layout... Did `trunk` already exist in the `BASE` revision? You cannot switch to trunk unless you move to a newer revision (after its creation).
Álvaro G. Vicario
No, `trunk` was created now, so everything in `BASE` is before `trunk`'s creation...
Prof. Moriarty
See my update then.
Álvaro G. Vicario
The last suggestion about a `release` branch is very good, I will convince the team to use it. However, I still can't solve my migration problem right now...
Prof. Moriarty
But, do you understand there's nothing to migrate right now?
Álvaro G. Vicario
I think I wasn't very good at explaining the problem. In the end the answer was using `svn export` to make a copy of the "working tree" on the production server, create the new branch, and recursively add all the files. Thanks for your help!
Prof. Moriarty
So, have you removed the history of all your files?
Álvaro G. Vicario