| | @@ -37,11 +37,11 @@ |
| 37 | 37 | int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */ |
| 38 | 38 | ){ |
| 39 | 39 | Stmt q; |
| 40 | 40 | int nPrefix = strlen(zPrefix); |
| 41 | 41 | int nErr = 0; |
| 42 | | - db_prepare(&q, |
| 42 | + db_prepare(&q, |
| 43 | 43 | "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" |
| 44 | 44 | " FROM vfile " |
| 45 | 45 | " WHERE file_is_selected(id)" |
| 46 | 46 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 47 | 47 | ); |
| | @@ -107,10 +107,13 @@ |
| 107 | 107 | ** |
| 108 | 108 | ** Options: |
| 109 | 109 | ** |
| 110 | 110 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 111 | 111 | ** than relying on file mtimes. |
| 112 | +** |
| 113 | +** |
| 114 | +** SUMMARY: fossil changes ?--sha1sum? |
| 112 | 115 | */ |
| 113 | 116 | void changes_cmd(void){ |
| 114 | 117 | Blob report; |
| 115 | 118 | int vid; |
| 116 | 119 | int useSha1sum = find_option("sha1sum", 0, 0)!=0; |
| | @@ -131,10 +134,13 @@ |
| 131 | 134 | ** |
| 132 | 135 | ** Options: |
| 133 | 136 | ** |
| 134 | 137 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 135 | 138 | ** than relying on file mtimes. |
| 139 | +** |
| 140 | +** |
| 141 | +** SUMMARY: fossil status ?--sha1sum? |
| 136 | 142 | */ |
| 137 | 143 | void status_cmd(void){ |
| 138 | 144 | int vid; |
| 139 | 145 | db_must_be_within_tree(); |
| 140 | 146 | /* 012345678901234 */ |
| | @@ -153,10 +159,13 @@ |
| 153 | 159 | ** |
| 154 | 160 | ** Usage: %fossil ls [-l] |
| 155 | 161 | ** |
| 156 | 162 | ** Show the names of all files in the current checkout. The -l provides |
| 157 | 163 | ** extra information about each file. |
| 164 | +** |
| 165 | +** |
| 166 | +** SUMMARY: fossil ls ?-l? |
| 158 | 167 | */ |
| 159 | 168 | void ls_cmd(void){ |
| 160 | 169 | int vid; |
| 161 | 170 | Stmt q; |
| 162 | 171 | int isBrief; |
| | @@ -257,19 +266,23 @@ |
| 257 | 266 | |
| 258 | 267 | /* |
| 259 | 268 | ** COMMAND: extras |
| 260 | 269 | ** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN? |
| 261 | 270 | ** |
| 262 | | -** Print a list of all files in the source tree that are not part of |
| 271 | +** Print a list of all files in the source tree that are NOT part of |
| 263 | 272 | ** the current checkout. See also the "clean" command. |
| 264 | 273 | ** |
| 265 | 274 | ** Files and subdirectories whose names begin with "." are normally |
| 266 | 275 | ** ignored but can be included by adding the --dotfiles option. |
| 267 | 276 | ** |
| 268 | 277 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 269 | 278 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 270 | | -** is used if the --ignore option is omitted. |
| 279 | +** setting is used if the --ignore option is omitted. (See the settings |
| 280 | +** command for more information.) |
| 281 | +** |
| 282 | +** |
| 283 | +** SUMMARY: fossil extras ?-dotfiles? ?--ignore globpattern? |
| 271 | 284 | */ |
| 272 | 285 | void extra_cmd(void){ |
| 273 | 286 | Blob path; |
| 274 | 287 | Blob repo; |
| 275 | 288 | Stmt q; |
| | @@ -285,11 +298,11 @@ |
| 285 | 298 | blob_init(&path, g.zLocalRoot, n-1); |
| 286 | 299 | if( zIgnoreFlag==0 ){ |
| 287 | 300 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 288 | 301 | } |
| 289 | 302 | vfile_scan(0, &path, blob_size(&path), allFlag); |
| 290 | | - db_prepare(&q, |
| 303 | + db_prepare(&q, |
| 291 | 304 | "SELECT x FROM sfile" |
| 292 | 305 | " WHERE x NOT IN (%s)" |
| 293 | 306 | " AND NOT %s" |
| 294 | 307 | " ORDER BY 1", |
| 295 | 308 | fossil_all_reserved_names(), |
| | @@ -308,23 +321,29 @@ |
| 308 | 321 | ** COMMAND: clean |
| 309 | 322 | ** Usage: %fossil clean ?--force? ?--dotfiles? ?--ignore GLOBPATTERN? |
| 310 | 323 | ** |
| 311 | 324 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 312 | 325 | ** files that are not officially part of the checkout. See also |
| 313 | | -** the "extra" command. This operation cannot be undone. |
| 326 | +** the "extras" command. |
| 327 | +** |
| 328 | +** TAKE CARE: This operation cannot be undone! |
| 314 | 329 | ** |
| 315 | 330 | ** You will be prompted before removing each file. If you are |
| 316 | 331 | ** sure you wish to remove all "extra" files you can specify the |
| 317 | | -** optional --force flag and no prompts will be issued. |
| 332 | +** --force flag and no prompts will be issued. |
| 318 | 333 | ** |
| 319 | 334 | ** Files and subdirectories whose names begin with "." are |
| 320 | 335 | ** normally ignored. They are included if the "--dotfiles" option |
| 321 | 336 | ** is used. |
| 322 | 337 | ** |
| 323 | 338 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 324 | 339 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 325 | | -** is used if the --ignore option is omitted. |
| 340 | +** setting is used if the --ignore option is omitted. (See the settings |
| 341 | +** command for more information.) |
| 342 | +** |
| 343 | +** |
| 344 | +** SUMMARY: fossil clean ?--force? ?--dotfiles? ?--ignore globpattern? |
| 326 | 345 | */ |
| 327 | 346 | void clean_cmd(void){ |
| 328 | 347 | int allFlag; |
| 329 | 348 | int dotfilesFlag; |
| 330 | 349 | const char *zIgnoreFlag; |
| | @@ -340,11 +359,11 @@ |
| 340 | 359 | } |
| 341 | 360 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 342 | 361 | n = strlen(g.zLocalRoot); |
| 343 | 362 | blob_init(&path, g.zLocalRoot, n-1); |
| 344 | 363 | vfile_scan(0, &path, blob_size(&path), dotfilesFlag); |
| 345 | | - db_prepare(&q, |
| 364 | + db_prepare(&q, |
| 346 | 365 | "SELECT %Q || x FROM sfile" |
| 347 | 366 | " WHERE x NOT IN (%s) AND NOT %s" |
| 348 | 367 | " ORDER BY 1", |
| 349 | 368 | g.zLocalRoot, fossil_all_reserved_names(), glob_expr("x",zIgnoreFlag) |
| 350 | 369 | ); |
| | @@ -517,15 +536,15 @@ |
| 517 | 536 | } |
| 518 | 537 | } |
| 519 | 538 | |
| 520 | 539 | /* |
| 521 | 540 | ** Return true if the check-in with RID=rid is a leaf. |
| 522 | | -** A leaf has no children in the same branch. |
| 541 | +** A leaf has no children in the same branch. |
| 523 | 542 | */ |
| 524 | 543 | int is_a_leaf(int rid){ |
| 525 | 544 | int rc; |
| 526 | | - static const char zSql[] = |
| 545 | + static const char zSql[] = |
| 527 | 546 | @ SELECT 1 FROM plink |
| 528 | 547 | @ WHERE pid=%d |
| 529 | 548 | @ AND coalesce((SELECT value FROM tagxref |
| 530 | 549 | @ WHERE tagid=%d AND rid=plink.pid), 'trunk') |
| 531 | 550 | @ =coalesce((SELECT value FROM tagxref |
| | @@ -559,11 +578,11 @@ |
| 559 | 578 | #endif |
| 560 | 579 | } |
| 561 | 580 | |
| 562 | 581 | /* |
| 563 | 582 | ** zDate should be a valid date string. Convert this string into the |
| 564 | | -** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date, |
| 583 | +** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date, |
| 565 | 584 | ** print a fatal error and quit. |
| 566 | 585 | */ |
| 567 | 586 | char *date_in_standard_format(const char *zInputDate){ |
| 568 | 587 | char *zDate; |
| 569 | 588 | zDate = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%f',%Q)", |
| | @@ -641,11 +660,11 @@ |
| 641 | 660 | const char *zPerm; |
| 642 | 661 | int cmp; |
| 643 | 662 | #if !defined(_WIN32) |
| 644 | 663 | /* For unix, extract the "executable" permission bit directly from |
| 645 | 664 | ** the filesystem. On windows, the "executable" bit is retained |
| 646 | | - ** unchanged from the original. |
| 665 | + ** unchanged from the original. |
| 647 | 666 | */ |
| 648 | 667 | blob_resize(&filename, nBasename); |
| 649 | 668 | blob_append(&filename, zName, -1); |
| 650 | 669 | isexe = file_isexe(blob_str(&filename)); |
| 651 | 670 | #endif |
| | @@ -733,11 +752,11 @@ |
| 733 | 752 | while( db_step(&q)==SQLITE_ROW ){ |
| 734 | 753 | const char *zTag = db_column_text(&q, 0); |
| 735 | 754 | blob_appendf(pOut, "T -%F *\n", zTag); |
| 736 | 755 | } |
| 737 | 756 | db_finalize(&q); |
| 738 | | - } |
| 757 | + } |
| 739 | 758 | blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 740 | 759 | md5sum_blob(pOut, &mcksum); |
| 741 | 760 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 742 | 761 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 743 | 762 | } |
| | @@ -776,11 +795,11 @@ |
| 776 | 795 | } |
| 777 | 796 | if( nCrNl ){ |
| 778 | 797 | char c; |
| 779 | 798 | file_relative_name(zFilename, &fname); |
| 780 | 799 | blob_zero(&ans); |
| 781 | | - zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?", |
| 800 | + zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?", |
| 782 | 801 | blob_str(&fname)); |
| 783 | 802 | prompt_user(zMsg, &ans); |
| 784 | 803 | fossil_free(zMsg); |
| 785 | 804 | c = blob_str(&ans)[0]; |
| 786 | 805 | if( c=='a' ){ |
| | @@ -800,11 +819,11 @@ |
| 800 | 819 | ** |
| 801 | 820 | ** Usage: %fossil commit ?OPTIONS? ?FILE...? |
| 802 | 821 | ** |
| 803 | 822 | ** Create a new version containing all of the changes in the current |
| 804 | 823 | ** checkout. You will be prompted to enter a check-in comment unless |
| 805 | | -** the comment has been specified on the command-line using "-m" or a |
| 824 | +** the comment has been specified on the command-line using "-m" or a |
| 806 | 825 | ** file containing the comment using -M. The editor defined in the |
| 807 | 826 | ** "editor" fossil option (see %fossil help set) will be used, or from |
| 808 | 827 | ** the "VISUAL" or "EDITOR" environment variables (in that order) if |
| 809 | 828 | ** no editor is set. |
| 810 | 829 | ** |
| | @@ -834,11 +853,11 @@ |
| 834 | 853 | ** --force|-f |
| 835 | 854 | ** --private |
| 836 | 855 | ** --baseline |
| 837 | 856 | ** --delta |
| 838 | 857 | ** --tag TAG-NAME |
| 839 | | -** |
| 858 | +** |
| 840 | 859 | */ |
| 841 | 860 | void commit_cmd(void){ |
| 842 | 861 | int hasChanges; /* True if unsaved changes exist */ |
| 843 | 862 | int vid; /* blob-id of parent version */ |
| 844 | 863 | int nrid; /* blob-id of a modified file */ |
| | @@ -866,11 +885,11 @@ |
| 866 | 885 | Blob muuid; /* Manifest uuid */ |
| 867 | 886 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 868 | 887 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 869 | 888 | int szD; /* Size of the delta manifest */ |
| 870 | 889 | int szB; /* Size of the baseline manifest */ |
| 871 | | - |
| 890 | + |
| 872 | 891 | url_proxy_options(); |
| 873 | 892 | noSign = find_option("nosign",0,0)!=0; |
| 874 | 893 | forceDelta = find_option("delta",0,0)!=0; |
| 875 | 894 | forceBaseline = find_option("baseline",0,0)!=0; |
| 876 | 895 | if( forceDelta && forceBaseline ){ |
| | @@ -960,11 +979,11 @@ |
| 960 | 979 | ** Check that the user exists. |
| 961 | 980 | */ |
| 962 | 981 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){ |
| 963 | 982 | fossil_fatal("no such user: %s", g.zLogin); |
| 964 | 983 | } |
| 965 | | - |
| 984 | + |
| 966 | 985 | hasChanges = unsaved_changes(); |
| 967 | 986 | db_begin_transaction(); |
| 968 | 987 | db_record_repository_filename(0); |
| 969 | 988 | if( hasChanges==0 && !isAMerge && !forceFlag ){ |
| 970 | 989 | fossil_fatal("nothing has changed"); |
| | @@ -975,11 +994,11 @@ |
| 975 | 994 | */ |
| 976 | 995 | if( g.aCommitFile ){ |
| 977 | 996 | Blob unmodified; |
| 978 | 997 | memset(&unmodified, 0, sizeof(Blob)); |
| 979 | 998 | blob_init(&unmodified, 0, 0); |
| 980 | | - db_blob(&unmodified, |
| 999 | + db_blob(&unmodified, |
| 981 | 1000 | "SELECT pathname FROM vfile" |
| 982 | 1001 | " WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)" |
| 983 | 1002 | ); |
| 984 | 1003 | if( strlen(blob_str(&unmodified)) ){ |
| 985 | 1004 | fossil_fatal("file %s has not changed", blob_str(&unmodified)); |
| | @@ -993,11 +1012,11 @@ |
| 993 | 1012 | if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){ |
| 994 | 1013 | fossil_fatal("would fork. \"update\" first or use -f or --force."); |
| 995 | 1014 | } |
| 996 | 1015 | |
| 997 | 1016 | /* |
| 998 | | - ** Do not allow a commit against a closed leaf |
| 1017 | + ** Do not allow a commit against a closed leaf |
| 999 | 1018 | */ |
| 1000 | 1019 | if( db_exists("SELECT 1 FROM tagxref" |
| 1001 | 1020 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1002 | 1021 | TAG_CLOSED, vid) ){ |
| 1003 | 1022 | fossil_fatal("cannot commit against a closed leaf"); |
| | @@ -1026,11 +1045,11 @@ |
| 1026 | 1045 | db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment); |
| 1027 | 1046 | db_end_transaction(0); |
| 1028 | 1047 | db_begin_transaction(); |
| 1029 | 1048 | } |
| 1030 | 1049 | |
| 1031 | | - /* Step 1: Insert records for all modified files into the blob |
| 1050 | + /* Step 1: Insert records for all modified files into the blob |
| 1032 | 1051 | ** table. If there were arguments passed to this command, only |
| 1033 | 1052 | ** the identified fils are inserted (if they have been modified). |
| 1034 | 1053 | */ |
| 1035 | 1054 | db_prepare(&q, |
| 1036 | 1055 | "SELECT id, %Q || pathname, mrid, %s FROM vfile " |
| | @@ -1128,11 +1147,11 @@ |
| 1128 | 1147 | fossil_exit(1); |
| 1129 | 1148 | } |
| 1130 | 1149 | } |
| 1131 | 1150 | |
| 1132 | 1151 | /* If the --test option is specified, output the manifest file |
| 1133 | | - ** and rollback the transaction. |
| 1152 | + ** and rollback the transaction. |
| 1134 | 1153 | */ |
| 1135 | 1154 | if( testRun ){ |
| 1136 | 1155 | blob_write_to_file(&manifest, ""); |
| 1137 | 1156 | } |
| 1138 | 1157 | |
| | @@ -1160,11 +1179,11 @@ |
| 1160 | 1179 | blob_write_to_file(&muuid, zManifestFile); |
| 1161 | 1180 | free(zManifestFile); |
| 1162 | 1181 | blob_reset(&muuid); |
| 1163 | 1182 | } |
| 1164 | 1183 | |
| 1165 | | - |
| 1184 | + |
| 1166 | 1185 | /* Update the vfile and vmerge tables */ |
| 1167 | 1186 | db_multi_exec( |
| 1168 | 1187 | "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);" |
| 1169 | 1188 | "DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;" |
| 1170 | 1189 | "UPDATE vfile SET vid=%d;" |
| | @@ -1184,11 +1203,11 @@ |
| 1184 | 1203 | vfile_compare_repository_to_disk(nvid); |
| 1185 | 1204 | fossil_fatal("working checkout does not match what would have ended " |
| 1186 | 1205 | "up in the repository: %b versus %b", |
| 1187 | 1206 | &cksum1, &cksum2); |
| 1188 | 1207 | } |
| 1189 | | - |
| 1208 | + |
| 1190 | 1209 | /* Verify that the manifest checksum matches the expected checksum */ |
| 1191 | 1210 | vfile_aggregate_checksum_manifest(nvid, &cksum2, &cksum1b); |
| 1192 | 1211 | if( blob_compare(&cksum1, &cksum1b) ){ |
| 1193 | 1212 | fossil_fatal("manifest checksum self-test failed: " |
| 1194 | 1213 | "%b versus %b", &cksum1, &cksum1b); |
| | @@ -1196,11 +1215,11 @@ |
| 1196 | 1215 | if( blob_compare(&cksum1, &cksum2) ){ |
| 1197 | 1216 | fossil_fatal( |
| 1198 | 1217 | "working checkout does not match manifest after commit: " |
| 1199 | 1218 | "%b versus %b", &cksum1, &cksum2); |
| 1200 | 1219 | } |
| 1201 | | - |
| 1220 | + |
| 1202 | 1221 | /* Verify that the commit did not modify any disk images. */ |
| 1203 | 1222 | vfile_aggregate_checksum_disk(nvid, &cksum2); |
| 1204 | 1223 | if( blob_compare(&cksum1, &cksum2) ){ |
| 1205 | 1224 | fossil_fatal("working checkout before and after commit does not match"); |
| 1206 | 1225 | } |
| | @@ -1216,11 +1235,11 @@ |
| 1216 | 1235 | exit(1); |
| 1217 | 1236 | } |
| 1218 | 1237 | db_end_transaction(0); |
| 1219 | 1238 | |
| 1220 | 1239 | if( !g.markPrivate ){ |
| 1221 | | - autosync(AUTOSYNC_PUSH); |
| 1240 | + autosync(AUTOSYNC_PUSH); |
| 1222 | 1241 | } |
| 1223 | 1242 | if( count_nonbranch_children(vid)>1 ){ |
| 1224 | 1243 | printf("**** warning: a fork has occurred *****\n"); |
| 1225 | 1244 | } |
| 1226 | 1245 | } |
| 1227 | 1246 | |