Difference between revisions of "Subversion"
(→See also) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Subversion''' ('''SVN''') is a version control system. It allows users to keep track of changes made over time to any type of electronic data. Typical uses are versioning source code, web pages or design documents. | '''Subversion''' ('''SVN''') is a version control system. It allows users to keep track of changes made over time to any type of electronic data. Typical uses are versioning source code, web pages or design documents. | ||
− | The article will cover the Subversion command-line client (or just '''svn'') for version >= 1.4.3. | + | The article will cover the Subversion command-line client (or just '''svn''') for version >= 1.4.3. |
==Syntax== | ==Syntax== | ||
Line 13: | Line 13: | ||
===Available subcommands=== | ===Available subcommands=== | ||
− | + | add | |
− | + | blame (praise, annotate, ann) | |
− | + | cat | |
− | + | checkout (co) | |
− | + | cleanup | |
− | + | commit (ci) | |
− | + | copy (cp) | |
− | + | delete (del, remove, rm) | |
− | + | diff (di) | |
− | + | export | |
− | + | help (?, h) | |
− | + | import | |
− | + | info | |
− | + | list (ls) | |
− | + | lock | |
− | + | log | |
− | + | merge | |
− | + | mkdir | |
− | + | move (mv, rename, ren) | |
− | + | propdel (pdel, pd) | |
− | + | propedit (pedit, pe) | |
− | + | propget (pget, pg) | |
− | + | proplist (plist, pl) | |
− | + | propset (pset, ps) | |
− | + | resolved | |
− | + | revert | |
− | + | status (stat, st) | |
− | + | switch (sw) | |
− | + | unlock | |
− | + | update (up) | |
+ | |||
+ | ==Howto setup a svn repository== | ||
+ | ''Note: This 'howto' will show how to setup a Linux Subversion Server (repository), using [[SSH]] client access (using the <code>svn+ssh</code> protocol with <tt>svnserve -t</tt>).'' | ||
+ | |||
+ | *Step 1: Create a group for svn | ||
+ | groupadd svnusers | ||
+ | |||
+ | *Step 2: Set default permissions in the <code>.bashrc</code> file: | ||
+ | umask 002 # allow user + group to write, no other. | ||
+ | |||
+ | *Step 3: Create a <code>svnadm</code> user account: | ||
+ | useradd svnadm | ||
+ | Note that a default user might have already been added when svn was installed (e.g., user <code>svn</code>); you can use the default user, if you like. | ||
+ | |||
+ | *Step 4: Create a root path for the svn repositories: | ||
+ | mkdir -p /path/to/svn/repositories | ||
+ | and restrict access to this area only for root and svn users: | ||
+ | chown -R root.svnusers /path/to/svn/repositories | ||
+ | chmod -R u+wrx,g+wrx,o-wxr /path/to/svn/repositories | ||
+ | |||
+ | *Step 5: Create a svn project repository: | ||
+ | su svnadm # make sure you do this as user 'svnadm' | ||
+ | svnadmin create /path/to/svn/repositories/myproject | ||
+ | and restrict access via | ||
+ | chmod -R o-rwx /path/to/svn/repositories/myproject | ||
+ | |||
+ | *Step 6: Configure the (new) project: | ||
+ | vi /path/to/svn/repositories/myproject/conf/svnserve.conf | ||
+ | and add the following: | ||
+ | [general] | ||
+ | anon-access = none | ||
+ | auth-access = write | ||
+ | |||
+ | *Step 7: Test SSH client access (on localhost): | ||
+ | Log in to one of the svn users and try: | ||
+ | svn list svn+ssh://<user-id>@localhost/myproject | ||
+ | |||
+ | It should return a list of your project files. If it does, your svn repository is ready to use. | ||
+ | |||
+ | ===Firewall=== | ||
+ | If the above does not work, it could be that your firewall is not allowing the appropriate traffic in, out, or through. Make sure the following ports are open for svn: | ||
+ | svn 3690/tcp # Subversion | ||
+ | svn 3690/udp # Subversion | ||
+ | |||
+ | See [[iptables]] for examples on how to do this. | ||
==Examples== | ==Examples== | ||
*Typical "download" command: | *Typical "download" command: | ||
− | svn co https://pymmlib.svn.sourceforge.net/svnroot/pymmlib/trunk pymmlib | + | svn co <nowiki>https://pymmlib.svn.sourceforge.net/svnroot/pymmlib/trunk</nowiki> pymmlib |
+ | |||
+ | ==See also== | ||
+ | * [[Git]] — Fast Version Control System | ||
==External links== | ==External links== |
Latest revision as of 22:04, 22 August 2018
Subversion (SVN) is a version control system. It allows users to keep track of changes made over time to any type of electronic data. Typical uses are versioning source code, web pages or design documents.
The article will cover the Subversion command-line client (or just svn) for version >= 1.4.3.
Contents
Syntax
usage: svn <subcommand> [options] [args]
Type 'svn help <subcommand>' for help on a specific subcommand. Type 'svn --version' to see the program version and RA modules
or 'svn --version --quiet' to see just the version number.
Most subcommands take file and/or directory arguments, recursing on the directories. If no arguments are supplied to such a command, it recurses on the current directory (inclusive) by default.
Available subcommands
add blame (praise, annotate, ann) cat checkout (co) cleanup commit (ci) copy (cp) delete (del, remove, rm) diff (di) export help (?, h) import info list (ls) lock log merge mkdir move (mv, rename, ren) propdel (pdel, pd) propedit (pedit, pe) propget (pget, pg) proplist (plist, pl) propset (pset, ps) resolved revert status (stat, st) switch (sw) unlock update (up)
Howto setup a svn repository
Note: This 'howto' will show how to setup a Linux Subversion Server (repository), using SSH client access (using the svn+ssh
protocol with svnserve -t).
- Step 1: Create a group for svn
groupadd svnusers
- Step 2: Set default permissions in the
.bashrc
file:
umask 002 # allow user + group to write, no other.
- Step 3: Create a
svnadm
user account:
useradd svnadm
Note that a default user might have already been added when svn was installed (e.g., user svn
); you can use the default user, if you like.
- Step 4: Create a root path for the svn repositories:
mkdir -p /path/to/svn/repositories
and restrict access to this area only for root and svn users:
chown -R root.svnusers /path/to/svn/repositories chmod -R u+wrx,g+wrx,o-wxr /path/to/svn/repositories
- Step 5: Create a svn project repository:
su svnadm # make sure you do this as user 'svnadm' svnadmin create /path/to/svn/repositories/myproject
and restrict access via
chmod -R o-rwx /path/to/svn/repositories/myproject
- Step 6: Configure the (new) project:
vi /path/to/svn/repositories/myproject/conf/svnserve.conf
and add the following:
[general] anon-access = none auth-access = write
- Step 7: Test SSH client access (on localhost):
Log in to one of the svn users and try:
svn list svn+ssh://<user-id>@localhost/myproject
It should return a list of your project files. If it does, your svn repository is ready to use.
Firewall
If the above does not work, it could be that your firewall is not allowing the appropriate traffic in, out, or through. Make sure the following ports are open for svn:
svn 3690/tcp # Subversion svn 3690/udp # Subversion
See iptables for examples on how to do this.
Examples
- Typical "download" command:
svn co https://pymmlib.svn.sourceforge.net/svnroot/pymmlib/trunk pymmlib
See also
- Git — Fast Version Control System