Fossil SCM
Add support for comment file via -M so the prompt message is not confusing when it mentions the use of -M.
Commit
37aeb1c43e8d35e6872c2806c3260ba24204a0d0
Parent
cd31ab5a99a37f1…
1 file changed
+8
+8
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2750,10 +2750,11 @@ | ||
| 2750 | 2750 | ** |
| 2751 | 2751 | ** Options: |
| 2752 | 2752 | ** |
| 2753 | 2753 | ** --author USER Make USER the author for check-in |
| 2754 | 2754 | ** -m|--comment COMMENT Make COMMENT the check-in comment |
| 2755 | +** -m|--message-file FILE Read the amended comment from FILE | |
| 2755 | 2756 | ** --edit-comment Launch editor to revise comment |
| 2756 | 2757 | ** --date DATE Make DATE the check-in time |
| 2757 | 2758 | ** --bgcolor COLOR Apply COLOR to this check-in |
| 2758 | 2759 | ** --branchcolor COLOR Apply and propagate COLOR to the branch |
| 2759 | 2760 | ** --tag TAG Add new TAG to this check-in |
| @@ -2764,10 +2765,11 @@ | ||
| 2764 | 2765 | */ |
| 2765 | 2766 | void ci_amend_cmd(void){ |
| 2766 | 2767 | int rid; |
| 2767 | 2768 | const char *zComment; /* Current comment on the check-in */ |
| 2768 | 2769 | const char *zNewComment; /* Revised check-in comment */ |
| 2770 | + const char *zComFile; /* Filename from which to read comment */ | |
| 2769 | 2771 | const char *zUser; /* Current user for the check-in */ |
| 2770 | 2772 | const char *zNewUser; /* Revised user */ |
| 2771 | 2773 | const char *zDate; /* Current date of the check-in */ |
| 2772 | 2774 | const char *zNewDate; /* Revised check-in date */ |
| 2773 | 2775 | const char *zColor; |
| @@ -2790,10 +2792,11 @@ | ||
| 2790 | 2792 | int i; |
| 2791 | 2793 | |
| 2792 | 2794 | if( g.argc==3 ) usage(AMEND_USAGE_STMT); |
| 2793 | 2795 | fEditComment = find_option("edit-comment",0,0)!=0; |
| 2794 | 2796 | zNewComment = find_option("comment","m",1); |
| 2797 | + zComFile = find_option("message-file","M",1); | |
| 2795 | 2798 | zNewBranch = find_option("branch",0,1); |
| 2796 | 2799 | zNewColor = find_option("bgcolor",0,1); |
| 2797 | 2800 | zNewBrColor = find_option("branchcolor",0,1); |
| 2798 | 2801 | if( zNewBrColor ){ |
| 2799 | 2802 | zNewColor = zNewBrColor; |
| @@ -2848,10 +2851,15 @@ | ||
| 2848 | 2851 | cancel_color(); |
| 2849 | 2852 | } |
| 2850 | 2853 | if( fEditComment ){ |
| 2851 | 2854 | prepare_amend_comment(&comment, zComment, zUuid); |
| 2852 | 2855 | zNewComment = blob_str(&comment); |
| 2856 | + }else if( zComFile ){ | |
| 2857 | + blob_zero(&comment); | |
| 2858 | + blob_read_from_file(&comment, zComFile); | |
| 2859 | + blob_to_utf8_no_bom(&comment, 1); | |
| 2860 | + zNewComment = blob_str(&comment); | |
| 2853 | 2861 | } |
| 2854 | 2862 | if( zNewComment && zNewComment[0] |
| 2855 | 2863 | && comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment); |
| 2856 | 2864 | if( zNewDate && zNewDate[0] && fossil_strcmp(zDate,zNewDate)!=0 ){ |
| 2857 | 2865 | add_date(zNewDate); |
| 2858 | 2866 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2750,10 +2750,11 @@ | |
| 2750 | ** |
| 2751 | ** Options: |
| 2752 | ** |
| 2753 | ** --author USER Make USER the author for check-in |
| 2754 | ** -m|--comment COMMENT Make COMMENT the check-in comment |
| 2755 | ** --edit-comment Launch editor to revise comment |
| 2756 | ** --date DATE Make DATE the check-in time |
| 2757 | ** --bgcolor COLOR Apply COLOR to this check-in |
| 2758 | ** --branchcolor COLOR Apply and propagate COLOR to the branch |
| 2759 | ** --tag TAG Add new TAG to this check-in |
| @@ -2764,10 +2765,11 @@ | |
| 2764 | */ |
| 2765 | void ci_amend_cmd(void){ |
| 2766 | int rid; |
| 2767 | const char *zComment; /* Current comment on the check-in */ |
| 2768 | const char *zNewComment; /* Revised check-in comment */ |
| 2769 | const char *zUser; /* Current user for the check-in */ |
| 2770 | const char *zNewUser; /* Revised user */ |
| 2771 | const char *zDate; /* Current date of the check-in */ |
| 2772 | const char *zNewDate; /* Revised check-in date */ |
| 2773 | const char *zColor; |
| @@ -2790,10 +2792,11 @@ | |
| 2790 | int i; |
| 2791 | |
| 2792 | if( g.argc==3 ) usage(AMEND_USAGE_STMT); |
| 2793 | fEditComment = find_option("edit-comment",0,0)!=0; |
| 2794 | zNewComment = find_option("comment","m",1); |
| 2795 | zNewBranch = find_option("branch",0,1); |
| 2796 | zNewColor = find_option("bgcolor",0,1); |
| 2797 | zNewBrColor = find_option("branchcolor",0,1); |
| 2798 | if( zNewBrColor ){ |
| 2799 | zNewColor = zNewBrColor; |
| @@ -2848,10 +2851,15 @@ | |
| 2848 | cancel_color(); |
| 2849 | } |
| 2850 | if( fEditComment ){ |
| 2851 | prepare_amend_comment(&comment, zComment, zUuid); |
| 2852 | zNewComment = blob_str(&comment); |
| 2853 | } |
| 2854 | if( zNewComment && zNewComment[0] |
| 2855 | && comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment); |
| 2856 | if( zNewDate && zNewDate[0] && fossil_strcmp(zDate,zNewDate)!=0 ){ |
| 2857 | add_date(zNewDate); |
| 2858 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2750,10 +2750,11 @@ | |
| 2750 | ** |
| 2751 | ** Options: |
| 2752 | ** |
| 2753 | ** --author USER Make USER the author for check-in |
| 2754 | ** -m|--comment COMMENT Make COMMENT the check-in comment |
| 2755 | ** -m|--message-file FILE Read the amended comment from FILE |
| 2756 | ** --edit-comment Launch editor to revise comment |
| 2757 | ** --date DATE Make DATE the check-in time |
| 2758 | ** --bgcolor COLOR Apply COLOR to this check-in |
| 2759 | ** --branchcolor COLOR Apply and propagate COLOR to the branch |
| 2760 | ** --tag TAG Add new TAG to this check-in |
| @@ -2764,10 +2765,11 @@ | |
| 2765 | */ |
| 2766 | void ci_amend_cmd(void){ |
| 2767 | int rid; |
| 2768 | const char *zComment; /* Current comment on the check-in */ |
| 2769 | const char *zNewComment; /* Revised check-in comment */ |
| 2770 | const char *zComFile; /* Filename from which to read comment */ |
| 2771 | const char *zUser; /* Current user for the check-in */ |
| 2772 | const char *zNewUser; /* Revised user */ |
| 2773 | const char *zDate; /* Current date of the check-in */ |
| 2774 | const char *zNewDate; /* Revised check-in date */ |
| 2775 | const char *zColor; |
| @@ -2790,10 +2792,11 @@ | |
| 2792 | int i; |
| 2793 | |
| 2794 | if( g.argc==3 ) usage(AMEND_USAGE_STMT); |
| 2795 | fEditComment = find_option("edit-comment",0,0)!=0; |
| 2796 | zNewComment = find_option("comment","m",1); |
| 2797 | zComFile = find_option("message-file","M",1); |
| 2798 | zNewBranch = find_option("branch",0,1); |
| 2799 | zNewColor = find_option("bgcolor",0,1); |
| 2800 | zNewBrColor = find_option("branchcolor",0,1); |
| 2801 | if( zNewBrColor ){ |
| 2802 | zNewColor = zNewBrColor; |
| @@ -2848,10 +2851,15 @@ | |
| 2851 | cancel_color(); |
| 2852 | } |
| 2853 | if( fEditComment ){ |
| 2854 | prepare_amend_comment(&comment, zComment, zUuid); |
| 2855 | zNewComment = blob_str(&comment); |
| 2856 | }else if( zComFile ){ |
| 2857 | blob_zero(&comment); |
| 2858 | blob_read_from_file(&comment, zComFile); |
| 2859 | blob_to_utf8_no_bom(&comment, 1); |
| 2860 | zNewComment = blob_str(&comment); |
| 2861 | } |
| 2862 | if( zNewComment && zNewComment[0] |
| 2863 | && comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment); |
| 2864 | if( zNewDate && zNewDate[0] && fossil_strcmp(zDate,zNewDate)!=0 ){ |
| 2865 | add_date(zNewDate); |
| 2866 |