You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Robert Paulsen <ro...@paulsenonline.net> on 2006/03/19 15:03:50 UTC

Use of Subversion to track existing directory

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?

Bob

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

Re: Use of Subversion to track existing directory

Posted by Saulius Grazulis <gr...@akl.lt>.
On Sunday 19 March 2006 17:03, Robert Paulsen wrote:

> I can create the repository:
>
>         svnadmin create /srv/svn/repos/myfiles/
> I know I could create a directory structure with trunk, tags, branches

svn mkdir file:///srv/svn/repos/myfiles/trunk
svn mkdir file:///srv/svn/repos/myfiles/branches
svn mkdir file:///srv/svn/repos/myfiles/tags

Or even better like this:

svn mkdir file:///srv/svn/repos/myfiles/{trunk,branches,tags}

Works on Unix-like systems under bash or tcsh.

(this will give only one revision bump instead of 3).

> import from there but that seems round-about.
> Is there a way to work with
> the existing data using add, copy, checkout, etc, commands?

Try this method:

cd working-copy
svn co file:///srv/svn/repos/myfiles/trunk
svn add *
svn ci

Hope this helps,

-- 
Saulius Gražulis

Visuomeninė organizacija "Atviras Kodas Lietuvai"
P.Vileišio g. 18
LT-10306 Vilnius
Lietuva (Lithuania)

tel/fax:      (+370-5)-210 40 05
mobilus:      (+370-684)-49802, (+370-614)-36366

Re: Use of Subversion to track existing directory

Posted by Robert Paulsen <ro...@paulsenonline.net>.
On Sunday 19 March 2006 09:38, Ryan Schmidt wrote:
> On Mar 19, 2006, at 16:22, Saulius Grazulis wrote:
> > I was also thinking that in-the-repo commands will add multiple
> > revision up to
> > this minute, but I have just checked -- you can create all
> > structure with a
> > single 'svn mkdir' command (and thus with a single revision):
> >
> > svn mkdir file://path/to/repo/{trunk,branches,tags}
> >
> > Which is just a shortcut for:
> >
> > svn mkdir file://path/to/repo/trunk file://path/to/repo/branches
> > file://path/to/repo/tags
>
> Indeed, I didn't know svn mkdir accepted multiple URLs. That works
> great! I'll have to remember that.
>

Ryan and Saulius,

Thanks for the info. "svn mkdir" was the key.

I did basically the following:

	svnadmin create /path/to/repos/mydata
	svn mkdir file:///path/to/repos/mydata/{trunk,tags,branches}
	cd /some/path/   # contains mydata as subdir
	svn co file:///path/to/repos/mydata/trunk mydata
	cd mydata
	svn add *
	svn ci
	svn copy  file:///path/to/repos/mydata/trunk \
		  file:///path/to/repos/mydata/tags/initial

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

Re: Use of Subversion to track existing directory

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 19, 2006, at 16:22, Saulius Grazulis wrote:

> I was also thinking that in-the-repo commands will add multiple  
> revision up to
> this minute, but I have just checked -- you can create all  
> structure with a
> single 'svn mkdir' command (and thus with a single revision):
>
> svn mkdir file://path/to/repo/{trunk,branches,tags}
>
> Which is just a shortcut for:
>
> svn mkdir file://path/to/repo/trunk file://path/to/repo/branches
> file://path/to/repo/tags

Indeed, I didn't know svn mkdir accepted multiple URLs. That works  
great! I'll have to remember that.



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

Re: Use of Subversion to track existing directory

Posted by Saulius Grazulis <gr...@akl.lt>.
On Sunday 19 March 2006 17:18, Ryan Schmidt wrote:

> 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.

I was also thinking that in-the-repo commands will add multiple revision up to 
this minute, but I have just checked -- you can create all structure with a 
single 'svn mkdir' command (and thus with a single revision):

svn mkdir file://path/to/repo/{trunk,branches,tags}

Which is just a shortcut for:

svn mkdir file://path/to/repo/trunk file://path/to/repo/branches 
file://path/to/repo/tags

-- 
Saulius Gražulis

Visuomeninė organizacija "Atviras Kodas Lietuvai"
P.Vileišio g. 18
LT-10306 Vilnius
Lietuva (Lithuania)

tel/fax:      (+370-5)-210 40 05
mobilus:      (+370-684)-49802, (+370-614)-36366

Re: Use of Subversion to track existing directory

Posted by Ryan Schmidt <su...@ryandesign.com>.
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