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 <john@keeping.me.uk> Acked-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Keeping committed
Jan 20, 2013 at 13:15 UTC
f9640ac26ce0478695487f657718157bb7b4f804
1 file changed
+14
-14
git-remote-testpy.py
+14
-14
@@ -87,9 +87,9 @@ def do_capabilities(repo, args):
87
"""Prints the supported capabilities.
88
"""
89
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)
93
94
dirname = repo.get_base_path(repo.gitdir)
95
@@ -98,11 +98,11 @@ def do_capabilities(repo, args):
98
99
path = os.path.join(dirname, 'git.marks')
100
101
- print "*export-marks %s" % path
101
+ print("*export-marks %s" % path)
102
if os.path.exists(path):
103
- print "*import-marks %s" % path
103
+ print("*import-marks %s" % path)
104
105
- print # end capabilities
105
+ print('') # end capabilities
106
107
108
def do_list(repo, args):
@@ -115,16 +115,16 @@ def do_list(repo, args):
115
116
for ref in repo.revs:
117
debug("? refs/heads/%s", ref)
118
- print "? refs/heads/%s" % ref
118
+ print("? refs/heads/%s" % ref)
119
120
if repo.head:
121
debug("@refs/heads/%s HEAD" % repo.head)
122
- print "@refs/heads/%s HEAD" % repo.head
122
+ print("@refs/heads/%s HEAD" % repo.head)
123
else:
124
debug("@refs/heads/master HEAD")
125
- print "@refs/heads/master HEAD"
125
+ print("@refs/heads/master HEAD")
126
127
- print # end list
127
+ print('') # end list
128
129
130
def update_local_repo(repo):
@@ -164,7 +164,7 @@ def do_import(repo, args):
164
ref = line[7:].strip()
165
refs.append(ref)
166
167
- print "feature done"
167
+ print("feature done")
168
169
if os.environ.get("GIT_REMOTE_TESTGIT_FAILURE"):
170
die('Told to fail')
@@ -172,7 +172,7 @@ def do_import(repo, args):
172
repo = update_local_repo(repo)
173
repo.exporter.export_repo(repo.gitdir, refs)
174
175
- print "done"
175
+ print("done")
176
177
178
def do_export(repo, args):
@@ -192,8 +192,8 @@ def do_export(repo, args):
192
repo.non_local.push(repo.gitdir)
193
194
for ref in changed:
195
- print "ok %s" % ref
196
- print
195
+ print("ok %s" % ref)
196
+ print('')
197
198
199
COMMANDS = {