? Earlier 8 items total Later ?

On this page:?

Finding files to be added

svn add `svn st | grep '\?' | tr '\?' ' ' | xargs`

knowning how many commits it actually took you

If you use the same repository for mostly everything, you'll occasionally find it amusing that your brand new project is at r1800 or that that old project not touched since r60 now shares r2385 with everyone else.

Well, amusing != useful, so here's what I use when I'm curious about how many commits a certain project took me:

svn log --stop-on-copy | grep -e "--------" | wc -l

Recursively remove all .svn directories

find . -name .svn -print0 | xargs -0 rm -rf


Update: Thankyou iburrell

Using a pre-commit script (written in python)

For some odd reason tortoise SVN loves to commit empty commit sets. So I managed to get the following pre-commit script working under FreeBSD, seeing that the pre-commit.tmpl does not work as expected.

#!/usr/local/bin/python
"""
Subversion pre-commit hook which currently checks that the commit contains
a commit message to avoid commiting empty changesets which tortoisesvn seems
to have a habbit of committing.

Based on http://svn.collab.net/repos/svn/branches/1.2.x/contrib/hook-scripts/commit-block-joke.py
and hooks/pre-commit.tmpl

Hacked together by Jacques Marneweck 

$Id$
"""

import sys, os, string

SVNLOOK='/usr/local/bin/svnlook'

def main(repos, txn):
    log_cmd = '%s log -t "%s" "%s"' % (SVNLOOK, txn, repos)
    log_msg = os.popen(log_cmd, 'r').readline().rstrip('\n')

    if len(log_msg) < 10:
        sys.stderr.write ("Please enter a commit message which details what has changed during this commit.\n")
        sys.exit(1)
    else:
        sys.exit(0)

if __name__ == '__main__':
    if len(sys.argv) < 3:
        sys.stderr.write("Usage: %s REPOS TXN\n" % (sys.argv[0]))
    else:
        main(sys.argv[1], sys.argv[2])

Add all new files to svn repository

This saves considerable time, and it's recursive:

svn add --force *

Switching a working copy with subversion

If you find that the location to a subversion repository has changed, do this:

svn switch --relocate http://textpattern.com/svn/repos/current/textpattern http://svn.textpattern.com/current/textpattern


Where the old url is http://textpattern.com/svn/repos/current/textpattern

And the new one is http://svn.textpattern.com/current/textpattern

To see if it worked, do this:

svn info | grep URL


And you should see something like this:

URL: http://svn.textpattern.com/current/textpattern


(source: Switching a Working Copy)

Forcing an SVN export to overwrite a directory

You can run --force to make an SVN export overwrite a folder rather than write into it

cd /usr/local/etc/
svn export --force --username [email protected] --password apassword https://svn.textdrive.com/repos/setup/usr/local/etc/apache2

Clean Textpattern install from the current repository

In a shell, cd to the directory from which you'd like to serve the site, and rename or delete any '.htaccess' or 'index.php' files, and any directories called 'images' or 'files', that may be there.

Checkout the current code:

svn co http://svn.textpattern.com/current/ .


(Note the dot at the end). To complete the installation, just load http://thesiteurl/textpattern/ in a browser, fill in your database info, and when presented with the config.php block, copy it, go back to the shell client and:

nano textpattern/config.php


Paste in the code block, save and exit (ctrl-x, then y, then return).

Back to the browser, click through, add personal details, and that, as they say, is it.

Whenever you want to update to the latest code, cd to the same directory and:

svn update


...and the latest code will be seamlessly integrated with your installation.

? Earlier 8 items total Later ?