diff options
Diffstat (limited to 'Demo/pdist/rrcs.py')
-rwxr-xr-x | Demo/pdist/rrcs.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Demo/pdist/rrcs.py b/Demo/pdist/rrcs.py index 540d296..8d0ef03 100755 --- a/Demo/pdist/rrcs.py +++ b/Demo/pdist/rrcs.py @@ -18,22 +18,22 @@ def main(): cmd = 'head' else: cmd, rest = rest[0], rest[1:] - if not commands.has_key(cmd): - raise getopt.error, "unknown command" + if cmd not in commands: + raise getopt.error("unknown command") coptset, func = commands[cmd] copts, files = getopt.getopt(rest, coptset) except getopt.error as msg: - print msg - print "usage: rrcs [options] command [options] [file] ..." - print "where command can be:" - print " ci|put # checkin the given files" - print " co|get # checkout" - print " info # print header info" - print " head # print revision of head branch" - print " list # list filename if valid" - print " log # print full log" - print " diff # diff rcs file and work file" - print "if no files are given, all remote rcs files are assumed" + print(msg) + print("usage: rrcs [options] command [options] [file] ...") + print("where command can be:") + print(" ci|put # checkin the given files") + print(" co|get # checkout") + print(" info # print header info") + print(" head # print revision of head branch") + print(" list # list filename if valid") + print(" log # print full log") + print(" diff # diff rcs file and work file") + print("if no files are given, all remote rcs files are assumed") sys.exit(2) x = openrcsclient(opts) if not files: @@ -42,7 +42,7 @@ def main(): try: func(x, copts, fn) except (IOError, os.error) as msg: - print "%s: %s" % (fn, msg) + print("%s: %s" % (fn, msg)) def checkin(x, copts, fn): f = open(fn) @@ -50,13 +50,13 @@ def checkin(x, copts, fn): f.close() new = not x.isvalid(fn) if not new and same(x, copts, fn, data): - print "%s: unchanged since last checkin" % fn + print("%s: unchanged since last checkin" % fn) return - print "Checking in", fn, "..." + print("Checking in", fn, "...") message = asklogmessage(new) messages = x.put(fn, data, message) if messages: - print messages + print(messages) def checkout(x, copts, fn): data = x.get(fn) @@ -72,19 +72,19 @@ def unlock(x, copts, fn): def info(x, copts, fn): dict = x.info(fn) - keys = dict.keys() + keys = list(dict.keys()) keys.sort() for key in keys: - print key + ':', dict[key] - print '='*70 + print(key + ':', dict[key]) + print('='*70) def head(x, copts, fn): head = x.head(fn) - print fn, head + print(fn, head) def list(x, copts, fn): if x.isvalid(fn): - print fn + print(fn) def log(x, copts, fn): flags = '' @@ -92,7 +92,7 @@ def log(x, copts, fn): flags = flags + ' ' + o + a flags = flags[1:] messages = x.log(fn, flags) - print messages + print(messages) def diff(x, copts, fn): if same(x, copts, fn): @@ -105,10 +105,10 @@ def diff(x, copts, fn): tf = tempfile.NamedTemporaryFile() tf.write(data) tf.flush() - print 'diff %s -r%s %s' % (flags, x.head(fn), fn) + print('diff %s -r%s %s' % (flags, x.head(fn), fn)) sts = os.system('diff %s %s %s' % (flags, tf.name, fn)) if sts: - print '='*70 + print('='*70) def same(x, copts, fn, data = None): if data is None: @@ -121,12 +121,12 @@ def same(x, copts, fn, data = None): def asklogmessage(new): if new: - print "enter description,", + print("enter description,", end=' ') else: - print "enter log message,", - print "terminate with single '.' or end of file:" + print("enter log message,", end=' ') + print("terminate with single '.' or end of file:") if new: - print "NOTE: This is NOT the log message!" + print("NOTE: This is NOT the log message!") message = "" while 1: sys.stderr.write(">> ") |