Difference between revisions of "Subversion"
(Adding quick usage guide) |
|||
| Line 2: | Line 2: | ||
*http://svn.peerix.org/peerix | *http://svn.peerix.org/peerix | ||
*http://svn.organicdesign.co.nz/peerix | *http://svn.organicdesign.co.nz/peerix | ||
| − | |||
| − | |||
| Line 11: | Line 9: | ||
:<tt>svn ci -m comment</tt> | :<tt>svn ci -m comment</tt> | ||
Checkin - applies to the svn-structure that cwd is in | Checkin - applies to the svn-structure that cwd is in | ||
| + | |||
| + | =Usage= | ||
| + | To create a new repository on the server and import a directory of files; | ||
| + | cd /tmp | ||
| + | mkdir SERVER | ||
| + | svnadmin create /tmp/SERVER/newrepos | ||
| + | |||
| + | Create example file for upload | ||
| + | cd /tmp | ||
| + | mkdir MYTREE | ||
| + | echo '#!/usr/bin/perl -w\nprint "hello world";' > /tmp/MYTREE/helloWorld.pl | ||
| + | svn import /tmp/MYTREE file:///tmp/SERVER/newrepos/some/project | ||
| + | |||
| + | Listing the contents in the repository; | ||
| + | svn list file:///tmp/SERVER/newrepos/some/project | ||
| + | |||
| + | To make a local copy you need to use the checkout command. This creates a new directory (default called newrepos) which is a local copy of newrepos. | ||
| + | |||
| + | mkdir LOCAL | ||
| + | cd LOCAL | ||
| + | svn co file:///tmp/SERVER/newrepos/some/project/ # fetches project/test.pl | ||
| + | svn co file:///tmp/SERVER/newrepos/some/ # fetches some/project/test.pl | ||
| + | rm -rf /tmp/LOCAL | ||
| + | svn co file:///tmp/SERVER/newrepos/some/project/ /tmp/LOCAL # Creates LOCAL dir | ||
| + | |||
| + | Note: The directory the svn command is run in determines where the local checkout directories and files will end up. | ||
| + | |||
| + | Now that you have created a local copy all work should be conducted within it. There is a hidden directory called ''.svn'' which contains all the information required for the svn framework. | ||
| + | |||
| + | cd /tmp/LOCAL # Work in the lcoal copy of svn | ||
| + | |||
| + | To update a file on your LOCAL directory | ||
| + | cd /tmp/LOCAL | ||
| + | svn update # "." is updated | ||
| + | cd /tmp | ||
| + | svn update /tmp/LOCAL # Sepecifying path | ||
| + | |||
| + | Useful Checking command | ||
| + | svn status /tmp/LOCAL | ||
| + | <pre> | ||
| + | L abc.c # svn has a lock in its .svn directory for abc.c | ||
| + | M bar.c # the content in bar.c has local modifications | ||
| + | M baz.c # baz.c has property but no content modifications | ||
| + | X 3rd_party # this dir is part of an externals definition | ||
| + | ? foo.o # svn doesn't manage foo.o | ||
| + | ! some_dir # svn manages this, but it's either missing or incomplete | ||
| + | ~ qux # versioned as file/dir/link, but type has changed | ||
| + | I .screenrc # svn doesn't manage this, and is configured to ignore it | ||
| + | A + moved_dir # added with history of where it came from | ||
| + | M + moved_dir/README # added with history and has local modifications | ||
| + | D stuff/fish.c # this file is scheduled for deletion | ||
| + | A stuff/loot/bloo.h # this file is scheduled for addition | ||
| + | C stuff/loot/lump.c # this file has conflicts from an update | ||
| + | R xyz.c # this file is scheduled for replacement | ||
| + | S stuff/squawk # this file or dir has been switched to a branch | ||
| + | </pre> | ||
| + | |||
| + | To add a new file to the local svn copy, first make a new file within the drectory structure | ||
| + | cd /tmp/LOCAL | ||
| + | echo '#!/usr/bin/perl -w\nprint qq(hello world!);' > /tmp/LOCAL/helloWorld2.pl | ||
| + | svn add helloWorld2.pl | ||
| + | |||
| + | |||
| + | |||
| + | =Links= | ||
| + | *http://www.onlamp.com/pub/a/bsd/2005/08/11/FreeBSD_Basics.html?page=2 | ||
| + | *[http://www.chiark.greenend.org.uk/~sgtatham/svn.html Experiences With Subversion] | ||
| + | *http://www.abbeyworkshop.com/howto/misc/svn01/ | ||
| + | *http://centerstageproject.com/wiki/index.php/SVN_Tutorial | ||
Revision as of 01:52, 3 April 2007
- Commands
- svn co url
Checkout, creates dir of name url
- svn ci -m comment
Checkin - applies to the svn-structure that cwd is in
Usage
To create a new repository on the server and import a directory of files;
cd /tmp mkdir SERVER svnadmin create /tmp/SERVER/newrepos
Create example file for upload
cd /tmp mkdir MYTREE echo '#!/usr/bin/perl -w\nprint "hello world";' > /tmp/MYTREE/helloWorld.pl svn import /tmp/MYTREE file:///tmp/SERVER/newrepos/some/project
Listing the contents in the repository;
svn list file:///tmp/SERVER/newrepos/some/project
To make a local copy you need to use the checkout command. This creates a new directory (default called newrepos) which is a local copy of newrepos.
mkdir LOCAL cd LOCAL svn co file:///tmp/SERVER/newrepos/some/project/ # fetches project/test.pl svn co file:///tmp/SERVER/newrepos/some/ # fetches some/project/test.pl rm -rf /tmp/LOCAL svn co file:///tmp/SERVER/newrepos/some/project/ /tmp/LOCAL # Creates LOCAL dir
Note: The directory the svn command is run in determines where the local checkout directories and files will end up.
Now that you have created a local copy all work should be conducted within it. There is a hidden directory called .svn which contains all the information required for the svn framework.
cd /tmp/LOCAL # Work in the lcoal copy of svn
To update a file on your LOCAL directory
cd /tmp/LOCAL svn update # "." is updated cd /tmp svn update /tmp/LOCAL # Sepecifying path
Useful Checking command
svn status /tmp/LOCAL
L abc.c # svn has a lock in its .svn directory for abc.c
M bar.c # the content in bar.c has local modifications
M baz.c # baz.c has property but no content modifications
X 3rd_party # this dir is part of an externals definition
? foo.o # svn doesn't manage foo.o
! some_dir # svn manages this, but it's either missing or incomplete
~ qux # versioned as file/dir/link, but type has changed
I .screenrc # svn doesn't manage this, and is configured to ignore it
A + moved_dir # added with history of where it came from
M + moved_dir/README # added with history and has local modifications
D stuff/fish.c # this file is scheduled for deletion
A stuff/loot/bloo.h # this file is scheduled for addition
C stuff/loot/lump.c # this file has conflicts from an update
R xyz.c # this file is scheduled for replacement
S stuff/squawk # this file or dir has been switched to a branch
To add a new file to the local svn copy, first make a new file within the drectory structure
cd /tmp/LOCAL echo '#!/usr/bin/perl -w\nprint qq(hello world!);' > /tmp/LOCAL/helloWorld2.pl svn add helloWorld2.pl



