You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by barophobia <ba...@gmail.com> on 2007/06/02 17:01:43 UTC

Beginner questions: repository versus project, import command, and others

Hello,

I'm really confused by Subversion.

The Subversion documentation says:

$ svnadmin create /usr/local/svn/newrepos
$ svn import mytree file:///usr/local/svn/newrepos/some/project \
             -m "Initial import"

1. Why would someone put their repository under ./svn ? e.g. (as
above) /usr/local/svn/newrepos. Why not make the repository simply
/usr/local/svn?

2. Do I need to execute the 'svnadmin create' command each time I
start a new development project? OR do I just need to execute the 'svn
import' command and put that new project under my first repository?

3. Before I perform the import am I supposed to manually create the
project directory and the trunk, branches, and tags directories?

4. When I do the import do I import into /usr/local/svn/project/trunk?
OR just /usr/local/svn/project?



Thanks for your help everyone!
Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Beginner questions: repository versus project, import command, and others

Posted by Hari Kodungallur <hk...@gmail.com>.
On 6/2/07, barophobia <ba...@gmail.com> wrote:
>
> Hello,
>
> I'm really confused by Subversion.
>
> The Subversion documentation says:
>
> $ svnadmin create /usr/local/svn/newrepos
> $ svn import mytree file:///usr/local/svn/newrepos/some/project \
>              -m "Initial import"
>
> 1. Why would someone put their repository under ./svn ? e.g. (as
> above) /usr/local/svn/newrepos. Why not make the repository simply
> /usr/local/svn?


This is only an example, you don't *have* to follow it. Personally, I would
not put my repository anywhere under /usr.


2. Do I need to execute the 'svnadmin create' command each time I
> start a new development project? OR do I just need to execute the 'svn
> import' command and put that new project under my first repository?


You need to run 'svnadmin create' only once per repository. Unless you want
to create another repository, you will keep checking into (or importing
into) the repository already created.


3. Before I perform the import am I supposed to manually create the
> project directory and the trunk, branches, and tags directories?


Once the repository is created using 'svnadmin create', the svn repository
is set. Usually we all already have a set of files that we want to import.
You might want to decide the repository layout that you want to have and
then lay your existing files out in that structure. Then import it. That
does not mean to say that you *have* to import it. Once the repository is
created, you can do, for example:

svn mkdir file:///usr/local/svn/projects/trunk -m "my comment"
svn mkdir file:///usr/local/svn/projects/branch -m "my comment"
svn mkdir file:///usr/local/svn/projects/tags -m "my comment"

svn co file:///usr/local/svn/projects/trunk mytrunk

<copy files to mytrunk directory>
svn add mytrunk/*
svn ci mytrunk -m "my comment"

You can certainly do the above set of commands. But import will all that for
you, if you have laid out the initial set of files and you just import it at
once.


4. When I do the import do I import into /usr/local/svn/project/trunk?
> OR just /usr/local/svn/project?


Depends on what you import. You just have to remember that when you do 'svn
import <directory> <PATH>', the contents of the directory (and not the
<directory> itself) is imported into <PATH>.

That is, say you have:

my-working-dir
  - project
     - trunk
         <files>

If you do 'svn import my-workomg-dir/project <PATH>', then everything from
trunk, including trunk will be imported.
If you do 'svn import my-workomg-dir/project/trunk <PATH>', then everything
under trunk, not including trunk will be imported.

So the answer to your question depends on the local file structure you have
and where exactly in the repository you want those files imported.


Hope it helps.

regards,
-Hari Kodungallur

Re: Beginner questions: repository versus project, import command, and others

Posted by Thomas Harold <tg...@tgharold.com>.
barophobia wrote:
> I'm really confused by Subversion.
> 
> The Subversion documentation says:
> 
> $ svnadmin create /usr/local/svn/newrepos
> $ svn import mytree file:///usr/local/svn/newrepos/some/project \
>             -m "Initial import"
> 
> 1. Why would someone put their repository under ./svn ? e.g. (as
> above) /usr/local/svn/newrepos. Why not make the repository simply
> /usr/local/svn?

There are (2) major pieces to the SVN system:

a) The repository.  Which is either a BerkleyDB or a FSFS storage area 
that holds all of the revisions for all of the files checked into the 
SVN system.  This location is typically access via either directly 
(file: URLs) or through other methods (svn+ssh: or http: or https: or 
svn: URLs).  If it is located on the local filesystem (i.e. in 
/usr/local/svn/repositoryname or /var/svn/repositoryname or 
~/svn/repositoryname or C:\SVN\MyRepository) then you'll use the file:// 
URL to talk to it.

b) The working copy.  This is where you do your development work.  It is 
typically some location under your home directory (i.e. ~/myproject or 
C:\Dev\MyProject).  You will edit files here, make changes, compile 
stuff, then check it into the repository.  Working copy folders will be 
peppered with .svn or _svn hidden sub-folders that keep track of 
information that SVN needs to know in order to match up the working copy 
with the repository.

So in the documentation:

/usr/local/svn/newrepos - this is the repository location.  Anything 
below this path is a project within the "newrepos" repository.

file:///usr/local/svn/newrepos/some/project - this is a project folder 
within the SVN repository that is 2 levels deep in the repository 
(some/project)

mytree - this is your local working area where you were doing 
development work prior to SVN, it is also the directory that you are 
loading into the repository so that it will be under version control

/usr/local/svn - while you could make the repository in this directory, 
it's better to create a sub-directory (newrepos) so that you can create 
other repositories down the road.

> 2. Do I need to execute the 'svnadmin create' command each time I
> start a new development project? OR do I just need to execute the 'svn
> import' command and put that new project under my first repository?

Well, that depends on whether you want a new repository for each 
project, or if you want to have multiple projects in the same repository.

It's important to keep track of what part of the URL denotes the 
location of the repository and what part of the URL denotes a location 
within the repository.

/usr/local/svn/newrepos/ -- the repository base URL

     projectA/ -- a top level project (directory) within the repository
         trunk/
         branches/
         releases/

     projectB/ -- also a top level directory within the repository
         trunk/
         branches/
         releases/

Anything past /usr/local/svn/newrepos/ is a folder within the repository.

> 3. Before I perform the import am I supposed to manually create the
> project directory and the trunk, branches, and tags directories?

AFAIK, yes...  we did in-place importing

> 4. When I do the import do I import into /usr/local/svn/project/trunk?
> OR just /usr/local/svn/project?

Let's say you're going to have multiple projects in the same repository. 
  Your import location would probably be:

/usr/local/svn/newrepos/ProjectA/trunk/

When you start up the second project and import in existing code it 
would go under:

/usr/local/svn/newrepos/ProjectB/trunk/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org