[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Adding existing project to new install

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-04-20 01:33:27 CEST

On Apr 19, 2007, at 14:57, Mail List wrote:

> I have been working on a project for the last 6 weeks.
>
>
>
> I have saved every week a complete copy of the progress made in
> separate folders each named by the week the work was completed, and
> then the folder gets duplicated under the new week name.
>
>
>
> Feb_week1
>
> Feb_week2
>
> Feb_week3
>
> Feb_week4
>
>
>
> Now I found out about subversion and installed, I want to add these
> folder collection to the repository ( 99% of the content is the
> same, there are just the few changes made during each work week)
>
>
>
> I would like to
>
>
>
> Feb_week1 to be the head version
>
>
>
> Feb_week2 Be imported / added as Version 2
>
> Feb_week3 Be imported / added as Version 3
>
> Feb_week4 Be imported / added as Version 4
>
>
>
> I want to keep the HEAD version INTACT in case I have to revert
> back to it, but also I would like to add the work done after the
> head version in to the system.

First of all, you are misunderstanding what "HEAD" means. HEAD is the
most-recent version of the repository, not the first version.

You can accomplish your task by importing Feb_week1 as usual with the
"svn import" command, then using the "svn_load_dirs.pl" script to
load the remaining weeks on top of the first one. The
svn_load_dirs.pl script will also "tag" your imported versions with a
name you give it, so that you can refer to these stages by name
later. You should also tag the version you import initially.

svn_load_dirs.pl is included with the Subversion source distribution
(but not with the binary distributions). Here is its read-me:

http://svn.collab.net/viewvc/svn/tags/1.4.3/contrib/client-side/
svn_load_dirs.README?view=markup

And here's the script itself:

http://svn.collab.net/viewvc/svn/tags/1.4.3/contrib/client-side/
svn_load_dirs.pl.in?view=markup

(Replace "@SVN_BINDIR@" in the script with the prefix where
Subversion is installed on your system.)

Here's how you would import your directories:

### Create a repository.

svnadmin create /path/to/myrepo

PROJECT=file:///path/to/myrepo/myproject

### Set up empty directories for the project.

svn mkdir \
$PROJECT \
-m "Creating directory for myproject"

svn mkdir \
$PROJECT/branches \
-m "Creating branches directory for myproject"

svn mkdir \
$PROJECT/tags \
-m "Creating tags directory for myproject"

### Import the initial version of the project as the trunk and tag it.

svn import \
/path/to/Feb_week1 \
$PROJECT/trunk \
-m "Importing Feb_week1 into trunk"

svn copy \
$PROJECT/trunk \
$PROJECT/tags/Feb_week1 \
-m "Tagging trunk as Feb_week1"

### Import and tag subsequent versions using svn_load_dirs.pl

svn_load_dirs.pl -t Feb_week2 $PROJECT trunk tags/Feb_week2

svn_load_dirs.pl -t Feb_week3 $PROJECT trunk tags/Feb_week3

svn_load_dirs.pl -t Feb_week4 $PROJECT trunk tags/Feb_week4

At the end of all this, your repository will have this structure:

/myproject/
        trunk/
                <your files>
        branches/
        tags/
                Feb_week1/
                        <your files>
                Feb_week2/
                        <your files>
                Feb_week3/
                        <your files>
                Feb_week4/
                        <your files>

The tags represent the snapshots of your work at different points in
time. At this point the trunk is identical to the Feb_week4 tag, but
now you will check out a working copy of the trunk and continue to
improve it, committing after every logical change (more often than
once a week, please!). When you reach another point that you would
like to remember with a snapshot, you can make a new tag from the
trunk again using "svn copy" as above.

Any questions? Please ask! You can also read more about
svn_load_dirs.pl and this strategy in the book chapter on Vendor
Branches (because this strategy is most often used to import sources
from 3rd-party vendors):

http://svnbook.red-bean.com/en/1.2/svn.advanced.vendorbr.html

-- 
To reply to the mailing list, please use your mailer's Reply To All  
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Apr 20 01:33:59 2007

This is an archived mail posted to the Subversion Users mailing list.