Subversion: Remove a Project

There is no straightforward way to remove all the information of a project from the SVN repository and retrieve that diskspace. The only way to achieve this:

  1. Dump the repository to a dumpfile.
    $ svnadmin dump C:\Foo_Rep > C:\foo_rep_dump
  2. Filter out the project you want to remove from the dumpfile.
    $ svndumpfilter exclude Project_to_del < C:\foo_rep_dump > C:\foo_rep_dump_updated

    If you have many projects that you want to remove, repeat this step for each of them.

  3. Create a new repository.
    $ svnadmin create C:\Foo_rep_new
  4. Load the updated dumpfile to new repository.
    $ svnadmin load C:\Foo_rep_new < C:\foo_rep_dump_updated
Advertisements

Python: all() & any()

# all(iterable) returns True if all elements in iterable are True for "if element:"
# any(iterable) returns True if any element in iterable is True for "if element:"

alist = [True, True, True]
all(alist) # True
any(alist) # True

blist = [True, 0, 1, "True"]
all(blist) # False, due to 0
any(blist) # True

clist = [True, 1, "False"]
all(clist) # True
any(clist) # True

dlist = [False, 0, [], None]
all(dlist) # False
any(dlist) # False

Python: Ternary Operator / Conditional Expression

# Conditional expression is Python's version of the C ternary operator (?:)
# Read PEP 308 for this design choice.

# Lots of lines for a simple initialization
alist = []
if solved:
    alist = solvedList
else:
    alist = problemList

# Conditional expression to achieve the above
alist = solvedList if solved else problemList