Fossil SCM
Allow multiple --tag options on the "commit" commandline. Change the meaning of the --bgcolor option to only change the background color for the single commit. The new --branchcolor option changes the background color persistently, as --bgcolor used to do. <b>Command-line compatibility break</b>.
Commit
c4dc635e6b80e237cabef4b4b6d4dc793c0a0b7e
Parent
135ed93375e0ea3…
1 file changed
+55
-17
+55
-17
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -632,12 +632,13 @@ | ||
| 632 | 632 | int verifyDate, /* Verify that child is younger */ |
| 633 | 633 | Blob *pCksum, /* Repository checksum. May be 0 */ |
| 634 | 634 | const char *zDateOvrd, /* Date override. If 0 then use 'now' */ |
| 635 | 635 | const char *zUserOvrd, /* User override. If 0 then use g.zLogin */ |
| 636 | 636 | const char *zBranch, /* Branch name. May be 0 */ |
| 637 | - const char *zBgColor, /* Background color. May be 0 */ | |
| 638 | - const char *zTag, /* Tag to apply to this check-in */ | |
| 637 | + const char *zColor, /* One-time gackground color. May be 0 */ | |
| 638 | + const char *zBrClr, /* Persistent branch color. May be 0 */ | |
| 639 | + const char **azTag, /* Tags to apply to this check-in */ | |
| 639 | 640 | int *pnFBcard /* Number of generated B- and F-cards */ |
| 640 | 641 | ){ |
| 641 | 642 | char *zDate; /* Date of the check-in */ |
| 642 | 643 | char *zParentUuid; /* UUID of parent check-in */ |
| 643 | 644 | Blob filename; /* A single filename */ |
| @@ -645,10 +646,11 @@ | ||
| 645 | 646 | Stmt q; /* Query of files changed */ |
| 646 | 647 | Stmt q2; /* Query of merge parents */ |
| 647 | 648 | Blob mcksum; /* Manifest checksum */ |
| 648 | 649 | ManifestFile *pFile; /* File from the baseline */ |
| 649 | 650 | int nFBcard = 0; /* Number of B-cards and F-cards */ |
| 651 | + int i; /* Loop counter */ | |
| 650 | 652 | |
| 651 | 653 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 652 | 654 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 653 | 655 | blob_zero(pOut); |
| 654 | 656 | zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| @@ -756,23 +758,31 @@ | ||
| 756 | 758 | |
| 757 | 759 | blob_appendf(pOut, "\n"); |
| 758 | 760 | if( pCksum ) blob_appendf(pOut, "R %b\n", pCksum); |
| 759 | 761 | if( zBranch && zBranch[0] ){ |
| 760 | 762 | /* Set tags for the new branch */ |
| 761 | - if( zBgColor && zBgColor[0] ){ | |
| 762 | - blob_appendf(pOut, "T *bgcolor * %F\n", zBgColor); | |
| 763 | + if( zBrClr && zBrClr[0] ){ | |
| 764 | + zColor = 0; | |
| 765 | + blob_appendf(pOut, "T *bgcolor * %F\n", zBrClr); | |
| 763 | 766 | } |
| 764 | 767 | blob_appendf(pOut, "T *branch * %F\n", zBranch); |
| 765 | 768 | blob_appendf(pOut, "T *sym-%F *\n", zBranch); |
| 766 | 769 | } |
| 770 | + if( zColor && zColor[0] ){ | |
| 771 | + /* One-time background color */ | |
| 772 | + blob_appendf(pOut, "T +bgcolor * %F\n", zColor); | |
| 773 | + } | |
| 767 | 774 | if( g.markPrivate ){ |
| 768 | 775 | /* If this manifest is private, mark it as such */ |
| 769 | 776 | blob_appendf(pOut, "T +private *\n"); |
| 770 | 777 | } |
| 771 | - if( zTag && zTag[0] ){ | |
| 772 | - /* Add a symbolic tag to this check-in */ | |
| 773 | - blob_appendf(pOut, "T +sym-%F *\n", zTag); | |
| 778 | + if( azTag ){ | |
| 779 | + for(i=0; azTag[i]; i++){ | |
| 780 | + /* Add a symbolic tag to this check-in. The tag names have already | |
| 781 | + ** been sorted and converted using the %F format */ | |
| 782 | + blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); | |
| 783 | + } | |
| 774 | 784 | } |
| 775 | 785 | if( zBranch && zBranch[0] ){ |
| 776 | 786 | /* For a new branch, cancel all prior propagating tags */ |
| 777 | 787 | Stmt q; |
| 778 | 788 | db_prepare(&q, |
| @@ -781,12 +791,12 @@ | ||
| 781 | 791 | " AND tagtype==2 AND tagname GLOB 'sym-*'" |
| 782 | 792 | " AND tagname!='sym-'||%Q" |
| 783 | 793 | " ORDER BY tagname", |
| 784 | 794 | vid, zBranch); |
| 785 | 795 | while( db_step(&q)==SQLITE_ROW ){ |
| 786 | - const char *zTag = db_column_text(&q, 0); | |
| 787 | - blob_appendf(pOut, "T -%F *\n", zTag); | |
| 796 | + const char *zBrTag = db_column_text(&q, 0); | |
| 797 | + blob_appendf(pOut, "T -%F *\n", zBrTag); | |
| 788 | 798 | } |
| 789 | 799 | db_finalize(&q); |
| 790 | 800 | } |
| 791 | 801 | blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 792 | 802 | md5sum_blob(pOut, &mcksum); |
| @@ -844,10 +854,19 @@ | ||
| 844 | 854 | } |
| 845 | 855 | blob_reset(&ans); |
| 846 | 856 | blob_reset(&fname); |
| 847 | 857 | } |
| 848 | 858 | } |
| 859 | + | |
| 860 | +/* | |
| 861 | +** qsort() comparison routine for an array of pointers to strings. | |
| 862 | +*/ | |
| 863 | +static int tagCmp(const void *a, const void *b){ | |
| 864 | + char **pA = (char**)a; | |
| 865 | + char **pB = (char**)b; | |
| 866 | + return fossil_strcmp(pA[0], pB[0]); | |
| 867 | +} | |
| 849 | 868 | |
| 850 | 869 | /* |
| 851 | 870 | ** COMMAND: ci* |
| 852 | 871 | ** COMMAND: commit |
| 853 | 872 | ** |
| @@ -877,12 +896,13 @@ | ||
| 877 | 896 | ** |
| 878 | 897 | ** the --tag option applies the symbolic tag name to the check-in. |
| 879 | 898 | ** |
| 880 | 899 | ** Options: |
| 881 | 900 | ** --baseline use a baseline manifest in the commit process |
| 882 | -** --bgcolor COLOR apply given COLOR to the branch | |
| 901 | +** --bgcolor COLOR apply COLOR to this one check-in only | |
| 883 | 902 | ** --branch NEW-BRANCH-NAME check in to this new branch |
| 903 | +** --branchcolor COLOR apply given COLOR to the branch | |
| 884 | 904 | ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 885 | 905 | ** --delta use a delta manifest in the commit process |
| 886 | 906 | ** --force|-f allow forking with this commit |
| 887 | 907 | ** --message-file|-M FILE read the commit comment from given file |
| 888 | 908 | ** --nosign do not attempt to sign this commit with gpg |
| @@ -908,15 +928,18 @@ | ||
| 908 | 928 | char *zManifestFile; /* Name of the manifest file */ |
| 909 | 929 | int useCksum; /* True if checksums should be computed and verified */ |
| 910 | 930 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 911 | 931 | int testRun; /* True for a test run. Debugging only */ |
| 912 | 932 | const char *zBranch; /* Create a new branch with this name */ |
| 913 | - const char *zBgColor; /* Set background color when branching */ | |
| 933 | + const char *zBrClr; /* Set background color when branching */ | |
| 934 | + const char *zColor; /* One-time check-in color */ | |
| 914 | 935 | const char *zDateOvrd; /* Override date string */ |
| 915 | 936 | const char *zUserOvrd; /* Override user name */ |
| 916 | 937 | const char *zComFile; /* Read commit message from this file */ |
| 917 | - const char *zTag; /* Symbolic tag to apply to this check-in */ | |
| 938 | + int nTag = 0; /* Number of --tag arguments */ | |
| 939 | + const char *zTag; /* A single --tag argument */ | |
| 940 | + const char **azTag = 0;/* Array of all --tag arguments */ | |
| 918 | 941 | Blob manifest; /* Manifest in baseline form */ |
| 919 | 942 | Blob muuid; /* Manifest uuid */ |
| 920 | 943 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 921 | 944 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 922 | 945 | int szD; /* Size of the delta manifest */ |
| @@ -931,26 +954,39 @@ | ||
| 931 | 954 | } |
| 932 | 955 | testRun = find_option("test",0,0)!=0; |
| 933 | 956 | zComment = find_option("comment","m",1); |
| 934 | 957 | forceFlag = find_option("force", "f", 0)!=0; |
| 935 | 958 | zBranch = find_option("branch","b",1); |
| 936 | - zBgColor = find_option("bgcolor",0,1); | |
| 937 | - zTag = find_option("tag",0,1); | |
| 959 | + zColor = find_option("bgcolor",0,1); | |
| 960 | + zBrClr = find_option("branchcolor",0,1); | |
| 961 | + while( (zTag = find_option("tag",0,1))!=0 ){ | |
| 962 | + if( zTag[0]==0 ) continue; | |
| 963 | + azTag = fossil_realloc(azTag, sizeof(char*)*(nTag+2)); | |
| 964 | + azTag[nTag++] = zTag; | |
| 965 | + azTag[nTag] = 0; | |
| 966 | + } | |
| 938 | 967 | zComFile = find_option("message-file", "M", 1); |
| 939 | 968 | if( find_option("private",0,0) ){ |
| 940 | 969 | g.markPrivate = 1; |
| 941 | 970 | if( zBranch==0 ) zBranch = "private"; |
| 942 | - if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */ | |
| 971 | + if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ | |
| 943 | 972 | } |
| 944 | 973 | zDateOvrd = find_option("date-override",0,1); |
| 945 | 974 | zUserOvrd = find_option("user-override",0,1); |
| 946 | 975 | db_must_be_within_tree(); |
| 947 | 976 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 948 | 977 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 949 | 978 | useCksum = db_get_boolean("repo-cksum", 1); |
| 950 | 979 | outputManifest = db_get_boolean("manifest", 0); |
| 951 | 980 | verify_all_options(); |
| 981 | + | |
| 982 | + /* Escape special characters in tags and put all tags in sorted order */ | |
| 983 | + if( nTag ){ | |
| 984 | + int i; | |
| 985 | + for(i=0; i<nTag; i++) azTag[i] = mprintf("%F", azTag[i]); | |
| 986 | + qsort((void*)azTag, nTag, sizeof(azTag[0]), tagCmp); | |
| 987 | + } | |
| 952 | 988 | |
| 953 | 989 | /* So that older versions of Fossil (that do not understand delta- |
| 954 | 990 | ** manifest) can continue to use this repository, do not create a new |
| 955 | 991 | ** delta-manifest unless this repository already contains one or more |
| 956 | 992 | ** delta-manifets, or unless the delta-manifest is explicitly requested |
| @@ -1126,11 +1162,12 @@ | ||
| 1126 | 1162 | if( forceDelta ){ |
| 1127 | 1163 | blob_zero(&manifest); |
| 1128 | 1164 | }else{ |
| 1129 | 1165 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1130 | 1166 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1131 | - zDateOvrd, zUserOvrd, zBranch, zBgColor, zTag, &szB); | |
| 1167 | + zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, | |
| 1168 | + azTag, &szB); | |
| 1132 | 1169 | } |
| 1133 | 1170 | |
| 1134 | 1171 | /* See if a delta-manifest would be more appropriate */ |
| 1135 | 1172 | if( !forceBaseline ){ |
| 1136 | 1173 | const char *zBaselineUuid; |
| @@ -1146,11 +1183,12 @@ | ||
| 1146 | 1183 | } |
| 1147 | 1184 | if( pBaseline ){ |
| 1148 | 1185 | Blob delta; |
| 1149 | 1186 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1150 | 1187 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1151 | - zDateOvrd, zUserOvrd, zBranch, zBgColor, zTag, &szD); | |
| 1188 | + zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, | |
| 1189 | + azTag, &szD); | |
| 1152 | 1190 | /* |
| 1153 | 1191 | ** At this point, two manifests have been constructed, either of |
| 1154 | 1192 | ** which would work for this checkin. The first manifest (held |
| 1155 | 1193 | ** in the "manifest" variable) is a baseline manifest and the second |
| 1156 | 1194 | ** (held in variable named "delta") is a delta manifest. The |
| 1157 | 1195 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -632,12 +632,13 @@ | |
| 632 | int verifyDate, /* Verify that child is younger */ |
| 633 | Blob *pCksum, /* Repository checksum. May be 0 */ |
| 634 | const char *zDateOvrd, /* Date override. If 0 then use 'now' */ |
| 635 | const char *zUserOvrd, /* User override. If 0 then use g.zLogin */ |
| 636 | const char *zBranch, /* Branch name. May be 0 */ |
| 637 | const char *zBgColor, /* Background color. May be 0 */ |
| 638 | const char *zTag, /* Tag to apply to this check-in */ |
| 639 | int *pnFBcard /* Number of generated B- and F-cards */ |
| 640 | ){ |
| 641 | char *zDate; /* Date of the check-in */ |
| 642 | char *zParentUuid; /* UUID of parent check-in */ |
| 643 | Blob filename; /* A single filename */ |
| @@ -645,10 +646,11 @@ | |
| 645 | Stmt q; /* Query of files changed */ |
| 646 | Stmt q2; /* Query of merge parents */ |
| 647 | Blob mcksum; /* Manifest checksum */ |
| 648 | ManifestFile *pFile; /* File from the baseline */ |
| 649 | int nFBcard = 0; /* Number of B-cards and F-cards */ |
| 650 | |
| 651 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 652 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 653 | blob_zero(pOut); |
| 654 | zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| @@ -756,23 +758,31 @@ | |
| 756 | |
| 757 | blob_appendf(pOut, "\n"); |
| 758 | if( pCksum ) blob_appendf(pOut, "R %b\n", pCksum); |
| 759 | if( zBranch && zBranch[0] ){ |
| 760 | /* Set tags for the new branch */ |
| 761 | if( zBgColor && zBgColor[0] ){ |
| 762 | blob_appendf(pOut, "T *bgcolor * %F\n", zBgColor); |
| 763 | } |
| 764 | blob_appendf(pOut, "T *branch * %F\n", zBranch); |
| 765 | blob_appendf(pOut, "T *sym-%F *\n", zBranch); |
| 766 | } |
| 767 | if( g.markPrivate ){ |
| 768 | /* If this manifest is private, mark it as such */ |
| 769 | blob_appendf(pOut, "T +private *\n"); |
| 770 | } |
| 771 | if( zTag && zTag[0] ){ |
| 772 | /* Add a symbolic tag to this check-in */ |
| 773 | blob_appendf(pOut, "T +sym-%F *\n", zTag); |
| 774 | } |
| 775 | if( zBranch && zBranch[0] ){ |
| 776 | /* For a new branch, cancel all prior propagating tags */ |
| 777 | Stmt q; |
| 778 | db_prepare(&q, |
| @@ -781,12 +791,12 @@ | |
| 781 | " AND tagtype==2 AND tagname GLOB 'sym-*'" |
| 782 | " AND tagname!='sym-'||%Q" |
| 783 | " ORDER BY tagname", |
| 784 | vid, zBranch); |
| 785 | while( db_step(&q)==SQLITE_ROW ){ |
| 786 | const char *zTag = db_column_text(&q, 0); |
| 787 | blob_appendf(pOut, "T -%F *\n", zTag); |
| 788 | } |
| 789 | db_finalize(&q); |
| 790 | } |
| 791 | blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 792 | md5sum_blob(pOut, &mcksum); |
| @@ -844,10 +854,19 @@ | |
| 844 | } |
| 845 | blob_reset(&ans); |
| 846 | blob_reset(&fname); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | /* |
| 851 | ** COMMAND: ci* |
| 852 | ** COMMAND: commit |
| 853 | ** |
| @@ -877,12 +896,13 @@ | |
| 877 | ** |
| 878 | ** the --tag option applies the symbolic tag name to the check-in. |
| 879 | ** |
| 880 | ** Options: |
| 881 | ** --baseline use a baseline manifest in the commit process |
| 882 | ** --bgcolor COLOR apply given COLOR to the branch |
| 883 | ** --branch NEW-BRANCH-NAME check in to this new branch |
| 884 | ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 885 | ** --delta use a delta manifest in the commit process |
| 886 | ** --force|-f allow forking with this commit |
| 887 | ** --message-file|-M FILE read the commit comment from given file |
| 888 | ** --nosign do not attempt to sign this commit with gpg |
| @@ -908,15 +928,18 @@ | |
| 908 | char *zManifestFile; /* Name of the manifest file */ |
| 909 | int useCksum; /* True if checksums should be computed and verified */ |
| 910 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 911 | int testRun; /* True for a test run. Debugging only */ |
| 912 | const char *zBranch; /* Create a new branch with this name */ |
| 913 | const char *zBgColor; /* Set background color when branching */ |
| 914 | const char *zDateOvrd; /* Override date string */ |
| 915 | const char *zUserOvrd; /* Override user name */ |
| 916 | const char *zComFile; /* Read commit message from this file */ |
| 917 | const char *zTag; /* Symbolic tag to apply to this check-in */ |
| 918 | Blob manifest; /* Manifest in baseline form */ |
| 919 | Blob muuid; /* Manifest uuid */ |
| 920 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 921 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 922 | int szD; /* Size of the delta manifest */ |
| @@ -931,26 +954,39 @@ | |
| 931 | } |
| 932 | testRun = find_option("test",0,0)!=0; |
| 933 | zComment = find_option("comment","m",1); |
| 934 | forceFlag = find_option("force", "f", 0)!=0; |
| 935 | zBranch = find_option("branch","b",1); |
| 936 | zBgColor = find_option("bgcolor",0,1); |
| 937 | zTag = find_option("tag",0,1); |
| 938 | zComFile = find_option("message-file", "M", 1); |
| 939 | if( find_option("private",0,0) ){ |
| 940 | g.markPrivate = 1; |
| 941 | if( zBranch==0 ) zBranch = "private"; |
| 942 | if( zBgColor==0 ) zBgColor = "#fec084"; /* Orange */ |
| 943 | } |
| 944 | zDateOvrd = find_option("date-override",0,1); |
| 945 | zUserOvrd = find_option("user-override",0,1); |
| 946 | db_must_be_within_tree(); |
| 947 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 948 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 949 | useCksum = db_get_boolean("repo-cksum", 1); |
| 950 | outputManifest = db_get_boolean("manifest", 0); |
| 951 | verify_all_options(); |
| 952 | |
| 953 | /* So that older versions of Fossil (that do not understand delta- |
| 954 | ** manifest) can continue to use this repository, do not create a new |
| 955 | ** delta-manifest unless this repository already contains one or more |
| 956 | ** delta-manifets, or unless the delta-manifest is explicitly requested |
| @@ -1126,11 +1162,12 @@ | |
| 1126 | if( forceDelta ){ |
| 1127 | blob_zero(&manifest); |
| 1128 | }else{ |
| 1129 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1130 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1131 | zDateOvrd, zUserOvrd, zBranch, zBgColor, zTag, &szB); |
| 1132 | } |
| 1133 | |
| 1134 | /* See if a delta-manifest would be more appropriate */ |
| 1135 | if( !forceBaseline ){ |
| 1136 | const char *zBaselineUuid; |
| @@ -1146,11 +1183,12 @@ | |
| 1146 | } |
| 1147 | if( pBaseline ){ |
| 1148 | Blob delta; |
| 1149 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1150 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1151 | zDateOvrd, zUserOvrd, zBranch, zBgColor, zTag, &szD); |
| 1152 | /* |
| 1153 | ** At this point, two manifests have been constructed, either of |
| 1154 | ** which would work for this checkin. The first manifest (held |
| 1155 | ** in the "manifest" variable) is a baseline manifest and the second |
| 1156 | ** (held in variable named "delta") is a delta manifest. The |
| 1157 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -632,12 +632,13 @@ | |
| 632 | int verifyDate, /* Verify that child is younger */ |
| 633 | Blob *pCksum, /* Repository checksum. May be 0 */ |
| 634 | const char *zDateOvrd, /* Date override. If 0 then use 'now' */ |
| 635 | const char *zUserOvrd, /* User override. If 0 then use g.zLogin */ |
| 636 | const char *zBranch, /* Branch name. May be 0 */ |
| 637 | const char *zColor, /* One-time gackground color. May be 0 */ |
| 638 | const char *zBrClr, /* Persistent branch color. May be 0 */ |
| 639 | const char **azTag, /* Tags to apply to this check-in */ |
| 640 | int *pnFBcard /* Number of generated B- and F-cards */ |
| 641 | ){ |
| 642 | char *zDate; /* Date of the check-in */ |
| 643 | char *zParentUuid; /* UUID of parent check-in */ |
| 644 | Blob filename; /* A single filename */ |
| @@ -645,10 +646,11 @@ | |
| 646 | Stmt q; /* Query of files changed */ |
| 647 | Stmt q2; /* Query of merge parents */ |
| 648 | Blob mcksum; /* Manifest checksum */ |
| 649 | ManifestFile *pFile; /* File from the baseline */ |
| 650 | int nFBcard = 0; /* Number of B-cards and F-cards */ |
| 651 | int i; /* Loop counter */ |
| 652 | |
| 653 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 654 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 655 | blob_zero(pOut); |
| 656 | zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| @@ -756,23 +758,31 @@ | |
| 758 | |
| 759 | blob_appendf(pOut, "\n"); |
| 760 | if( pCksum ) blob_appendf(pOut, "R %b\n", pCksum); |
| 761 | if( zBranch && zBranch[0] ){ |
| 762 | /* Set tags for the new branch */ |
| 763 | if( zBrClr && zBrClr[0] ){ |
| 764 | zColor = 0; |
| 765 | blob_appendf(pOut, "T *bgcolor * %F\n", zBrClr); |
| 766 | } |
| 767 | blob_appendf(pOut, "T *branch * %F\n", zBranch); |
| 768 | blob_appendf(pOut, "T *sym-%F *\n", zBranch); |
| 769 | } |
| 770 | if( zColor && zColor[0] ){ |
| 771 | /* One-time background color */ |
| 772 | blob_appendf(pOut, "T +bgcolor * %F\n", zColor); |
| 773 | } |
| 774 | if( g.markPrivate ){ |
| 775 | /* If this manifest is private, mark it as such */ |
| 776 | blob_appendf(pOut, "T +private *\n"); |
| 777 | } |
| 778 | if( azTag ){ |
| 779 | for(i=0; azTag[i]; i++){ |
| 780 | /* Add a symbolic tag to this check-in. The tag names have already |
| 781 | ** been sorted and converted using the %F format */ |
| 782 | blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); |
| 783 | } |
| 784 | } |
| 785 | if( zBranch && zBranch[0] ){ |
| 786 | /* For a new branch, cancel all prior propagating tags */ |
| 787 | Stmt q; |
| 788 | db_prepare(&q, |
| @@ -781,12 +791,12 @@ | |
| 791 | " AND tagtype==2 AND tagname GLOB 'sym-*'" |
| 792 | " AND tagname!='sym-'||%Q" |
| 793 | " ORDER BY tagname", |
| 794 | vid, zBranch); |
| 795 | while( db_step(&q)==SQLITE_ROW ){ |
| 796 | const char *zBrTag = db_column_text(&q, 0); |
| 797 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 798 | } |
| 799 | db_finalize(&q); |
| 800 | } |
| 801 | blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 802 | md5sum_blob(pOut, &mcksum); |
| @@ -844,10 +854,19 @@ | |
| 854 | } |
| 855 | blob_reset(&ans); |
| 856 | blob_reset(&fname); |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | /* |
| 861 | ** qsort() comparison routine for an array of pointers to strings. |
| 862 | */ |
| 863 | static int tagCmp(const void *a, const void *b){ |
| 864 | char **pA = (char**)a; |
| 865 | char **pB = (char**)b; |
| 866 | return fossil_strcmp(pA[0], pB[0]); |
| 867 | } |
| 868 | |
| 869 | /* |
| 870 | ** COMMAND: ci* |
| 871 | ** COMMAND: commit |
| 872 | ** |
| @@ -877,12 +896,13 @@ | |
| 896 | ** |
| 897 | ** the --tag option applies the symbolic tag name to the check-in. |
| 898 | ** |
| 899 | ** Options: |
| 900 | ** --baseline use a baseline manifest in the commit process |
| 901 | ** --bgcolor COLOR apply COLOR to this one check-in only |
| 902 | ** --branch NEW-BRANCH-NAME check in to this new branch |
| 903 | ** --branchcolor COLOR apply given COLOR to the branch |
| 904 | ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 905 | ** --delta use a delta manifest in the commit process |
| 906 | ** --force|-f allow forking with this commit |
| 907 | ** --message-file|-M FILE read the commit comment from given file |
| 908 | ** --nosign do not attempt to sign this commit with gpg |
| @@ -908,15 +928,18 @@ | |
| 928 | char *zManifestFile; /* Name of the manifest file */ |
| 929 | int useCksum; /* True if checksums should be computed and verified */ |
| 930 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 931 | int testRun; /* True for a test run. Debugging only */ |
| 932 | const char *zBranch; /* Create a new branch with this name */ |
| 933 | const char *zBrClr; /* Set background color when branching */ |
| 934 | const char *zColor; /* One-time check-in color */ |
| 935 | const char *zDateOvrd; /* Override date string */ |
| 936 | const char *zUserOvrd; /* Override user name */ |
| 937 | const char *zComFile; /* Read commit message from this file */ |
| 938 | int nTag = 0; /* Number of --tag arguments */ |
| 939 | const char *zTag; /* A single --tag argument */ |
| 940 | const char **azTag = 0;/* Array of all --tag arguments */ |
| 941 | Blob manifest; /* Manifest in baseline form */ |
| 942 | Blob muuid; /* Manifest uuid */ |
| 943 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 944 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 945 | int szD; /* Size of the delta manifest */ |
| @@ -931,26 +954,39 @@ | |
| 954 | } |
| 955 | testRun = find_option("test",0,0)!=0; |
| 956 | zComment = find_option("comment","m",1); |
| 957 | forceFlag = find_option("force", "f", 0)!=0; |
| 958 | zBranch = find_option("branch","b",1); |
| 959 | zColor = find_option("bgcolor",0,1); |
| 960 | zBrClr = find_option("branchcolor",0,1); |
| 961 | while( (zTag = find_option("tag",0,1))!=0 ){ |
| 962 | if( zTag[0]==0 ) continue; |
| 963 | azTag = fossil_realloc(azTag, sizeof(char*)*(nTag+2)); |
| 964 | azTag[nTag++] = zTag; |
| 965 | azTag[nTag] = 0; |
| 966 | } |
| 967 | zComFile = find_option("message-file", "M", 1); |
| 968 | if( find_option("private",0,0) ){ |
| 969 | g.markPrivate = 1; |
| 970 | if( zBranch==0 ) zBranch = "private"; |
| 971 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 972 | } |
| 973 | zDateOvrd = find_option("date-override",0,1); |
| 974 | zUserOvrd = find_option("user-override",0,1); |
| 975 | db_must_be_within_tree(); |
| 976 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 977 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 978 | useCksum = db_get_boolean("repo-cksum", 1); |
| 979 | outputManifest = db_get_boolean("manifest", 0); |
| 980 | verify_all_options(); |
| 981 | |
| 982 | /* Escape special characters in tags and put all tags in sorted order */ |
| 983 | if( nTag ){ |
| 984 | int i; |
| 985 | for(i=0; i<nTag; i++) azTag[i] = mprintf("%F", azTag[i]); |
| 986 | qsort((void*)azTag, nTag, sizeof(azTag[0]), tagCmp); |
| 987 | } |
| 988 | |
| 989 | /* So that older versions of Fossil (that do not understand delta- |
| 990 | ** manifest) can continue to use this repository, do not create a new |
| 991 | ** delta-manifest unless this repository already contains one or more |
| 992 | ** delta-manifets, or unless the delta-manifest is explicitly requested |
| @@ -1126,11 +1162,12 @@ | |
| 1162 | if( forceDelta ){ |
| 1163 | blob_zero(&manifest); |
| 1164 | }else{ |
| 1165 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1166 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1167 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1168 | azTag, &szB); |
| 1169 | } |
| 1170 | |
| 1171 | /* See if a delta-manifest would be more appropriate */ |
| 1172 | if( !forceBaseline ){ |
| 1173 | const char *zBaselineUuid; |
| @@ -1146,11 +1183,12 @@ | |
| 1183 | } |
| 1184 | if( pBaseline ){ |
| 1185 | Blob delta; |
| 1186 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1187 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1188 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1189 | azTag, &szD); |
| 1190 | /* |
| 1191 | ** At this point, two manifests have been constructed, either of |
| 1192 | ** which would work for this checkin. The first manifest (held |
| 1193 | ** in the "manifest" variable) is a baseline manifest and the second |
| 1194 | ** (held in variable named "delta") is a delta manifest. The |
| 1195 |