> Okay, attached is a pre-commit hook script for that purpose. How does that deal with deletions? What do you think about the attached alternative?
Regards, Martin
#!/usr/bin/env python from svn import repos, fs, core import sys from StringIO import StringIO from reindent import Reindenter repos_handle = repos.open(sys.argv[1]) fs_handle = repos.fs(repos_handle) txn_handle = fs.open_txn(fs_handle, sys.argv[2]) txn_root = fs.txn_root(txn_handle) interesting_changes = (fs.path_change_add, fs.path_change_replace, fs.path_change_modify) bad = 0 for path, change in fs.paths_changed(txn_root).iteritems(): if not path.endswith('.py'):continue if change.change_kind not in interesting_changes: continue if not change.text_mod: continue content = StringIO() file = fs.file_contents(txn_root, path) while 1: data = core.svn_stream_read(file, 100000) if not data: break content.write(data) content.seek(0) reindenter = Reindenter(content) if reindenter.run(): print >>sys.stderr, "file %s is not whitespace-normalized" % path bad += 1 if bad: sys.exit(1)
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com