Craig's SVN notes


Reference:

Properties:

    (List properties)
    % svn proplist main.c
    Properties on 'main.c':
      svn:keywords
      svn:eol-style

    (Get properties)
    % svn propget svn:keywords main.c
    Author Date Id Revision

    (Set ignored file list)
    % svn propedit svn:ignore .

    (Set keywords)
    % svn propset svn:keywords 'Author Date Id Revision' main.c

    (Set end of line style)
    (Note: incompatible with configure scripts generated by autoconf 2.62)
    % svn propset svn:eol-style native main.c

    (Set executable)
    % svn propset svn:executable '*' install-sh

Initial creation:

    (local)
    % svnadmin create --fs-type fsfs /usr/src/svn/project
    % svn mkdir file:///usr/src/svn/project/trunk -m ''
    % svn mkdir file:///usr/src/svn/project/branches -m ''
    % svn mkdir file:///usr/src/svn/project/tags -m ''

Initial checkout:

    (HTTP)
    % svn checkout http://svn.icir.org/bro/trunk/bro bro-svn

    (SSH)
    % svn checkout svn+ssh://fred@nosuch.xyz/usr/src/svn/project/trunk project

    (local)
    % svn checkout file:///usr/src/svn/project/trunk project

Diff:

    (context)
    % svn diff -r70:72 main.c

    (straight)
    % svn diff --diff-cmd diff --extensions --normal -r70:72 main.c

    (whitespace)
    % svn diff --diff-cmd diff --extensions '--normal -i' -r70:72 main.c

    (whitespace and ignore case)
    % svn diff --diff-cmd diff --extensions '--normal -iw' -r70:72 main.c

Tagging:

    % svn copy file:///usr/src/svn/project/trunk \
	file:///usr/src/svn/project/release-1.3 -m "release-1.3"

Edit a log message:

    (Enable on the repo system)
    % cd /usr/src/svn/project/hooks && \
	cp -pi pre-revprop-change.tmpl pre-revprop-change && \
	chmod +x pre-revprop-change

    (Edit last commited version)
    % svn propedit -rHEAD --revprop svn:log

    (Edit in a working copy)
    % svn propedit -r58 --revprop svn:log

    (Edit on the repo system)
    % svn propedit -r58 --revprop svn:log \
	file:///usr/src/svn/project

    (Edit from a different host)
    % svn propedit -r58 --revprop svn:log \
	svn+ssh://fred@nosuch.xyz/usr/src/svn/project

Revision dates:

    svn log -r '{2012-01-19}'
    svn log -r '{16:00:00}'

.subversion/config:

    (Don't forward ssh creds, X11 or ports)
    ssh = ssh -ax -o clearallforwardings=yes

    (Default svn keywords)
    *.c = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.h = svn:eol-style=native;svn:keywords=Author Date Id Revision

Switch the repository root:

    % svn switch --relocate \
	file:///usr/src/svn/apache24-conf \
	file:///usr/src/svn/crd-apache24-conf

Undelete a file:

First find the revision you want;

    % svn log -v | more
Then copy the file into your working tree:

    % svn copy file:///usr/src/svn/project/test.c/@666 test2.c

Miscellaneous:

    % svn update
    % svn commit
    % svn status
    % svn info

RCS and CVS to SVN:

RCS:


Craig Leres