Created
November 14, 2019 17:12
-
-
Save petdance/56a2eb3c66a15526125b6ef958ccd6f6 to your computer and use it in GitHub Desktop.
trunkdiff-files
This file contains hidden or 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 python3 | |
import os | |
import re | |
status = re.compile('^(\\+\\+\\+|---) \\s+ ([^\t]+) \t .+ \t \\((.+?)\\)$', re.X) | |
deletes = [] | |
adds = [] | |
diffs = [] | |
with os.popen('svn diff svn+ssh://svn.flr.follett.com/svn/tw/trunk .') as f: | |
for line in f.readlines(): | |
match = status.search(line) | |
if match: | |
filename = match.group(2) | |
if filename == '.': | |
continue | |
if match.group(3) == 'nonexistent': | |
if match.group(1) == '---': | |
target = adds | |
else: | |
target = deletes | |
else: | |
target = diffs | |
if filename not in target: | |
target.append(filename) | |
for source in adds, deletes: | |
for i in source: | |
diffs.remove(i) | |
for i in adds, deletes, diffs: | |
i.sort() | |
for i in adds: | |
print(f'={i}') | |
for i in diffs: | |
print(i) | |
for i in deletes: | |
print(f'# DELETED {i}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment