Created
May 17, 2012 12:32
-
-
Save dreyescat/2718612 to your computer and use it in GitHub Desktop.
Remove svn missing (removed by non-svn command) or incomplete files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from subprocess import check_output, call | |
if len(sys.argv) > 2: | |
sys.exit('Usage: {0} svn-folder'.format(sys.argv[0])) | |
svn_folder = sys.argv[1] if len(sys.argv) == 2 else '.' | |
output = check_output(['svn', 'status', svn_folder]) | |
if output: | |
for n, line in enumerate(output.split('\n')): | |
fields = line.split() | |
if len(fields) == 2: | |
if fields[0] == '!': | |
result = call(['svn', 'rm', fields[1]]) | |
print '{0} svn rm {1} {2}'.format(n, fields[1], result) | |
else: | |
print n, fields |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment