Difference between revisions of "Subversion"

From Christoph's Personal Wiki
Jump to: navigation, search
(See also)
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
  
 
===Available subcommands===
 
===Available subcommands===
  add
+
add
  blame (praise, annotate, ann)
+
blame (praise, annotate, ann)
  cat
+
cat
  checkout (co)
+
checkout (co)
  cleanup
+
cleanup
  commit (ci)
+
commit (ci)
  copy (cp)
+
copy (cp)
  delete (del, remove, rm)
+
delete (del, remove, rm)
  diff (di)
+
diff (di)
  export
+
export
  help (?, h)
+
help (?, h)
  import
+
import
  info
+
info
  list (ls)
+
list (ls)
  lock
+
lock
  log
+
log
  merge
+
merge
  mkdir
+
mkdir
  move (mv, rename, ren)
+
move (mv, rename, ren)
  propdel (pdel, pd)
+
propdel (pdel, pd)
  propedit (pedit, pe)
+
propedit (pedit, pe)
  propget (pget, pg)
+
propget (pget, pg)
  proplist (plist, pl)
+
proplist (plist, pl)
  propset (pset, ps)
+
propset (pset, ps)
  resolved
+
resolved
  revert
+
revert
  status (stat, st)
+
status (stat, st)
  switch (sw)
+
switch (sw)
  unlock
+
unlock
  update (up)
+
update (up)
  
 
==Howto setup a svn repository==
 
==Howto setup a svn repository==
Line 94: Line 94:
  
 
==See also==
 
==See also==
*[http://git.or.cz/ Git] — Fast Version Control System
+
* [[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.

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

External links