From fd61f3febc8a514f11355b5509b9e3cd370ee7f2 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 12 Nov 2014 01:21:14 -0500 Subject: [PATCH] Make the codemostly Python-3 compatible. Fails due to to the accursed byte-string split. But regression tests pass under 2. --- src | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src b/src index 3c0fe26..6b802f2 100755 --- 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]) -- 2.43.0