Skip to content

Commit

Permalink
Adding script to clean trunk (like svn-clean, but more platform-indep…
Browse files Browse the repository at this point in the history
…endent)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18195 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 19, 2013
1 parent 79db84a commit 67a40b3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions svn-clean.py
@@ -0,0 +1,23 @@
#!/usr/bin/env python
# http://stackoverflow.com/questions/239340/automatically-remove-subversion-unversioned-files

import os
import re

def removeall(path):
if not os.path.isdir(path):
os.remove(path)
return
files=os.listdir(path)
for x in files:
fullpath=os.path.join(path, x)
if os.path.isdir(fullpath):
removeall(fullpath)
else:
os.remove(fullpath)
os.rmdir(path)

unversionedRex = re.compile('^ ?[\?ID] *[1-9 ]*[a-zA-Z]* +(.*)')
for l in os.popen('svn status --no-ignore -v').readlines():
match = unversionedRex.match(l)
if match: removeall(match.group(1))

0 comments on commit 67a40b3

Please sign in to comment.