Created
October 17, 2011 16:41
-
-
Save jdunck/1293038 to your computer and use it in GitHub Desktop.
fabfile task to spot dupe-numbered south migrations
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
# this is intended to be run as part of a fab-suite, i.e. fab git_push, which runs tests, all files committed, etc. before pushing. | |
def ensure_no_duped_migrations(): | |
migration_dirs = local('find %s -type d -iname migrations' % ROOT_DIR, | |
True).split('\n') | |
for migration_dir in migration_dirs: | |
full_migration_dir = path.join(ROOT_DIR, migration_dir) | |
# FIXME: for GNU find, need regextype=posix-extended | |
dupe_checker = ("find -E %s -iregex '.*/[0-9]{4,}[^/]*\.py' -exec basename {} ';'| cut -d_ -f1 | sort | uniq -d" % | |
full_migration_dir) | |
any_match = local(dupe_checker, True) | |
if any_match: | |
abort("""The %s dir has same-numbered migrations. Fix this. | |
Don't just renumber, see http://south.aeracode.org/docs/tutorial/part5.html#team-workflow""" % | |
migration_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment