Skip to content

Commit f9640ac

Browse files
johnkeepinggitster
authored andcommitted
git-remote-testpy: call print as a function
This is harmless in Python 2, which sees the parentheses as redundant grouping, but is required for Python 3. Since this is the only change required to make this script just run under Python 3 without needing 2to3 it seems worthwhile. The case of an empty print must be handled specially because in that case Python 2 will interpret '()' as an empty tuple and print it as '()'; inserting an empty string fixes this. Signed-off-by: John Keeping <[email protected]> Acked-by: Sverre Rabbelier <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d04c94a commit f9640ac

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

git-remote-testpy.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def do_capabilities(repo, args):
8787
"""Prints the supported capabilities.
8888
"""
8989

90-
print "import"
91-
print "export"
92-
print "refspec refs/heads/*:%s*" % repo.prefix
90+
print("import")
91+
print("export")
92+
print("refspec refs/heads/*:%s*" % repo.prefix)
9393

9494
dirname = repo.get_base_path(repo.gitdir)
9595

@@ -98,11 +98,11 @@ def do_capabilities(repo, args):
9898

9999
path = os.path.join(dirname, 'git.marks')
100100

101-
print "*export-marks %s" % path
101+
print("*export-marks %s" % path)
102102
if os.path.exists(path):
103-
print "*import-marks %s" % path
103+
print("*import-marks %s" % path)
104104

105-
print # end capabilities
105+
print('') # end capabilities
106106

107107

108108
def do_list(repo, args):
@@ -115,16 +115,16 @@ def do_list(repo, args):
115115

116116
for ref in repo.revs:
117117
debug("? refs/heads/%s", ref)
118-
print "? refs/heads/%s" % ref
118+
print("? refs/heads/%s" % ref)
119119

120120
if repo.head:
121121
debug("@refs/heads/%s HEAD" % repo.head)
122-
print "@refs/heads/%s HEAD" % repo.head
122+
print("@refs/heads/%s HEAD" % repo.head)
123123
else:
124124
debug("@refs/heads/master HEAD")
125-
print "@refs/heads/master HEAD"
125+
print("@refs/heads/master HEAD")
126126

127-
print # end list
127+
print('') # end list
128128

129129

130130
def update_local_repo(repo):
@@ -164,15 +164,15 @@ def do_import(repo, args):
164164
ref = line[7:].strip()
165165
refs.append(ref)
166166

167-
print "feature done"
167+
print("feature done")
168168

169169
if os.environ.get("GIT_REMOTE_TESTGIT_FAILURE"):
170170
die('Told to fail')
171171

172172
repo = update_local_repo(repo)
173173
repo.exporter.export_repo(repo.gitdir, refs)
174174

175-
print "done"
175+
print("done")
176176

177177

178178
def do_export(repo, args):
@@ -192,8 +192,8 @@ def do_export(repo, args):
192192
repo.non_local.push(repo.gitdir)
193193

194194
for ref in changed:
195-
print "ok %s" % ref
196-
print
195+
print("ok %s" % ref)
196+
print('')
197197

198198

199199
COMMANDS = {

0 commit comments

Comments
 (0)