def commit_method(*args):
"Commit changes to files."
+ args = list(args)
comment = None
if args[0] == '--':
args.pop(0)
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")
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