diff --git a/git-filter-repo b/git-filter-repo index 07c769c..6fb102a 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ git-filter-repo filters git repositories, similar to git filter-branch, BFG @@ -30,8 +30,6 @@ operations; however: ***** END API BACKWARD COMPATIBILITY CAVEAT ***** """ -from __future__ import print_function - import argparse import collections import fnmatch @@ -39,7 +37,7 @@ import gettext import os import re import shutil -import StringIO +import io import subprocess import sys import time @@ -408,7 +406,7 @@ class _GitElement(object): Convert GitElement to string; used for debugging """ old_dumped = self.dumped - writeme = StringIO.StringIO() + writeme = io.StringIO() self.dump(writeme) output_lines = writeme.getvalue().splitlines() writeme.close() diff --git a/t/t9391-filter-repo-lib-usage.sh b/t/t9391-filter-repo-lib-usage.sh index e923d29..a967f31 100755 --- a/t/t9391-filter-repo-lib-usage.sh +++ b/t/t9391-filter-repo-lib-usage.sh @@ -158,7 +158,7 @@ test_expect_success 'other error cases' ' mkdir other && cd other && - ! python -c "import git_filter_repo as fr; fr.GitUtils.get_commit_count(\".\", [\"HEAD\"])" 2>err && + ! python3 -c "import git_filter_repo as fr; fr.GitUtils.get_commit_count(\".\", [\"HEAD\"])" 2>err && test_i18ngrep ". does not appear to be a valid git repository" err ) ' diff --git a/t/t9391/commit_info.py b/t/t9391/commit_info.py index e697bd8..a0d34f3 100755 --- a/t/t9391/commit_info.py +++ b/t/t9391/commit_info.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/create_fast_export_output.py b/t/t9391/create_fast_export_output.py index a1b21e0..e2ef13c 100755 --- a/t/t9391/create_fast_export_output.py +++ b/t/t9391/create_fast_export_output.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/erroneous.py b/t/t9391/erroneous.py index a5c05d2..db6051b 100755 --- a/t/t9391/erroneous.py +++ b/t/t9391/erroneous.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/file_filter.py b/t/t9391/file_filter.py index f6a1ae9..8540b7d 100755 --- a/t/t9391/file_filter.py +++ b/t/t9391/file_filter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/print_progress.py b/t/t9391/print_progress.py index 5256b74..bbca538 100755 --- a/t/t9391/print_progress.py +++ b/t/t9391/print_progress.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the @@ -21,8 +21,8 @@ commit_count = 0 def print_progress(): global object_count, commit_count, total_objects, total_commits - print "\rRewriting commits... %d/%d (%d objects)" \ - % (commit_count, total_commits, object_count), + print("\rRewriting commits... %d/%d (%d objects)" + % (commit_count, total_commits, object_count), end='') def my_blob_callback(blob): global object_count diff --git a/t/t9391/rename-master-to-develop.py b/t/t9391/rename-master-to-develop.py index f92517a..7a922d0 100755 --- a/t/t9391/rename-master-to-develop.py +++ b/t/t9391/rename-master-to-develop.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/splice_repos.py b/t/t9391/splice_repos.py index 00d0058..c7834c7 100755 --- a/t/t9391/splice_repos.py +++ b/t/t9391/splice_repos.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/strip-cvs-keywords.py b/t/t9391/strip-cvs-keywords.py index 1067d55..ccd3c8d 100755 --- a/t/t9391/strip-cvs-keywords.py +++ b/t/t9391/strip-cvs-keywords.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Please see the diff --git a/t/t9391/unusual.py b/t/t9391/unusual.py index 3167c0f..6a61dbe 100755 --- a/t/t9391/unusual.py +++ b/t/t9391/unusual.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Please: DO NOT USE THIS AS AN EXAMPLE. # @@ -14,7 +14,7 @@ import collections import os import random -import StringIO +import io import sys import textwrap @@ -71,7 +71,7 @@ print("Found {} blobs/commits and {} other objects" .format(total_objects['common'], total_objects['uncommon'])) -stream = StringIO.StringIO(textwrap.dedent(''' +stream = io.StringIO(textwrap.dedent(''' blob mark :1 data 5