From: Eric S. Raymond Date: Wed, 12 Nov 2014 04:35:34 +0000 (-0500) Subject: Make sure ordinary commits still work! X-Git-Tag: 0.5~2 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=a1af5a0e6b360257b6cdf8fb48cb626c56f90b8d;p=src.git Make sure ordinary commits still work! Regression test passes. --- diff --git a/src b/src index 06e389f..e631bb3 100755 --- a/src +++ b/src @@ -473,7 +473,10 @@ class CommentContext: def commit_method(*args): "Commit changes to files." if not os.path.exists(repodir): - croak("repository subdirectory %s does not exist" % repodir) + try: + os.mkdir(repodir) + except OSError: + croak(" %s creation failed, check directory permissions." % repodir) args = list(args) comment = CommentContext("commit", args) ctx = CommandContext("commit", args, require_empty=True) @@ -483,16 +486,11 @@ def commit_method(*args): comment.edit() for arg in ctx.args: if not os.path.exists(backend.master(arg)): - if not os.path.exists(repodir): - try: - os.mkdir(repodir) - except OSError: - croak(" %s creation failed, check directory permissions." % repodir) backend.add(arg) - with backend.lifter(arg): - backend.checkin(arg, comment.content()) - if not quiet and len(args) > 1: - announce("%s -> %d" % (arg, len(History(arg)))) + with backend.lifter(arg): + backend.checkin(arg, comment.content()) + if not quiet and len(args) > 1: + announce("%s -> %d" % (arg, len(History(arg)))) def amend_method(*args): "Amend comments in stored revisions." diff --git a/srctest b/srctest index 9f4e19b..5eec9ce 100755 --- a/srctest +++ b/srctest @@ -210,10 +210,6 @@ EOF src $TESTOPTS ls | diff -u testfile16 - check "ls" -src $TESTOPTS add testfile16 -src $TESTOPTS status testfile16 | grep "^A" >/dev/null -check "A status check after registration" - src $TESTOPTS commit -m "Another sample" testfile16 src $TESTOPTS status testfile16 | grep "^[.]" >/dev/null check ". status check after first commit"