From d6383b50c3af4b39235d2c68bc9a8e7d428801fd Mon Sep 17 00:00:00 2001 From: Ivo van der Wijk Date: Thu, 4 Oct 2012 11:58:31 +0200 Subject: [PATCH] provide way to specify number of lines of context --- nashvegas/management/commands/comparedb.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nashvegas/management/commands/comparedb.py b/nashvegas/management/commands/comparedb.py index 5a6a57a..7427c3e 100644 --- a/nashvegas/management/commands/comparedb.py +++ b/nashvegas/management/commands/comparedb.py @@ -29,6 +29,11 @@ class Command(BaseCommand): default=DEFAULT_DB_ALIAS, help="Nominates a database to synchronize. " "Defaults to the \"default\" database."), + make_option("-l", "--lines-of-context", + action="store", + dest="lines", + default=10, + help="Show this amount of context."), ) help = "Checks for schema differences." @@ -51,6 +56,7 @@ def handle(self, *args, **options): self.db = options.get("database", DEFAULT_DB_ALIAS) self.current_name = connections[self.db].settings_dict["NAME"] self.compare_name = options.get("db_name") + self.lines = options.get("lines") if not self.compare_name: self.compare_name = "%s_compare" % self.current_name @@ -79,4 +85,5 @@ def handle(self, *args, **options): print "Outputing diff between the two..." print "".join(difflib.unified_diff(normalize_sql(current_sql), - normalize_sql(new_sql))) + normalize_sql(new_sql), + n=int(self.lines)))