Another quick subversion script. This Python script automatically scans through a ‘ status’ report and automatically removes missing files and adds new files to your subversion repository. Of course you’ll need to commit the changes (or revert back if you made a mistake). This script is a quick and easy way of making a subversion repository match your working directory.
#!/usr/bin/python
import popen2
import re
import os
stdout, stderr = popen2.popen2(' status')
theRegex = re.compile('^(.)[ \t]+(.+)$')
theLines = stdout.readlines()
for theLine in theLines:
try:
theLine = theLine[:-1]
theMatch = theRegex.match(theLine)
theStatus = theMatch.groups()[0]
theFile = theMatch.groups()[1]
theOperation = None
if theStatus == '!':
theOperation = 'delete';
elif theStatus == '?':
theOperation = 'add';
if theOperation:
theCommand = ' %s \'%s\'' % (theOperation, theFile)
os.system(theCommand)
except:
pass
Add New Comment
Viewing 3 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment