]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/research.py
Convert ad hoc shell calls to singleton instance; fix upgrade bug.
[wizard.git] / wizard / command / research.py
index add825b44e8278fae20738e19fc46ffd7a22902c..d36a850923d961f375440c115e59d600982ea401 100644 (file)
@@ -3,11 +3,12 @@ import traceback
 import itertools
 import random
 
-from wizard import command, deploy, shell, util
+from wizard import app, command, deploy, shell, util
 
 def main(argv, baton):
     options, show = parse_args(argv, baton)
-    sh = shell.Shell()
+    appname = show[0]
+    application = app.applications()[appname]
     deploys = deploy.parse_install_lines(show, options.versions_path)
     stats = {}
     iffy = 0
@@ -26,7 +27,7 @@ def main(argv, baton):
                 d.verifyConfigured()
                 with util.ChangeDirectory(d.location):
                     results = []
-                    out = sh.safeCall('git', 'diff', '--numstat', d.app_version.scripts_tag, strip=True)
+                    out = shell.safeCall('git', 'diff', '--numstat', d.app_version.scripts_tag, strip=True)
                     total += 1
                     for line in out.split("\n"):
                         added, deleted, filename = line.split(None, 3)
@@ -35,19 +36,7 @@ def main(argv, baton):
                         if deleted == '-': continue
                         added = int(added)
                         deleted = int(deleted)
-                        # hook
-                        if filename == "LocalSettings.php":
-                            if added == deleted == 10:
-                                continue
-                            elif added == deleted == 9:
-                                continue
-                        elif filename == "AdminSettings.php":
-                            if added == 0 and deleted == 20:
-                                continue
-                        elif filename == "config/index.php" or filename == "config/index.php5":
-                            if added == 0:
-                                continue
-                        if not added and not deleted:
+                        if not added and not deleted or application.researchFilter(filename, added, deleted):
                             continue
                         results.append((added,deleted,filename))
                     if len(results) > options.filter:
@@ -59,8 +48,7 @@ def main(argv, baton):
                     for added,deleted,filename in results:
                         stats.setdefault(filename, 0)
                         stats[filename] += 1
-                        # hook
-                        if filename == "LocalSettings.php" and not options.verbose:
+                        if application.researchVerbose(filename) and not options.verbose:
                             continue
                         print "%-7d %-7d %s/%s" % (added,deleted,d.location,filename)
             except (deploy.NotConfiguredError, deploy.NotMigratedError):