Overview
SHA1 Hash: | 68bfc1d5ccf953b9772ea171aa4e4ef05b18513f |
---|---|
Date: | 2009-12-09 23:35:18 |
User: | drh |
Comment: | When a commit aborts, the check-in comment is saved and used to reinitialize the check-in comment template on the next commit attempt. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/checkin.c from [b32786b578] to [895c64f8ea].
@@ -257,22 +257,23 @@ ** the VISUAL or EDITOR environment variable. ** ** Store the final commit comment in pComment. pComment is assumed ** to be uninitialized - any prior content is overwritten. */ -static void prepare_commit_comment(Blob *pComment){ +static void prepare_commit_comment(Blob *pComment, char *zInit){ const char *zEditor; char *zCmd; char *zFile; Blob text, line; char *zComment; int i; - blob_set(&text, + blob_init(&text, zInit, -1); + blob_append(&text, "\n" "# Enter comments on this check-in. Lines beginning with # are ignored.\n" "# The check-in comment follows wiki formatting rules.\n" - "#\n" + "#\n", -1 ); if( g.markPrivate ){ blob_append(&text, "# PRIVATE BRANCH: This check-in will be private and will not sync to\n" "# repositories.\n" @@ -538,19 +539,25 @@ vfile_aggregate_checksum_disk(vid, &cksum1); if( zComment ){ blob_zero(&comment); blob_append(&comment, zComment, -1); }else{ - prepare_commit_comment(&comment); + char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); + prepare_commit_comment(&comment, zInit); + free(zInit); if( blob_size(&comment)==0 ){ Blob ans; blob_zero(&ans); prompt_user("empty check-in comment. continue [y/N]? ", &ans); if( blob_str(&ans)[0]!='y' ){ db_end_transaction(1); exit(1); } + }else{ + db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment); + db_end_transaction(0); + db_begin_transaction(); } } /* Step 1: Insert records for all modified files into the blob ** table. If there were arguments passed to this command, only @@ -735,10 +742,11 @@ /* Clear the undo/redo stack */ undo_reset(); /* Commit */ + db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); db_end_transaction(0); if( !g.markPrivate ){ autosync(AUTOSYNC_PUSH); }