]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/app/__init__.py
Fix minor type error in phpBB version detection.
[wizard.git] / wizard / app / __init__.py
index 1d01966363bb45863db242c6f4120fdf7c7c372e..391f8d8956aeb0f1192d04e7fa07cc2e51c0aeda 100644 (file)
@@ -51,6 +51,9 @@ def applications():
         _applications = dict([(n,Application.make(n)) for n in _application_list ])
     return _applications
 
+def getApplication(appname):
+    """Retrieves application instance given a name"""
+    return applications()[appname]
 
 class Application(object):
     """
@@ -241,55 +244,6 @@ class Application(object):
         for status in shell.eval("git", "ls-files", "--unmerged").splitlines():
             files.add(status.split()[-1])
         for file in files:
-            # check for newline mismatch
-            # HACK: using git diff to tell if files are binary or not
-            if not len(shell.eval("git", "diff", file).splitlines()) == 1 and util.mixed_newlines(file):
-                # this code only works on Unix
-                def get_newline(filename):
-                    f = open(filename, "U")
-                    # for some reason I need two
-                    s = f.readline()
-                    if s != "" and f.newlines is None:
-                        f.readline()
-                    if not isinstance(f.newlines, str):
-                        raise Exception("Assert: expected newlines to be string, instead was %s in %s" % (repr(f.newlines), file))
-                    return f.newlines
-                def create_reference(id):
-                    f = tempfile.NamedTemporaryFile(prefix="wizardResolve", delete=False)
-                    shell.call("git", "cat-file", "blob", ":%d:%s" % (id, file), stdout=f)
-                    f.close()
-                    return get_newline(f.name), f.name
-                def convert(filename, dest_nl):
-                    contents = open(filename, "U").read().replace("\n", dest_nl)
-                    open(filename, "wb").write(contents)
-                logging.info("Mixed newlines detected in %s", file)
-                common_nl, common_file = create_reference(1)
-                our_nl,    our_file    = create_reference(2)
-                their_nl,  their_file  = create_reference(3)
-                remerge = False
-                if common_nl != their_nl:
-                    # upstream can't keep their newlines straight
-                    logging.info("Converting common file (1) from %s to %s newlines", repr(common_nl), repr(their_nl))
-                    convert(common_file, their_nl)
-                    remerge = True
-                if our_nl != their_nl:
-                    # common case
-                    logging.info("Converting our file (2) from %s to %s newlines", repr(our_nl), repr(their_nl))
-                    convert(our_file, their_nl)
-                    remerge = True
-                if remerge:
-                    logging.info("Remerging %s", file)
-                    with open(file, "wb") as f:
-                        try:
-                            shell.call("git", "merge-file", "--stdout", our_file, common_file, their_file, stdout=f)
-                            logging.info("New merge was clean")
-                            shell.call("git", "add", file)
-                            continue
-                        except shell.CallError:
-                            pass
-                    logging.info("Merge was still unclean")
-                else:
-                    logging.warning("Mixed newlines detected in %s, but no remerge possible", file)
             # manual resolutions
             if file in self.resolutions:
                 contents = open(file, "r").read()