filter-repo (python3): shebang and imports

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2019-04-01 14:35:49 -07:00
parent 4d0264ab72
commit e5955f397f
11 changed files with 17 additions and 19 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
git-filter-repo filters git repositories, similar to git filter-branch, BFG git-filter-repo filters git repositories, similar to git filter-branch, BFG
@ -30,8 +30,6 @@ operations; however:
***** END API BACKWARD COMPATIBILITY CAVEAT ***** ***** END API BACKWARD COMPATIBILITY CAVEAT *****
""" """
from __future__ import print_function
import argparse import argparse
import collections import collections
import fnmatch import fnmatch
@ -39,7 +37,7 @@ import gettext
import os import os
import re import re
import shutil import shutil
import StringIO import io
import subprocess import subprocess
import sys import sys
import time import time
@ -408,7 +406,7 @@ class _GitElement(object):
Convert GitElement to string; used for debugging Convert GitElement to string; used for debugging
""" """
old_dumped = self.dumped old_dumped = self.dumped
writeme = StringIO.StringIO() writeme = io.StringIO()
self.dump(writeme) self.dump(writeme)
output_lines = writeme.getvalue().splitlines() output_lines = writeme.getvalue().splitlines()
writeme.close() writeme.close()

View File

@ -158,7 +158,7 @@ test_expect_success 'other error cases' '
mkdir other && mkdir other &&
cd 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 test_i18ngrep ". does not appear to be a valid git repository" err
) )
' '

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the
@ -21,8 +21,8 @@ commit_count = 0
def print_progress(): def print_progress():
global object_count, commit_count, total_objects, total_commits global object_count, commit_count, total_objects, total_commits
print "\rRewriting commits... %d/%d (%d objects)" \ print("\rRewriting commits... %d/%d (%d objects)"
% (commit_count, total_commits, object_count), % (commit_count, total_commits, object_count), end='')
def my_blob_callback(blob): def my_blob_callback(blob):
global object_count global object_count

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Please see the Please see the

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Please: DO NOT USE THIS AS AN EXAMPLE. # Please: DO NOT USE THIS AS AN EXAMPLE.
# #
@ -14,7 +14,7 @@
import collections import collections
import os import os
import random import random
import StringIO import io
import sys import sys
import textwrap import textwrap
@ -71,7 +71,7 @@ print("Found {} blobs/commits and {} other objects"
.format(total_objects['common'], total_objects['uncommon'])) .format(total_objects['common'], total_objects['uncommon']))
stream = StringIO.StringIO(textwrap.dedent(''' stream = io.StringIO(textwrap.dedent('''
blob blob
mark :1 mark :1
data 5 data 5