Rob Gonda's Blog

SVN Obliterate

Subversion was been built and designed so you never lose any data no matter what… so there’s no way to permanently delete any data. Everything you delete you can actually bring back from the other world.

It may eventually be a problem… say one you the developers commit to intellectual protected code; there is no way to get rid of it.

There is an open bug track issue to solve this problem, but it seems that there will be no resolution any time soon.

The only way to actually get rid of something is to fully dump the entire repository, delete the existing one, filter the dump, create a new repository, and restore from the dump.

The following steps demonstrate the exactly how to proceed.

Windows Version

svnadmin dump svn_repos > .\dump
type .\dump | svndumpfilter exclude somefolder > .\dump2
STOP SVN Services
Backup svn_repos/conf folder
Delete svn_repos folder
svnadmin create svn_repos
Restore svn_repos/conf folder
svnadmin load svn_repos < dump2

Linux Version
svnadmin dump /path/to/repos > proj.dump
cat proj.dump | svndumpfilter exclude somefolder > cleanproj.dump
STOP SVN services
BACKUP /path/to/repos/conf /path/to/repos/hooks (all custom configuration for this repository)
DELETE /path/to/repos
svnadmin create /path/to/repos
RESTORE /path/to/repos/conf /path/to/repos/hooks
svnadmin load /path/to/repos < cleanproj.dump
RESTART SVN services

*** modified 4/25/06: Added Linux Version from textsnippets

Xpath for ActionScript

I was implementing xpath for actionscript and I came across a couple of options. Flash MX 2004 has an undocumented built-in xpath class. You can access this class by dragging the DataBindingClass to the stage (windows – other panels – classes) and then importing the mx.xpath.XPathAPI. It works fine as I demonstrate in the following example.

import mx.xpath.XPathAPI;

var rssfeed_xml = new XML("<xml><level id='1' price='100'>first Level</level><level id='2' price='200'>second Level</level><level id='3' price='300'>third Level</level></xml>");
rssfeed_xml.ignoreWhite = true;

var titlePath:String = "/xml/level[@id=1]";
title_array = XPathAPI.selectNodeList(rssfeed_xml.firstChild, titlePath);

for (var i = 0; i<title_array.length; i++) {
trace(title_array[i].attributes.id);
}

However, this API does not support greater than or less than comparissions.

So I downloaded the Xpath open source API from Factor Studio. Just down the file and unzip it into your F:\Documents and Settings\[user]\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes\ folder.

Then you can import it and use it at will. It supports greater and smaller than comparisons, plus it supports union or queries using the pipe character.

import com.xfactorstudio.xml.xpath.*;

var rssfeed_xml = new XML("<xml><level id='1' price='100'>first Level</level><level id='2' price='200'>second Level</level><level id='3' price='300'>third Level</level></xml>");

var levels = XPath.selectNodes(rssfeed_xml,"/xml/level[@price>150]");

for (var i = 0; i<levels.length; i++) {
    trace(levels[i].attributes.id);
}

import com.xfactorstudio.xml.xpath.*;

var rssfeed_xml = new XML("<xml><level id='1' price='100'>first Level</level><level id='2' price='200'>second Level</level><level id='3' price='300'>third Level</level></xml>");

var levels = XPath.selectNodes(rssfeed_xml,"/xml/level[@id=1] | /xml/level[@id=2]");

for (var i = 0; i<levels.length; i++) {
    trace(levels[i].attributes.id);
}

updated 12/4/2006: link updated for Factor Studio

This blog is running version 5.9.003. Contact Blog Owner