Fossil SCM
Prefer manifest_file_find() over manifest_file_seek(), for case-insensitivity. Added option to force creating a delta whenever it's possible, rather than just suggest it.
Commit
c3ae6b349637278b990ab76dec827408ddcbebcce0058b750948cb959a0d249e
Parent
c281a179c0da28f…
1 file changed
+48
-24
+48
-24
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2785,23 +2785,30 @@ | ||
| 2785 | 2785 | ** converted, if needed, to use the same EOL style as the previous |
| 2786 | 2786 | ** version of that file. Only the in-memory/in-repo copies are |
| 2787 | 2787 | ** affected, not the original file (if any). |
| 2788 | 2788 | */ |
| 2789 | 2789 | CIMINI_CONVERT_EOL = 1<<5, |
| 2790 | - | |
| 2791 | 2790 | /* |
| 2792 | -** A hint to checkin_mini() to prefer creation of a delta manifest. | |
| 2791 | +** A hint to checkin_mini() to "prefer" creation of a delta manifest. | |
| 2792 | +** It may decide not to for various reasons. | |
| 2793 | 2793 | */ |
| 2794 | 2794 | CIMINI_PREFER_DELTA = 1<<6, |
| 2795 | - | |
| 2795 | +/* | |
| 2796 | +** A "stronger hint" to checkin_mini() to prefer creation of a delta | |
| 2797 | +** manifest if it at all can. It will decide not to only if creation | |
| 2798 | +** of a delta is not a realistic option. For this to work, it must be | |
| 2799 | +** set together with the CIMINI_PREFER_DELTA flag, but the two cannot | |
| 2800 | +** be combined in this enum. | |
| 2801 | +*/ | |
| 2802 | +CIMINI_STRONGLY_PREFER_DELTA = 1<<7, | |
| 2796 | 2803 | /* |
| 2797 | 2804 | ** Tells checkin_mini() to permit the addition of a new file. Normally |
| 2798 | 2805 | ** this is disabled because there are many cases where it could cause |
| 2799 | 2806 | ** the inadvertent addition of a new file when an update to an |
| 2800 | 2807 | ** existing was intended, as a side-effect of name-case differences. |
| 2801 | 2808 | */ |
| 2802 | -CIMINI_ALLOW_NEW_FILE = 1<<7 | |
| 2809 | +CIMINI_ALLOW_NEW_FILE = 1<<8 | |
| 2803 | 2810 | }; |
| 2804 | 2811 | |
| 2805 | 2812 | /* |
| 2806 | 2813 | ** Handles the F-card parts for create_manifest_mini(). |
| 2807 | 2814 | ** |
| @@ -2834,11 +2841,11 @@ | ||
| 2834 | 2841 | if(asDelta){ |
| 2835 | 2842 | /* Parent is a baseline and we have only 1 file to modify, so this |
| 2836 | 2843 | ** is the simplest case... |
| 2837 | 2844 | */ |
| 2838 | 2845 | assert(pCI->pParent->zBaseline==0 && "Delta-from-delta is NYI."); |
| 2839 | - zFile = manifest_file_seek(pCI->pParent, pCI->zFilename,0); | |
| 2846 | + zFile = manifest_file_find(pCI->pParent, pCI->zFilename); | |
| 2840 | 2847 | if(zFile==0){ |
| 2841 | 2848 | /* New file */ |
| 2842 | 2849 | zFilename = pCI->zFilename; |
| 2843 | 2850 | }else{ |
| 2844 | 2851 | /* Replacement file */ |
| @@ -2924,50 +2931,60 @@ | ||
| 2924 | 2931 | */ |
| 2925 | 2932 | static int create_manifest_mini( Blob * pOut, CheckinMiniInfo * pCI, |
| 2926 | 2933 | Blob * pErr){ |
| 2927 | 2934 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2928 | 2935 | int asDelta = 0; |
| 2936 | +#define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 | |
| 2929 | 2937 | |
| 2930 | 2938 | assert(blob_str(&pCI->fileHash)); |
| 2931 | 2939 | assert(pCI->pParent); |
| 2932 | 2940 | assert(pCI->zFilename); |
| 2933 | 2941 | assert(pCI->zUser); |
| 2934 | 2942 | assert(pCI->zDate); |
| 2935 | - | |
| 2936 | -#define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 | |
| 2943 | + | |
| 2937 | 2944 | /* Potential TODOs include... |
| 2938 | - ** - Create a delta manifest, if possible, rather than a baseline. | |
| 2945 | + ** - Create a delta manifest, if possible/feasible, rather than a | |
| 2946 | + ** baseline (done) even if pCI->pParent is a delta (not done). | |
| 2939 | 2947 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2940 | 2948 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2941 | - ** symlinks like a normal commit would. For now we bail out if | |
| 2949 | + ** symlinks like a normal commit would. For now we bail out if | |
| 2942 | 2950 | ** told to handle a symlink because there would seem to be no(?) |
| 2943 | 2951 | ** sensible way to handle a symlink add/checkin without a |
| 2944 | 2952 | ** checkout. |
| 2945 | 2953 | */ |
| 2946 | 2954 | blob_zero(pOut); |
| 2947 | - if((pCI->flags & CIMINI_PREFER_DELTA) | |
| 2948 | - && pCI->pParent->zBaseline==0){ | |
| 2955 | + manifest_file_rewind(pCI->pParent) /* force load of baseline */; | |
| 2956 | + if(((CIMINI_PREFER_DELTA & pCI->flags) | |
| 2957 | + && pCI->pParent->zBaseline==0 /* parent is not a delta */ | |
| 2958 | + /* ^^^ TODO allow creation of a delta from a delta */ | |
| 2959 | + )&&( | |
| 2960 | + CIMINI_STRONGLY_PREFER_DELTA & pCI->flags | |
| 2961 | + || (pCI->pParent->pBaseline | |
| 2962 | + ? pCI->pParent->pBaseline | |
| 2963 | + : pCI->pParent)->nFile > 10 | |
| 2964 | + /* 10 is arbitrary: don't create a delta when there is only a | |
| 2965 | + ** tiny gain for doing so. */)){ | |
| 2949 | 2966 | asDelta = 1; |
| 2950 | 2967 | } |
| 2951 | 2968 | if(asDelta){ |
| 2952 | - blob_appendf(pOut, "B %s\n", pCI->zParentUuid); | |
| 2969 | + blob_appendf(pOut, "B %s\n", | |
| 2970 | + pCI->pParent->zBaseline | |
| 2971 | + ? pCI->pParent->zBaseline | |
| 2972 | + : pCI->zParentUuid); | |
| 2953 | 2973 | } |
| 2954 | 2974 | if(blob_size(&pCI->comment)!=0){ |
| 2955 | 2975 | blob_appendf(pOut, "C %F\n", blob_str(&pCI->comment)); |
| 2956 | 2976 | }else{ |
| 2957 | 2977 | blob_append(pOut, "C (no\\scomment)\n", 16); |
| 2958 | 2978 | } |
| 2959 | 2979 | blob_appendf(pOut, "D %z\n", pCI->zDate); |
| 2960 | - | |
| 2961 | 2980 | if(!create_manifest_mini_fcards(pOut,pCI,asDelta,pErr)){ |
| 2962 | 2981 | return 0; |
| 2963 | 2982 | } |
| 2964 | - | |
| 2965 | 2983 | if(pCI->zMimetype!=0 && pCI->zMimetype[0]!=0){ |
| 2966 | 2984 | blob_appendf(pOut, "N %F\n", pCI->zMimetype); |
| 2967 | 2985 | } |
| 2968 | - | |
| 2969 | 2986 | blob_appendf(pOut, "P %s\n", pCI->zParentUuid); |
| 2970 | 2987 | blob_appendf(pOut, "U %F\n", pCI->zUser); |
| 2971 | 2988 | md5sum_blob(pOut, &zCard); |
| 2972 | 2989 | blob_appendf(pOut, "Z %b\n", &zCard); |
| 2973 | 2990 | blob_reset(&zCard); |
| @@ -3122,11 +3139,11 @@ | ||
| 3122 | 3139 | ** X/Y/z gets committed as X/Y/Z or X/y/z due to a typo or |
| 3123 | 3140 | ** case-sensitivity mismatch between the user/repo/filesystem, or |
| 3124 | 3141 | ** some such. |
| 3125 | 3142 | */ |
| 3126 | 3143 | manifest_file_rewind(pCI->pParent); |
| 3127 | - zFilePrev = manifest_file_seek(pCI->pParent, pCI->zFilename, 0); | |
| 3144 | + zFilePrev = manifest_file_find(pCI->pParent, pCI->zFilename); | |
| 3128 | 3145 | if(!zFilePrev && !(CIMINI_ALLOW_NEW_FILE & pCI->flags)){ |
| 3129 | 3146 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 3130 | 3147 | "Adding new files is currently not permitted.", |
| 3131 | 3148 | pCI->zFilename, pCI->zParentUuid)); |
| 3132 | 3149 | }else if(zFilePrev |
| @@ -3242,31 +3259,34 @@ | ||
| 3242 | 3259 | ** vfile table. |
| 3243 | 3260 | ** |
| 3244 | 3261 | ** Options: |
| 3245 | 3262 | ** |
| 3246 | 3263 | ** --repository|-R REPO The repository file to commit to. |
| 3247 | -** --as FILENAME The repository-side name of the input file, | |
| 3248 | -** relative to the top of the repository. | |
| 3249 | -** Default is the same as the input file name. | |
| 3264 | +** --as FILENAME The repository-side name of the input | |
| 3265 | +** file, relative to the top of the | |
| 3266 | +** repository. Default is the same as the | |
| 3267 | +** input file name. | |
| 3250 | 3268 | ** --comment|-m COMMENT Required checkin comment. |
| 3251 | 3269 | ** --comment-file|-M FILE Reads checkin comment from the given file. |
| 3252 | 3270 | ** --revision|-r VERSION Commit from this version. Default is |
| 3253 | 3271 | ** the checkout version (if available) or |
| 3254 | 3272 | ** trunk (if used without a checkout). |
| 3255 | 3273 | ** --allow-fork Allows the commit to be made against a |
| 3256 | 3274 | ** non-leaf parent. Note that no autosync |
| 3257 | 3275 | ** is performed beforehand. |
| 3258 | -** --allow-merge-conflict Allows checkin of a file even if it appears | |
| 3259 | -** to contain a fossil merge conflict marker. | |
| 3260 | -** --user-override USER USER to use instead of the current default. | |
| 3276 | +** --allow-merge-conflict Allows checkin of a file even if it | |
| 3277 | +** appears to contain a fossil merge conflict | |
| 3278 | +** marker. | |
| 3279 | +** --user-override USER USER to use instead of the current | |
| 3280 | +** default. | |
| 3261 | 3281 | ** --date-override DATETIME DATE to use instead of 'now'. |
| 3262 | 3282 | ** --allow-older Allow a commit to be older than its |
| 3263 | 3283 | ** ancestor. |
| 3264 | 3284 | ** --convert-eol Convert EOL style of the checkin to match |
| 3265 | 3285 | ** the previous version's content. Does not |
| 3266 | -** modify the original file, only the | |
| 3267 | -** checked-in content. | |
| 3286 | +** modify the input file, only the checked-in | |
| 3287 | +** content. | |
| 3268 | 3288 | ** --delta Prefer to generate a delta manifest, if |
| 3269 | 3289 | ** able. |
| 3270 | 3290 | ** --allow-new-file Allow addition of a new file this way. |
| 3271 | 3291 | ** Disabled by default to avoid that case- |
| 3272 | 3292 | ** sensitivity errors inadvertently lead to |
| @@ -3323,10 +3343,14 @@ | ||
| 3323 | 3343 | cinf.flags |= CIMINI_CONVERT_EOL; |
| 3324 | 3344 | } |
| 3325 | 3345 | if(find_option("delta",0,0)!=0){ |
| 3326 | 3346 | cinf.flags |= CIMINI_PREFER_DELTA; |
| 3327 | 3347 | } |
| 3348 | + if(find_option("delta2",0,0)!=0){ | |
| 3349 | + /* Undocumented. For testing only. */ | |
| 3350 | + cinf.flags |= CIMINI_PREFER_DELTA | CIMINI_STRONGLY_PREFER_DELTA; | |
| 3351 | + } | |
| 3328 | 3352 | if(find_option("allow-new-file",0,0)!=0){ |
| 3329 | 3353 | cinf.flags |= CIMINI_ALLOW_NEW_FILE; |
| 3330 | 3354 | } |
| 3331 | 3355 | db_find_and_open_repository(0, 0); |
| 3332 | 3356 | verify_all_options(); |
| 3333 | 3357 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2785,23 +2785,30 @@ | |
| 2785 | ** converted, if needed, to use the same EOL style as the previous |
| 2786 | ** version of that file. Only the in-memory/in-repo copies are |
| 2787 | ** affected, not the original file (if any). |
| 2788 | */ |
| 2789 | CIMINI_CONVERT_EOL = 1<<5, |
| 2790 | |
| 2791 | /* |
| 2792 | ** A hint to checkin_mini() to prefer creation of a delta manifest. |
| 2793 | */ |
| 2794 | CIMINI_PREFER_DELTA = 1<<6, |
| 2795 | |
| 2796 | /* |
| 2797 | ** Tells checkin_mini() to permit the addition of a new file. Normally |
| 2798 | ** this is disabled because there are many cases where it could cause |
| 2799 | ** the inadvertent addition of a new file when an update to an |
| 2800 | ** existing was intended, as a side-effect of name-case differences. |
| 2801 | */ |
| 2802 | CIMINI_ALLOW_NEW_FILE = 1<<7 |
| 2803 | }; |
| 2804 | |
| 2805 | /* |
| 2806 | ** Handles the F-card parts for create_manifest_mini(). |
| 2807 | ** |
| @@ -2834,11 +2841,11 @@ | |
| 2834 | if(asDelta){ |
| 2835 | /* Parent is a baseline and we have only 1 file to modify, so this |
| 2836 | ** is the simplest case... |
| 2837 | */ |
| 2838 | assert(pCI->pParent->zBaseline==0 && "Delta-from-delta is NYI."); |
| 2839 | zFile = manifest_file_seek(pCI->pParent, pCI->zFilename,0); |
| 2840 | if(zFile==0){ |
| 2841 | /* New file */ |
| 2842 | zFilename = pCI->zFilename; |
| 2843 | }else{ |
| 2844 | /* Replacement file */ |
| @@ -2924,50 +2931,60 @@ | |
| 2924 | */ |
| 2925 | static int create_manifest_mini( Blob * pOut, CheckinMiniInfo * pCI, |
| 2926 | Blob * pErr){ |
| 2927 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2928 | int asDelta = 0; |
| 2929 | |
| 2930 | assert(blob_str(&pCI->fileHash)); |
| 2931 | assert(pCI->pParent); |
| 2932 | assert(pCI->zFilename); |
| 2933 | assert(pCI->zUser); |
| 2934 | assert(pCI->zDate); |
| 2935 | |
| 2936 | #define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 |
| 2937 | /* Potential TODOs include... |
| 2938 | ** - Create a delta manifest, if possible, rather than a baseline. |
| 2939 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2940 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2941 | ** symlinks like a normal commit would. For now we bail out if |
| 2942 | ** told to handle a symlink because there would seem to be no(?) |
| 2943 | ** sensible way to handle a symlink add/checkin without a |
| 2944 | ** checkout. |
| 2945 | */ |
| 2946 | blob_zero(pOut); |
| 2947 | if((pCI->flags & CIMINI_PREFER_DELTA) |
| 2948 | && pCI->pParent->zBaseline==0){ |
| 2949 | asDelta = 1; |
| 2950 | } |
| 2951 | if(asDelta){ |
| 2952 | blob_appendf(pOut, "B %s\n", pCI->zParentUuid); |
| 2953 | } |
| 2954 | if(blob_size(&pCI->comment)!=0){ |
| 2955 | blob_appendf(pOut, "C %F\n", blob_str(&pCI->comment)); |
| 2956 | }else{ |
| 2957 | blob_append(pOut, "C (no\\scomment)\n", 16); |
| 2958 | } |
| 2959 | blob_appendf(pOut, "D %z\n", pCI->zDate); |
| 2960 | |
| 2961 | if(!create_manifest_mini_fcards(pOut,pCI,asDelta,pErr)){ |
| 2962 | return 0; |
| 2963 | } |
| 2964 | |
| 2965 | if(pCI->zMimetype!=0 && pCI->zMimetype[0]!=0){ |
| 2966 | blob_appendf(pOut, "N %F\n", pCI->zMimetype); |
| 2967 | } |
| 2968 | |
| 2969 | blob_appendf(pOut, "P %s\n", pCI->zParentUuid); |
| 2970 | blob_appendf(pOut, "U %F\n", pCI->zUser); |
| 2971 | md5sum_blob(pOut, &zCard); |
| 2972 | blob_appendf(pOut, "Z %b\n", &zCard); |
| 2973 | blob_reset(&zCard); |
| @@ -3122,11 +3139,11 @@ | |
| 3122 | ** X/Y/z gets committed as X/Y/Z or X/y/z due to a typo or |
| 3123 | ** case-sensitivity mismatch between the user/repo/filesystem, or |
| 3124 | ** some such. |
| 3125 | */ |
| 3126 | manifest_file_rewind(pCI->pParent); |
| 3127 | zFilePrev = manifest_file_seek(pCI->pParent, pCI->zFilename, 0); |
| 3128 | if(!zFilePrev && !(CIMINI_ALLOW_NEW_FILE & pCI->flags)){ |
| 3129 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 3130 | "Adding new files is currently not permitted.", |
| 3131 | pCI->zFilename, pCI->zParentUuid)); |
| 3132 | }else if(zFilePrev |
| @@ -3242,31 +3259,34 @@ | |
| 3242 | ** vfile table. |
| 3243 | ** |
| 3244 | ** Options: |
| 3245 | ** |
| 3246 | ** --repository|-R REPO The repository file to commit to. |
| 3247 | ** --as FILENAME The repository-side name of the input file, |
| 3248 | ** relative to the top of the repository. |
| 3249 | ** Default is the same as the input file name. |
| 3250 | ** --comment|-m COMMENT Required checkin comment. |
| 3251 | ** --comment-file|-M FILE Reads checkin comment from the given file. |
| 3252 | ** --revision|-r VERSION Commit from this version. Default is |
| 3253 | ** the checkout version (if available) or |
| 3254 | ** trunk (if used without a checkout). |
| 3255 | ** --allow-fork Allows the commit to be made against a |
| 3256 | ** non-leaf parent. Note that no autosync |
| 3257 | ** is performed beforehand. |
| 3258 | ** --allow-merge-conflict Allows checkin of a file even if it appears |
| 3259 | ** to contain a fossil merge conflict marker. |
| 3260 | ** --user-override USER USER to use instead of the current default. |
| 3261 | ** --date-override DATETIME DATE to use instead of 'now'. |
| 3262 | ** --allow-older Allow a commit to be older than its |
| 3263 | ** ancestor. |
| 3264 | ** --convert-eol Convert EOL style of the checkin to match |
| 3265 | ** the previous version's content. Does not |
| 3266 | ** modify the original file, only the |
| 3267 | ** checked-in content. |
| 3268 | ** --delta Prefer to generate a delta manifest, if |
| 3269 | ** able. |
| 3270 | ** --allow-new-file Allow addition of a new file this way. |
| 3271 | ** Disabled by default to avoid that case- |
| 3272 | ** sensitivity errors inadvertently lead to |
| @@ -3323,10 +3343,14 @@ | |
| 3323 | cinf.flags |= CIMINI_CONVERT_EOL; |
| 3324 | } |
| 3325 | if(find_option("delta",0,0)!=0){ |
| 3326 | cinf.flags |= CIMINI_PREFER_DELTA; |
| 3327 | } |
| 3328 | if(find_option("allow-new-file",0,0)!=0){ |
| 3329 | cinf.flags |= CIMINI_ALLOW_NEW_FILE; |
| 3330 | } |
| 3331 | db_find_and_open_repository(0, 0); |
| 3332 | verify_all_options(); |
| 3333 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2785,23 +2785,30 @@ | |
| 2785 | ** converted, if needed, to use the same EOL style as the previous |
| 2786 | ** version of that file. Only the in-memory/in-repo copies are |
| 2787 | ** affected, not the original file (if any). |
| 2788 | */ |
| 2789 | CIMINI_CONVERT_EOL = 1<<5, |
| 2790 | /* |
| 2791 | ** A hint to checkin_mini() to "prefer" creation of a delta manifest. |
| 2792 | ** It may decide not to for various reasons. |
| 2793 | */ |
| 2794 | CIMINI_PREFER_DELTA = 1<<6, |
| 2795 | /* |
| 2796 | ** A "stronger hint" to checkin_mini() to prefer creation of a delta |
| 2797 | ** manifest if it at all can. It will decide not to only if creation |
| 2798 | ** of a delta is not a realistic option. For this to work, it must be |
| 2799 | ** set together with the CIMINI_PREFER_DELTA flag, but the two cannot |
| 2800 | ** be combined in this enum. |
| 2801 | */ |
| 2802 | CIMINI_STRONGLY_PREFER_DELTA = 1<<7, |
| 2803 | /* |
| 2804 | ** Tells checkin_mini() to permit the addition of a new file. Normally |
| 2805 | ** this is disabled because there are many cases where it could cause |
| 2806 | ** the inadvertent addition of a new file when an update to an |
| 2807 | ** existing was intended, as a side-effect of name-case differences. |
| 2808 | */ |
| 2809 | CIMINI_ALLOW_NEW_FILE = 1<<8 |
| 2810 | }; |
| 2811 | |
| 2812 | /* |
| 2813 | ** Handles the F-card parts for create_manifest_mini(). |
| 2814 | ** |
| @@ -2834,11 +2841,11 @@ | |
| 2841 | if(asDelta){ |
| 2842 | /* Parent is a baseline and we have only 1 file to modify, so this |
| 2843 | ** is the simplest case... |
| 2844 | */ |
| 2845 | assert(pCI->pParent->zBaseline==0 && "Delta-from-delta is NYI."); |
| 2846 | zFile = manifest_file_find(pCI->pParent, pCI->zFilename); |
| 2847 | if(zFile==0){ |
| 2848 | /* New file */ |
| 2849 | zFilename = pCI->zFilename; |
| 2850 | }else{ |
| 2851 | /* Replacement file */ |
| @@ -2924,50 +2931,60 @@ | |
| 2931 | */ |
| 2932 | static int create_manifest_mini( Blob * pOut, CheckinMiniInfo * pCI, |
| 2933 | Blob * pErr){ |
| 2934 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2935 | int asDelta = 0; |
| 2936 | #define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 |
| 2937 | |
| 2938 | assert(blob_str(&pCI->fileHash)); |
| 2939 | assert(pCI->pParent); |
| 2940 | assert(pCI->zFilename); |
| 2941 | assert(pCI->zUser); |
| 2942 | assert(pCI->zDate); |
| 2943 | |
| 2944 | /* Potential TODOs include... |
| 2945 | ** - Create a delta manifest, if possible/feasible, rather than a |
| 2946 | ** baseline (done) even if pCI->pParent is a delta (not done). |
| 2947 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2948 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2949 | ** symlinks like a normal commit would. For now we bail out if |
| 2950 | ** told to handle a symlink because there would seem to be no(?) |
| 2951 | ** sensible way to handle a symlink add/checkin without a |
| 2952 | ** checkout. |
| 2953 | */ |
| 2954 | blob_zero(pOut); |
| 2955 | manifest_file_rewind(pCI->pParent) /* force load of baseline */; |
| 2956 | if(((CIMINI_PREFER_DELTA & pCI->flags) |
| 2957 | && pCI->pParent->zBaseline==0 /* parent is not a delta */ |
| 2958 | /* ^^^ TODO allow creation of a delta from a delta */ |
| 2959 | )&&( |
| 2960 | CIMINI_STRONGLY_PREFER_DELTA & pCI->flags |
| 2961 | || (pCI->pParent->pBaseline |
| 2962 | ? pCI->pParent->pBaseline |
| 2963 | : pCI->pParent)->nFile > 10 |
| 2964 | /* 10 is arbitrary: don't create a delta when there is only a |
| 2965 | ** tiny gain for doing so. */)){ |
| 2966 | asDelta = 1; |
| 2967 | } |
| 2968 | if(asDelta){ |
| 2969 | blob_appendf(pOut, "B %s\n", |
| 2970 | pCI->pParent->zBaseline |
| 2971 | ? pCI->pParent->zBaseline |
| 2972 | : pCI->zParentUuid); |
| 2973 | } |
| 2974 | if(blob_size(&pCI->comment)!=0){ |
| 2975 | blob_appendf(pOut, "C %F\n", blob_str(&pCI->comment)); |
| 2976 | }else{ |
| 2977 | blob_append(pOut, "C (no\\scomment)\n", 16); |
| 2978 | } |
| 2979 | blob_appendf(pOut, "D %z\n", pCI->zDate); |
| 2980 | if(!create_manifest_mini_fcards(pOut,pCI,asDelta,pErr)){ |
| 2981 | return 0; |
| 2982 | } |
| 2983 | if(pCI->zMimetype!=0 && pCI->zMimetype[0]!=0){ |
| 2984 | blob_appendf(pOut, "N %F\n", pCI->zMimetype); |
| 2985 | } |
| 2986 | blob_appendf(pOut, "P %s\n", pCI->zParentUuid); |
| 2987 | blob_appendf(pOut, "U %F\n", pCI->zUser); |
| 2988 | md5sum_blob(pOut, &zCard); |
| 2989 | blob_appendf(pOut, "Z %b\n", &zCard); |
| 2990 | blob_reset(&zCard); |
| @@ -3122,11 +3139,11 @@ | |
| 3139 | ** X/Y/z gets committed as X/Y/Z or X/y/z due to a typo or |
| 3140 | ** case-sensitivity mismatch between the user/repo/filesystem, or |
| 3141 | ** some such. |
| 3142 | */ |
| 3143 | manifest_file_rewind(pCI->pParent); |
| 3144 | zFilePrev = manifest_file_find(pCI->pParent, pCI->zFilename); |
| 3145 | if(!zFilePrev && !(CIMINI_ALLOW_NEW_FILE & pCI->flags)){ |
| 3146 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 3147 | "Adding new files is currently not permitted.", |
| 3148 | pCI->zFilename, pCI->zParentUuid)); |
| 3149 | }else if(zFilePrev |
| @@ -3242,31 +3259,34 @@ | |
| 3259 | ** vfile table. |
| 3260 | ** |
| 3261 | ** Options: |
| 3262 | ** |
| 3263 | ** --repository|-R REPO The repository file to commit to. |
| 3264 | ** --as FILENAME The repository-side name of the input |
| 3265 | ** file, relative to the top of the |
| 3266 | ** repository. Default is the same as the |
| 3267 | ** input file name. |
| 3268 | ** --comment|-m COMMENT Required checkin comment. |
| 3269 | ** --comment-file|-M FILE Reads checkin comment from the given file. |
| 3270 | ** --revision|-r VERSION Commit from this version. Default is |
| 3271 | ** the checkout version (if available) or |
| 3272 | ** trunk (if used without a checkout). |
| 3273 | ** --allow-fork Allows the commit to be made against a |
| 3274 | ** non-leaf parent. Note that no autosync |
| 3275 | ** is performed beforehand. |
| 3276 | ** --allow-merge-conflict Allows checkin of a file even if it |
| 3277 | ** appears to contain a fossil merge conflict |
| 3278 | ** marker. |
| 3279 | ** --user-override USER USER to use instead of the current |
| 3280 | ** default. |
| 3281 | ** --date-override DATETIME DATE to use instead of 'now'. |
| 3282 | ** --allow-older Allow a commit to be older than its |
| 3283 | ** ancestor. |
| 3284 | ** --convert-eol Convert EOL style of the checkin to match |
| 3285 | ** the previous version's content. Does not |
| 3286 | ** modify the input file, only the checked-in |
| 3287 | ** content. |
| 3288 | ** --delta Prefer to generate a delta manifest, if |
| 3289 | ** able. |
| 3290 | ** --allow-new-file Allow addition of a new file this way. |
| 3291 | ** Disabled by default to avoid that case- |
| 3292 | ** sensitivity errors inadvertently lead to |
| @@ -3323,10 +3343,14 @@ | |
| 3343 | cinf.flags |= CIMINI_CONVERT_EOL; |
| 3344 | } |
| 3345 | if(find_option("delta",0,0)!=0){ |
| 3346 | cinf.flags |= CIMINI_PREFER_DELTA; |
| 3347 | } |
| 3348 | if(find_option("delta2",0,0)!=0){ |
| 3349 | /* Undocumented. For testing only. */ |
| 3350 | cinf.flags |= CIMINI_PREFER_DELTA | CIMINI_STRONGLY_PREFER_DELTA; |
| 3351 | } |
| 3352 | if(find_option("allow-new-file",0,0)!=0){ |
| 3353 | cinf.flags |= CIMINI_ALLOW_NEW_FILE; |
| 3354 | } |
| 3355 | db_find_and_open_repository(0, 0); |
| 3356 | verify_all_options(); |
| 3357 |