Subversion

From miki
Jump to navigation Jump to search

References

Configuration

  • Colored diff — Either define colordiff as diff-cmd in ~/.subversion/config:
  • diff-cmd = colordiff
    

    However, to keep the internal svn diff tool, you need to define your own function & alias. This will also highlight diff header in green:

    function svnwrap()
    {
        if [ "$1" = "diff" ] ; then
    		"svn" "$@" | colordiff | less -FRX
    	else
    		"svn" "$@"
    	fi
    }
    alias svn=svnwrap
    

    To page the output, use | less -R

Workflows

Branch integration

From [1]:

  • Create a new branch off the trunk
  • Work on the branch
  • Merge (reintegrate) the branch into trunk
cd trunk
svn merge --reintegrate ^/branches/topic
svn commit
# Committed revision 555. 
# # this revision is ^^^^ important
  • From now on:
    • Either delete the branch
      svn delete ^/branches/topic
      
    • Or merge trunk back to the branch so that subsequent merges do not generate conflicts.
      This steps is necessary to tell svn that it should ignore the merged revision on the trunk at the next branch reintegration):
cd branches/topic
svn merge --record-only -c 555 ^trunk
svn commit

Commands

status (st)

Show modified/new/... files in the working copy.

svn status

propget (pg)

svn propget svn:mergeinfo

info

svn info .
svn info /dir/file

HTTPS Client Certificates

References:

Besides requiring a password, access to a svn repository through HTTPS may also require a client-side certificate. In that case, svn is smart enough to prompt for the location of the file containing the certificate and private key and for the password.

This can also be configured in the file ~/.subversion/servers:

[groups]
myserver = *.myserver.org

# This contains the settings for group "myserver". 
# ! paths must be absolute !
# Client certificates are in format .p12 (same as .pfx), as generated by openssl pkcs12
[myserver]
#The file containing your client certificate
ssl-client-cert-file = /home/user/.subversion/clientcert.p12
#This gives a list of CA to use to authenticate the server certificate
ssl-authority-files = /absolute/path/to/cacert.pem,/absolute/path/to/root.pem

# Add the following to prevent SVN storing your passwords:
[auth]
store-passwords = no
store-auth-creds = no


Changing the client certificate password

See SSL for instructions on how to change the client certificate password.

How-To

re-fetch a range of revisions

See [2]:

# Re-fetch from revision 2010:
git svn reset -r 2010
git svn fetch

Examples

  • Checking out a project
svn co svn+ssh://ftp.noekeon.org/opt/www/daemenj/web/private/SVN/Keccak