Fossil SCM

added -M/--message-file FILENAME argument for commit.

stephan 2009-12-11 15:49 trunk
Commit 9517cc7486cb68df5de66ae7000337ea2d718574
1 file changed +26 -13
+26 -13
--- src/checkin.c
+++ src/checkin.c
@@ -389,15 +389,22 @@
389389
**
390390
** Usage: %fossil commit ?OPTIONS? ?FILE...?
391391
**
392392
** Create a new version containing all of the changes in the current
393393
** checkout. You will be prompted to enter a check-in comment unless
394
-** the "-m" option is used to specify a comment line. You will be
395
-** prompted for your GPG passphrase in order to sign the new manifest
396
-** unless the "--nosign" options is used. All files that have
397
-** changed will be committed unless some subset of files is specified
398
-** on the command line.
394
+** one of the "-m" or "-M" options are used to specify a comment.
395
+** "-m" takes a single string for the commit message and "-M" requires
396
+** a filename from which to read the commit message. If neither "-m"
397
+** nor "-M" are specified then the editor defined in the "editor"
398
+** fossil option (see %fossil help set) will be used, or from the
399
+** "VISUAL" or "EDITOR" environment variables (in that order) if no
400
+** editor is set.
401
+**
402
+** You will be prompted for your GPG passphrase in order to sign the
403
+** new manifest unless the "--nosign" options is used. All files that
404
+** have changed will be committed unless some subset of files is
405
+** specified on the command line.
399406
**
400407
** The --branch option followed by a branch name cases the new check-in
401408
** to be placed in the named branch. The --bgcolor option can be followed
402409
** by a color name (ex: '#ffc0c0') to specify the background color of
403410
** entries in the new branch when shown in the web timeline interface.
@@ -414,10 +421,11 @@
414421
** --branch NEW-BRANCH-NAME
415422
** --bgcolor COLOR
416423
** --nosign
417424
** --force|-f
418425
** --private
426
+** --message-file|-M COMMENT-FILE
419427
**
420428
*/
421429
void commit_cmd(void){
422430
int rc;
423431
int vid, nrid, nvid;
@@ -433,10 +441,11 @@
433441
int nBasename; /* Length of "g.zLocalRoot/" */
434442
const char *zBranch; /* Create a new branch with this name */
435443
const char *zBgColor; /* Set background color when branching */
436444
const char *zDateOvrd; /* Override date string */
437445
const char *zUserOvrd; /* Override user name */
446
+ const char *zCommentFile; /* Read commit message from this file */
438447
Blob filename; /* complete filename */
439448
Blob manifest;
440449
Blob muuid; /* Manifest uuid */
441450
Blob mcksum; /* Self-checksum on the manifest */
442451
Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -446,10 +455,11 @@
446455
noSign = find_option("nosign",0,0)!=0;
447456
zComment = find_option("comment","m",1);
448457
forceFlag = find_option("force", "f", 0)!=0;
449458
zBranch = find_option("branch","b",1);
450459
zBgColor = find_option("bgcolor",0,1);
460
+ zCommentFile = find_option("message-file", "M", 1);
451461
if( find_option("private",0,0) ){
452462
g.markPrivate = 1;
453463
if( zBranch==0 ) zBranch = "private";
454464
if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */
455465
}
@@ -538,22 +548,25 @@
538548
539549
vfile_aggregate_checksum_disk(vid, &cksum1);
540550
if( zComment ){
541551
blob_zero(&comment);
542552
blob_append(&comment, zComment, -1);
553
+ }else if( zCommentFile ){
554
+ blob_zero(&comment);
555
+ blob_read_from_file(&comment, zCommentFile);
543556
}else{
544557
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
545558
prepare_commit_comment(&comment, zInit);
546559
free(zInit);
547
- if( blob_size(&comment)==0 ){
548
- Blob ans;
549
- blob_zero(&ans);
550
- prompt_user("empty check-in comment. continue (y/N)? ", &ans);
551
- if( blob_str(&ans)[0]!='y' ){
552
- db_end_transaction(1);
553
- exit(1);
554
- }
560
+ }
561
+ if( blob_size(&comment)==0 ){
562
+ Blob ans;
563
+ blob_zero(&ans);
564
+ prompt_user("empty check-in comment. continue [y/N]? ", &ans);
565
+ if( blob_str(&ans)[0]!='y' ){
566
+ db_end_transaction(1);
567
+ exit(1);
555568
}else{
556569
db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
557570
db_end_transaction(0);
558571
db_begin_transaction();
559572
}
560573
--- src/checkin.c
+++ src/checkin.c
@@ -389,15 +389,22 @@
389 **
390 ** Usage: %fossil commit ?OPTIONS? ?FILE...?
391 **
392 ** Create a new version containing all of the changes in the current
393 ** checkout. You will be prompted to enter a check-in comment unless
394 ** the "-m" option is used to specify a comment line. You will be
395 ** prompted for your GPG passphrase in order to sign the new manifest
396 ** unless the "--nosign" options is used. All files that have
397 ** changed will be committed unless some subset of files is specified
398 ** on the command line.
 
 
 
 
 
 
 
399 **
400 ** The --branch option followed by a branch name cases the new check-in
401 ** to be placed in the named branch. The --bgcolor option can be followed
402 ** by a color name (ex: '#ffc0c0') to specify the background color of
403 ** entries in the new branch when shown in the web timeline interface.
@@ -414,10 +421,11 @@
414 ** --branch NEW-BRANCH-NAME
415 ** --bgcolor COLOR
416 ** --nosign
417 ** --force|-f
418 ** --private
 
419 **
420 */
421 void commit_cmd(void){
422 int rc;
423 int vid, nrid, nvid;
@@ -433,10 +441,11 @@
433 int nBasename; /* Length of "g.zLocalRoot/" */
434 const char *zBranch; /* Create a new branch with this name */
435 const char *zBgColor; /* Set background color when branching */
436 const char *zDateOvrd; /* Override date string */
437 const char *zUserOvrd; /* Override user name */
 
438 Blob filename; /* complete filename */
439 Blob manifest;
440 Blob muuid; /* Manifest uuid */
441 Blob mcksum; /* Self-checksum on the manifest */
442 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -446,10 +455,11 @@
446 noSign = find_option("nosign",0,0)!=0;
447 zComment = find_option("comment","m",1);
448 forceFlag = find_option("force", "f", 0)!=0;
449 zBranch = find_option("branch","b",1);
450 zBgColor = find_option("bgcolor",0,1);
 
451 if( find_option("private",0,0) ){
452 g.markPrivate = 1;
453 if( zBranch==0 ) zBranch = "private";
454 if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */
455 }
@@ -538,22 +548,25 @@
538
539 vfile_aggregate_checksum_disk(vid, &cksum1);
540 if( zComment ){
541 blob_zero(&comment);
542 blob_append(&comment, zComment, -1);
 
 
 
543 }else{
544 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
545 prepare_commit_comment(&comment, zInit);
546 free(zInit);
547 if( blob_size(&comment)==0 ){
548 Blob ans;
549 blob_zero(&ans);
550 prompt_user("empty check-in comment. continue (y/N)? ", &ans);
551 if( blob_str(&ans)[0]!='y' ){
552 db_end_transaction(1);
553 exit(1);
554 }
555 }else{
556 db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
557 db_end_transaction(0);
558 db_begin_transaction();
559 }
560
--- src/checkin.c
+++ src/checkin.c
@@ -389,15 +389,22 @@
389 **
390 ** Usage: %fossil commit ?OPTIONS? ?FILE...?
391 **
392 ** Create a new version containing all of the changes in the current
393 ** checkout. You will be prompted to enter a check-in comment unless
394 ** one of the "-m" or "-M" options are used to specify a comment.
395 ** "-m" takes a single string for the commit message and "-M" requires
396 ** a filename from which to read the commit message. If neither "-m"
397 ** nor "-M" are specified then the editor defined in the "editor"
398 ** fossil option (see %fossil help set) will be used, or from the
399 ** "VISUAL" or "EDITOR" environment variables (in that order) if no
400 ** editor is set.
401 **
402 ** You will be prompted for your GPG passphrase in order to sign the
403 ** new manifest unless the "--nosign" options is used. All files that
404 ** have changed will be committed unless some subset of files is
405 ** specified on the command line.
406 **
407 ** The --branch option followed by a branch name cases the new check-in
408 ** to be placed in the named branch. The --bgcolor option can be followed
409 ** by a color name (ex: '#ffc0c0') to specify the background color of
410 ** entries in the new branch when shown in the web timeline interface.
@@ -414,10 +421,11 @@
421 ** --branch NEW-BRANCH-NAME
422 ** --bgcolor COLOR
423 ** --nosign
424 ** --force|-f
425 ** --private
426 ** --message-file|-M COMMENT-FILE
427 **
428 */
429 void commit_cmd(void){
430 int rc;
431 int vid, nrid, nvid;
@@ -433,10 +441,11 @@
441 int nBasename; /* Length of "g.zLocalRoot/" */
442 const char *zBranch; /* Create a new branch with this name */
443 const char *zBgColor; /* Set background color when branching */
444 const char *zDateOvrd; /* Override date string */
445 const char *zUserOvrd; /* Override user name */
446 const char *zCommentFile; /* Read commit message from this file */
447 Blob filename; /* complete filename */
448 Blob manifest;
449 Blob muuid; /* Manifest uuid */
450 Blob mcksum; /* Self-checksum on the manifest */
451 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -446,10 +455,11 @@
455 noSign = find_option("nosign",0,0)!=0;
456 zComment = find_option("comment","m",1);
457 forceFlag = find_option("force", "f", 0)!=0;
458 zBranch = find_option("branch","b",1);
459 zBgColor = find_option("bgcolor",0,1);
460 zCommentFile = find_option("message-file", "M", 1);
461 if( find_option("private",0,0) ){
462 g.markPrivate = 1;
463 if( zBranch==0 ) zBranch = "private";
464 if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */
465 }
@@ -538,22 +548,25 @@
548
549 vfile_aggregate_checksum_disk(vid, &cksum1);
550 if( zComment ){
551 blob_zero(&comment);
552 blob_append(&comment, zComment, -1);
553 }else if( zCommentFile ){
554 blob_zero(&comment);
555 blob_read_from_file(&comment, zCommentFile);
556 }else{
557 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
558 prepare_commit_comment(&comment, zInit);
559 free(zInit);
560 }
561 if( blob_size(&comment)==0 ){
562 Blob ans;
563 blob_zero(&ans);
564 prompt_user("empty check-in comment. continue [y/N]? ", &ans);
565 if( blob_str(&ans)[0]!='y' ){
566 db_end_transaction(1);
567 exit(1);
568 }else{
569 db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
570 db_end_transaction(0);
571 db_begin_transaction();
572 }
573

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button