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

Re: Use of Subversion to track existing directory

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-03-19 16:18:35 CET

On Mar 19, 2006, at 16:03, Robert Paulsen wrote:

> I have an existing directory structure that I wish to track with
> subversion. I
> would like to use the trunk/tags/branches concept. What is the best
> way of
> going about this? The documentation examples all start with an
> import where
> the trunk, tags, and branches directories already exist in the
> original. This
> is not how my data is laid out.
>
> I can create the repository:
>
> svnadmin create /srv/svn/repos/myfiles/
>
> Now how do I create the trunk, tags and branches direstories in
> svn? I can't
> use svnadmin because that will create independent repositories.
>
> In the long run, I would like to be able to get a working copy of
> my files
> with something like the following on another system:
>
> svn co https://mysystem/repos/myfiles/trunk myfiles
>
> I know I could create a directory structure with trunk, tags,
> branches and
> import from there but that seems round-about. Is there a way to
> work with the
> existing data using add, copy, checkout, etc, commands?

Sounds like you want an in-place import, which is described here (and
also by me below):

http://subversion.tigris.org/faq.html#in-place-import

Yes, creating the trunk, tags and branches directories locally and
then importing it is the usual way, round-about though that is. The
only reason not to do it directly in the repository is that the
direct route will add multiple new revisions whereas importing an
empty structure would make only a single revision. So given:

export R=https://mysystem/repos

you could do either:

svn mkdir $R/myfiles \
-m "Making empty myfiles directory"
svn mkdir $R/myfiles/trunk \
-m "Making empty trunk directory"
svn mkdir $R/myfiles/tags \
-m "Making empty tags directory"
svn mkdir $R/myfiles/branches \
-m "Making empty branches directory"

(which adds 4 revisions) or:

mkdir myfiles-tmp
cd myfiles-tmp
mkdir trunk tags branches
cd ..
svn import myfiles-tmp $R/myfiles \
-m "Creating empty trunk / tags / branches directory structure for
myfiles"
rm -rf myfiles-tmp

(which adds 1 revision). Now you can check the empty trunk out into
your existing directory, which becomes your working copy:

cd /path/to/existing/directory
svn checkout $R/myfiles/trunk .

Now you can use "svn status" to see all your files which are not
versioned yet (which are of course all of them to begin with), and
"svn add" those files you want to add, and maybe set "svn:ignore" on
certain directories to ignore other files you don't want to add. Do
anything you would do in a normal working copy, basically, because
this now is a normal working copy. And you can check it out on
another machine with:

svn checkout $R/myfiles/trunk myfiles

On that other machine, however, the directory must not already exist,
or at least, the files which are in the repository must not already
exist in that directory on the other machine. If they do, perhaps you
are trying to version a part of your OS, like /etc? If so, then the
FSVS project may suit you better than plain Subversion:

http://fsvs.tigris.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Mar 19 16:19:43 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.