]> thyrsus.com Git - src.git/commitdiff
Make the codemostly Python-3 compatible.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 06:21:14 +0000 (01:21 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 06:21:14 +0000 (01:21 -0500)
Fails due to to the accursed byte-string split.
But regression tests pass under 2.

src

diff --git a/src b/src
index 3c0fe26aaf73f4554824d11590c38b60f87142b6..6b802f2b9a44993f75cd50909ae811caa7734915 100755 (executable)
--- a/src
+++ b/src
@@ -240,7 +240,7 @@ class History:
 
 def help_method(*_args):
     "Summarize src commands, or (with argument) show help for a single command."
-    print"""
+    print("""
 A 'revision' is a 1-origin integer, or a tag name designating an
 integer revision.  A revision range is a single revision or a pair of
 revisions separated by"-" or "..". Unless otherwise noted under
@@ -334,7 +334,7 @@ src version
    Report the version of src.
 
 The omission of 'src remove' is a deliberate speed bump.
-"""
+""")
 
 class CommandContext:
     "Consume a revision specification or range from an argument list"
@@ -692,7 +692,7 @@ def tag_helper(args, legend, validation_hook, delete_method, set_method):
                 sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
                 if legend == "branch":
                     sys.stdout.write("   0\t%s\n" % metadata.branch)
-                for (key, value) in metadata.symbols.items():
+                for (key, value) in list(metadata.symbols.items()):
                     if legend == "branch":
                         if key == metadata.branch:
                             continue
@@ -863,7 +863,7 @@ def fast_export_method(*args):
                 last_commit_mark = mark
                 markmap[item.revno] = mark
             sys.stdout.write("reset refs/heads/%s\nfrom :%d\n\n" % (branch, mark))
-            for (key, val) in metadata.symbols.items():
+            for (key, val) in list(metadata.symbols.items()):
                 val = metadata.rcs_to_revno(val)
                 if val in ctx:
                     sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
@@ -1139,7 +1139,7 @@ class RCS:
                         metadata.revlist[-1].log += line
             # Now that we have the symbol table...
             if metadata.branch != "trunk":
-                for (k, v) in metadata.symbols.items():
+                for (k, v) in list(metadata.symbols.items()):
                     if v == metadata.branch:
                         metadata.branch = k
                         break
@@ -1155,8 +1155,8 @@ class RCS:
             metadata.revlist.reverse()
             if debug >= DEBUG_PARSE:
                 #print "\t%d revisions" % len(metadata.revlist)
-                print "\tlockrevs:", metadata.lockrevs
-                print "\tsymbols:", metadata.symbols
+                print("\tlockrevs:", metadata.lockrevs)
+                print("\tsymbols:", metadata.symbols)
 
 if __name__ == "__main__":
     try:
@@ -1186,7 +1186,7 @@ if __name__ == "__main__":
             help_method()
         else:
             try:
-                apply(dispatch[commandline[0]], commandline[1:])
+                dispatch[commandline[0]](*commandline[1:])
             except KeyError:
                 sys.stderr.write("src: no such commandline as '%s'.  Try 'src help'\n" \
                                % commandline[0])