From: Eric S. Raymond Date: Fri, 7 Nov 2014 16:25:36 +0000 (-0500) Subject: Ading tests, finding bugs. X-Git-Tag: 0.2~52 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=116d24d3e32ba262a4068021aa312d908e445ab2;p=src.git Ading tests, finding bugs. --- diff --git a/src b/src index 2bd61c8..380cfcb 100755 --- a/src +++ b/src @@ -363,6 +363,7 @@ class lifted: def commit_method(*args): "Commit changes to files." + args = list(args) comment = None if args[0] == '--': args.pop(0) @@ -370,18 +371,21 @@ def commit_method(*args): commentfp = sys.stdin.read() args.pop(0) elif args[0] == "-m": + args.pop(0) try: - comment = args[1] + comment = args[0] + args.pop(0) except IndexError: croak("commit -m requires a following string.") elif args[0] == "-f": + args.pop(0) try: - comment = open(args[1]).read() + comment = open(args[0]).read() + args.pop(0) except IndexError: croak("commit -f requires a following filename argument.") except OSError: croak("couldn't open %s." % args[1]) - args.pop(0) (revspec, args) = preamble("commit", args) if revspec is not None: croak("commit doesn't take a revision spec") diff --git a/srctest b/srctest index dbc6211..2dd968e 100755 --- a/srctest +++ b/srctest @@ -22,7 +22,10 @@ EOF src add testfile$$ >/dev/null check "add" -src commit -m "First comment" >/dev/null +src commit -m "First comment" >/dev/null testfile$$ check "commit" +src cat testfile$$ | diff testfile$$ - >/dev/null +check "diff" + # end