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

Re: Commits files to subversion from 2 different directories

From: Ryan Schmidt <subversion-2007a_at_ryandesign.com>
Date: 2007-01-14 19:06:05 CET

On Jan 14, 2007, at 10:27, ying lcs wrote:

> i have 2 directories of source code:
> 1. org-source
> 2. modified-source (org-source + modified source code, don't exactly
> remember which files have changed).
>
> and i want to use subversion to do version control. Here is what I
> did:
> 1. create a new repository 'source' in subversion
> 2. cd to org-source and
> svn import . file:///srv/svn/repositories/source --message
> "Initial import"
>
> Then, I want to
> 3: tag all the files in the source with a label called 'VERSION1"

Subversion does not do branching and tagging the way CVS does. You do
not "tag files with a label". Instead, you simply make a copy of your
files elsewhere, usually to a directory named "tags". The book
explains this more.

http://svnbook.red-bean.com/en/1.2/svn.branchmerge.tags.html

There's even an appendix for users coming to Subversion from CVS.

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

> 4: commit all files in the directory 'modified-source' to subversion
> so that subversion can figure out what files are different. And it
> will create a new version if the files is different and add the files
> to the repository if it is a new file.

You may want to use the svn_load_dirs.pl script which is included in
the Subversion source and is designed for this kind of scenario. It's
described in the vendor branching section of the book:

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

In particular here:

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

> 5. tag all the files in trunk with a label called VERSION2"

svn_load_dirs.pl can automatically create a tag of your newly-
imported version.

> Can you please tell me if step 3 and 4 are possible?

So putting this all together:

> 1. create a new repository 'source' in subversion

svnadmin create /srv/svn/repositories/source

> 2. cd to org-source and
> svn import . file:///srv/svn/repositories/source --message
> "Initial import"

For each new project, you should generally set up the recommended
"trunk" / "branches" / "tags" directory structure. The reasons are
explained in the book:

http://svnbook.red-bean.com/en/1.2/svn.branchmerge.using.html

So create these empty directories:

svn mkdir file:///srv/svn/repositories/source/trunk \
-m "Making trunk dir"
svn mkdir file:///srv/svn/repositories/source/branches \
-m "Making branches dir"
svn mkdir file:///srv/svn/repositories/source/tags \
-m "Making tags dir"

Then you can import the original source into the trunk.

svn import /path/to/org-source \
file:///srv/svn/repositories/source/trunk \
-m "Initial import"

> 3: tag all the files in the source with a label called 'VERSION1"

Create the "VERSION1" tag by copying the trunk to a new name in the
tags directory:

svn cp file:///srv/svn/repositories/source/trunk \
file:///srv/svn/repositories/source/tags/VERSION1 \
-m "Creating VERSION1 tag"

> 4: commit all files in the directory 'modified-source' to subversion
> so that subversion can figure out what files are different. And it
> will create a new version if the files is different and add the files
> to the repository if it is a new file.
>
> 5. tag all the files in trunk with a label called VERSION2"

Use svn_load_dirs.pl to load modified-source and tag it as VERSION2:

svn_load_dirs.pl \
-t tags/VERSION2 \
file:///srv/svn/repositories/source \
trunk \
/path/to/modified-source

-- 
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 Sun Jan 14 19:06:48 2007

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.