Subversion: Difference between revisions
(→How-To) |
|||
(One intermediate revision by the same user not shown) | |||
Line 25: | Line 25: | ||
== Workflows == |
== Workflows == |
||
=== Create default folder layout === |
|||
From [http://stackoverflow.com/questions/3859009/how-to-create-a-subversion-repository-with-standard-layout]: |
|||
<source lang=bash> |
|||
url=svn://somewhere |
|||
svn mkdir $url/$1/trunk $url/$1/branches $url/$1/tags -m "New project $1" --parents |
|||
</source> |
|||
Or on a repository that is already checked out: |
|||
<source lang=bash> |
|||
svn mkdir trunk branches tags |
|||
svn mv src trunk # Assuming we already have a dir 'src' that needs to be moved to trunk |
|||
svn commit -m "create default layout" |
|||
</source> |
|||
=== Branch integration === |
=== Branch integration === |
||
From [http://stackoverflow.com/questions/102472/subversion-branch-reintegration]: |
From [http://stackoverflow.com/questions/102472/subversion-branch-reintegration]: |
||
Line 98: | Line 112: | ||
See [[SSL]] for instructions on how to change the client certificate password. |
See [[SSL]] for instructions on how to change the client certificate password. |
||
== Server Admin == |
|||
=== Delete latest revision from database === |
|||
The trick is to create a dump of all revisions we want, and import them again with <code>svnadmin</code>. |
|||
For instance, say we 100 revision, and we want to delete the last one: |
|||
<source lang=bash> |
|||
svnadmin dump <path-to-repository> -r 0:99 > mydump.dump # Replace 99 as necessary |
|||
svnadmin create <new-repo-name> |
|||
< mydump.dump svnadmin load <new-repo-name> |
|||
</source> |
|||
== How-To == |
== How-To == |
Latest revision as of 09:15, 6 November 2014
References
- http://subversion.apache.org/, home of Apache SubVersion
- Subversion 1.5 Mergeinfo - Understanding the Internals
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
Create default folder layout
From [1]:
url=svn://somewhere
svn mkdir $url/$1/trunk $url/$1/branches $url/$1/tags -m "New project $1" --parents
Or on a repository that is already checked out:
svn mkdir trunk branches tags
svn mv src trunk # Assuming we already have a dir 'src' that needs to be moved to trunk
svn commit -m "create default layout"
Branch integration
From [2]:
- 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):
- Either delete the branch
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:
- SVN Client Certificate Guide
- Subversion client authentication using PKCS#12 based certificates - howto
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.
Server Admin
Delete latest revision from database
The trick is to create a dump of all revisions we want, and import them again with svnadmin
.
For instance, say we 100 revision, and we want to delete the last one:
svnadmin dump <path-to-repository> -r 0:99 > mydump.dump # Replace 99 as necessary
svnadmin create <new-repo-name>
< mydump.dump svnadmin load <new-repo-name>
How-To
re-fetch a range of revisions
See [3]:
# 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