Differences From:
File
src/checkin.c
part of check-in
[6ae51190cc]
- reserve the use of brackets in stdout for artifacts
by
rwilson on
2009-12-10 02:19:16.
[view]
To:
File
src/checkin.c
part of check-in
[9517cc7486]
- added -M/--message-file FILENAME argument for commit.
by
stephan on
2009-12-11 15:49:41.
[view]
@@ -390,13 +390,20 @@
** Usage: %fossil commit ?OPTIONS? ?FILE...?
**
** Create a new version containing all of the changes in the current
** checkout. You will be prompted to enter a check-in comment unless
-** the "-m" option is used to specify a comment line. You will be
-** prompted for your GPG passphrase in order to sign the new manifest
-** unless the "--nosign" options is used. All files that have
-** changed will be committed unless some subset of files is specified
-** on the command line.
+** one of the "-m" or "-M" options are used to specify a comment.
+** "-m" takes a single string for the commit message and "-M" requires
+** a filename from which to read the commit message. If neither "-m"
+** nor "-M" are specified then the editor defined in the "editor"
+** fossil option (see %fossil help set) will be used, or from the
+** "VISUAL" or "EDITOR" environment variables (in that order) if no
+** editor is set.
+**
+** You will be prompted for your GPG passphrase in order to sign the
+** new manifest unless the "--nosign" options is used. All files that
+** have changed will be committed unless some subset of files is
+** specified on the command line.
**
** The --branch option followed by a branch name cases the new check-in
** to be placed in the named branch. The --bgcolor option can be followed
** by a color name (ex: '#ffc0c0') to specify the background color of
@@ -415,8 +422,9 @@
** --bgcolor COLOR
** --nosign
** --force|-f
** --private
+** --message-file|-M COMMENT-FILE
**
*/
void commit_cmd(void){
int rc;
@@ -434,8 +442,9 @@
const char *zBranch; /* Create a new branch with this name */
const char *zBgColor; /* Set background color when branching */
const char *zDateOvrd; /* Override date string */
const char *zUserOvrd; /* Override user name */
+ const char *zCommentFile; /* Read commit message from this file */
Blob filename; /* complete filename */
Blob manifest;
Blob muuid; /* Manifest uuid */
Blob mcksum; /* Self-checksum on the manifest */
@@ -447,8 +456,9 @@
zComment = find_option("comment","m",1);
forceFlag = find_option("force", "f", 0)!=0;
zBranch = find_option("branch","b",1);
zBgColor = find_option("bgcolor",0,1);
+ zCommentFile = find_option("message-file", "M", 1);
if( find_option("private",0,0) ){
g.markPrivate = 1;
if( zBranch==0 ) zBranch = "private";
if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */
@@ -539,20 +549,23 @@
vfile_aggregate_checksum_disk(vid, &cksum1);
if( zComment ){
blob_zero(&comment);
blob_append(&comment, zComment, -1);
+ }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);
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);
- }
+ }
+ 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();