From ab821ded0093db5f0f2b70e161542292c4f5c7c5 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 9 Oct 2009 16:05:47 -0400 Subject: [PATCH] Suppress ^M characters from Git progress bars. Signed-off-by: Edward Z. Yang --- TODO | 7 ------- wizard/app/mediawiki.py | 2 +- wizard/command/install.py | 4 ++-- wizard/command/restore.py | 2 +- wizard/command/upgrade.py | 14 +++++++------- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index d5d4a74..93444a8 100644 --- a/TODO +++ b/TODO @@ -2,13 +2,6 @@ The Git Autoinstaller TODO NOW: -- Bugs - - Exception parsing doesn't work when HTML pages or other complex - output is returned, which results in hilarious mass error messages. - Check logs for 0324 for a relevant example. - - git pull, when it fails, has a lot of ^M characters; these should - be removed - - Make it faster - Wipe temp directories if the upgrade succeeds - Put temp directories on tmpfs before merging, then move to disk diff --git a/wizard/app/mediawiki.py b/wizard/app/mediawiki.py index d21ee15..3fdec14 100644 --- a/wizard/app/mediawiki.py +++ b/wizard/app/mediawiki.py @@ -89,7 +89,7 @@ class Application(deploy.Application): def upgrade(self, d, version, options): sh = shell.Shell() if not os.path.isfile("AdminSettings.php"): - sh.call("git", "checkout", "mediawiki-" + str(version), "--", "AdminSettings.php") + sh.call("git", "checkout", "-q", "mediawiki-" + str(version), "--", "AdminSettings.php") try: result = sh.eval("php", "maintenance/update.php", "--quick", log=True) except shell.CallError as e: diff --git a/wizard/command/install.py b/wizard/command/install.py index e736fc9..dee3452 100644 --- a/wizard/command/install.py +++ b/wizard/command/install.py @@ -17,10 +17,10 @@ def main(argv, baton): appname, _, version = app.partition('-') application = deploy.applications()[appname] sh = shell.Shell() - sh.call("git", "clone", "--shared", application.repository(options.srv_path), dir) + sh.call("git", "clone", "-q", "--shared", application.repository(options.srv_path), dir) with util.ChangeDirectory(dir): if version: - sh.call("git", "reset", "--hard", app) + sh.call("git", "reset", "-q", "--hard", app) # this command's stdin should be hooked up to ours try: configure_args = args[2:] + command.makeBaseArgs(options) diff --git a/wizard/command/restore.py b/wizard/command/restore.py index c5d73c9..35423c6 100644 --- a/wizard/command/restore.py +++ b/wizard/command/restore.py @@ -44,7 +44,7 @@ def main(argv, baton): sh.call("git", "rev-parse", tag) except shell.CallError: raise Exception("Tag %s doesn't exist in repository" % tag) - sh.call("git", "reset", "--hard", tag) + sh.call("git", "reset", "-q", "--hard", tag) d.restore(backup, options) def parse_args(argv, baton): diff --git a/wizard/command/upgrade.py b/wizard/command/upgrade.py index ed8c8ce..4efbda8 100644 --- a/wizard/command/upgrade.py +++ b/wizard/command/upgrade.py @@ -52,7 +52,7 @@ def main(argv, baton): temp_wc_dir = perform_tmp_clone(sh) with util.ChangeDirectory(temp_wc_dir): sh.call("git", "remote", "add", "scripts", repo) - sh.call("git", "fetch", "scripts") + sh.call("git", "fetch", "-q", "scripts") user_commit, next_commit = calculate_parents(sh, version) # save variables so that --continue will work # yeah yeah no trailing newline whatever @@ -74,10 +74,10 @@ def main(argv, baton): # a master branch may not necessarily exist if the user # was manually installed to an earlier version try: - sh.call("git", "checkout", "-b", "master", "--") + sh.call("git", "checkout", "-q", "-b", "master", "--") except shell.CallError: - sh.call("git", "checkout", "master", "--") - sh.call("git", "reset", "--hard", final_commit) + sh.call("git", "checkout", "-q", "master", "--") + sh.call("git", "reset", "-q", "--hard", final_commit) d.verifyVersion() # Till now, all of our operations were in a tmp sandbox. if options.dry_run: @@ -89,7 +89,7 @@ def main(argv, baton): with util.IgnoreKeyboardInterrupts(): with util.LockDirectory(".scripts-upgrade-lock"): # git merge (which performs a fast forward) - sh.call("git", "pull", temp_wc_dir, "master") + sh.call("git", "pull", "-q", temp_wc_dir, "master") version_obj = distutils.version.LooseVersion(version.partition('-')[2]) try: # run update script @@ -150,7 +150,7 @@ def perform_tmp_clone(sh): temp_dir = tempfile.mkdtemp(prefix="wizard") temp_wc_dir = os.path.join(temp_dir, "repo") logging.info("Using temporary directory: " + temp_wc_dir) - sh.call("git", "clone", "--shared", ".", temp_wc_dir) + sh.call("git", "clone", "-q", "--shared", ".", temp_wc_dir) return temp_wc_dir def perform_merge(sh, repo, d, version): @@ -159,7 +159,7 @@ def perform_merge(sh, repo, d, version): # crazy merge algorithm: def make_virtual_commit(tag, parents = []): """WARNING: Changes state of Git repository""" - sh.call("git", "checkout", tag, "--") + sh.call("git", "checkout", "-q", tag, "--") d.parametrize(".") for file in d.application.parametrized_files: try: -- 2.45.0