Last active
March 3, 2022 01:48
-
-
Save basuke/e7ef900e7659333d6893ebf1b153288f to your computer and use it in GitHub Desktop.
Quick svn equivalent of Git clean and restore
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
import os | |
import shutil | |
import svn.local | |
def svn_clean(path): | |
for e in svn.local.LocalClient(path).status(): | |
if e.type_raw_name == 'unversioned': | |
name = e.name | |
if os.path.isdir(name): | |
shutil.rmtree(name) | |
else: | |
os.unlink(name) | |
def svn_restore(path): | |
return svn.local.LocalClient(path).run_command('revert', ['--depth=infinity', path]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment