Skip to content

Instantly share code, notes, and snippets.

@basuke
Last active March 3, 2022 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basuke/e7ef900e7659333d6893ebf1b153288f to your computer and use it in GitHub Desktop.
Save basuke/e7ef900e7659333d6893ebf1b153288f to your computer and use it in GitHub Desktop.
Quick svn equivalent of Git clean and restore
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