Overview
SHA1 Hash: | 6df39e37f2094628ecdda8f3575deabfa63c5fa9 |
---|---|
Date: | 2009-12-17 14:51:24 |
User: | drh |
Comment: | Update the "checkin" command so that the template check-in message contains a comment that shows the branch tags that will be associated with the new check-in. |
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 [ef3cc1bd3e] to [50415ea96d].
@@ -261,12 +261,26 @@ ** editor specified in the global_config table or either ** the VISUAL or EDITOR environment variable. ** ** Store the final commit comment in pComment. pComment is assumed ** to be uninitialized - any prior content is overwritten. +** +** zInit is the text of the most recent failed attempt to check in +** this same change. Use zInit to reinitialize the check-in comment +** so that the user does not have to retype. +** +** zBranch is the name of a new branch that this check-in is forced into. +** zBranch might be NULL or an empty string if no forcing occurs. +** +** parent_rid is the recordid of the parent check-in. */ -static void prepare_commit_comment(Blob *pComment, char *zInit){ +static void prepare_commit_comment( + Blob *pComment, + char *zInit, + const char *zBranch, + int parent_rid +){ const char *zEditor; char *zCmd; char *zFile; Blob text, line; char *zComment; @@ -276,10 +290,16 @@ "\n" "# Enter comments on this check-in. Lines beginning with # are ignored.\n" "# The check-in comment follows wiki formatting rules.\n" "#\n", -1 ); + if( zBranch && zBranch[0] ){ + blob_appendf(&text, "# tags: %s\n#\n", zBranch); + }else{ + char *zTags = info_tags_of_checkin(parent_rid); + if( zTags ) blob_appendf(&text, "# tags: %z\n#\n", zTags); + } if( g.markPrivate ){ blob_append(&text, "# PRIVATE BRANCH: This check-in will be private and will not sync to\n" "# repositories.\n" "#\n", -1 @@ -558,11 +578,11 @@ }else if( zCommentFile ){ blob_zero(&comment); blob_read_from_file(&comment, zCommentFile); }else{ char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); - prepare_commit_comment(&comment, zInit); + prepare_commit_comment(&comment, zInit, zBranch, vid); free(zInit); } if( blob_size(&comment)==0 ){ Blob ans; blob_zero(&ans);
Modified src/info.c from [dd6de258e1] to [f5284fa22d].
@@ -27,10 +27,28 @@ */ #include "config.h" #include "info.h" #include <assert.h> +/* +** Return a string (in memory obtained from malloc) holding a +** comma-separated list of tags that apply to check-in with +** record-id rid. +** +** Return NULL if there are no such tags. +*/ +char *info_tags_of_checkin(int rid){ + char *zTags; + zTags = db_text(0, "SELECT group_concat(substr(tagname, 5), ', ')" + " FROM tagxref, tag" + " WHERE tagxref.rid=%d AND tagxref.tagtype>0" + " AND tag.tagid=tagxref.tagid" + " AND tag.tagname GLOB 'sym-*'", + rid); + return zTags; +} + /* ** Print common information about a particular record. ** ** * The UUID @@ -77,16 +95,11 @@ ); printf("child: %s %s\n", zUuid, zDate); free(zDate); } db_finalize(&q); - zTags = db_text(0, "SELECT group_concat(substr(tagname, 5), ', ')" - " FROM tagxref, tag" - " WHERE tagxref.rid=%d AND tagxref.tagtype>0" - " AND tag.tagid=tagxref.tagid" - " AND tag.tagname GLOB 'sym-*'", - rid); + zTags = info_tags_of_checkin(rid); if( zTags && zTags[0] ){ printf("tags: %s\n", zTags); } free(zTags); if( zComment ){