Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch ci-close Excluding Merge-Ins
This is equivalent to a diff from a9c39d66de to 075379b921
2024-04-10
| ||
22:03 | Port in [fossil:f1f7e27e0cdb8943|upstream f1f7e27e0cdb8943], a routine which ensures that a given filename matches the case it is stored in in the filesystem. Use that in f-add.c, where it's applied even for case-sensitive filesystems (primarily as a test for that routine). check-in: 0e50f798e6 user: stephan tags: trunk | |
2024-03-28
| ||
11:50 | More work on close-at-checkin, but this is turning into a rat's nest of side effects and does not address the partial-checkin case, so shelving this idea for the time being. Unrelated: this checkin is showing src/checkin.c as a full-file diff with both fossil(1) diff and f-vdiff, whereas doing a diff --from prev shows the expected changes only. Shrug. Closed-Leaf check-in: 075379b921 user: stephan tags: ci-close | |
09:49 | Add new fsl_checkin_opt::writeCheckoutVersion (default=true) as a way to suppress automatic rewriting of checkout version to match the new checking version, for use with... Add f-cli --close and --close-with-comment flags which enable checking in and closing at the same time. When doing so, do _not_ update the checkout to the newly branched-and-closed version. Edit: this messes up the checkout state by setting the vfile state to match the new branch instead of the current branch. Need to investigate that further. check-in: 1f286fb52a user: stephan tags: ci-close | |
2024-03-19
| ||
14:18 | Doc typo fixes. check-in: a9c39d66de user: stephan tags: trunk | |
2024-03-15
| ||
13:15 | Pull in [fossil:34276d22e558fbde2705] micro-patch to resolve a potential int overflow in fsl_id_bag_hash(). check-in: 40e3dd6eed user: stephan tags: trunk | |
Changes to f-apps/f-ci.c.
|
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* Copyright 2013-2021 The Libfossil Authors, see LICENSES/BSD-2-Clause.txt SPDX-License-Identifier: BSD-2-Clause-FreeBSD SPDX-FileCopyrightText: 2021 The Libfossil Authors SPDX-ArtifactOfProjectName: Libfossil SPDX-FileType: Code Heavily indebted to the Fossil SCM project (https://fossil-scm.org). ***************************************************************************** This file implements a checkin [test] app using the libfossil API. */ #include "libfossil.h" /* Fossil App mini-framework */ |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | fsl_size_t enqueuedArgCount = 0; fsl_size_t i = 0; bool fNoRCard = false; bool fBaseline = false; bool fDryRun = false; bool fAutoSync = true; bool fAllowFork = false; fsl_id_bag bagCheck = fsl_id_bag_empty /* to verify that we know about any given filename/wildcard */; fcli_pre_setup()/*allocator setup we need for arg processing*/; fcli_cliflag FCliFlags[] = { FCLI_FLAG("m","message","text",&cMsg, "Commit message."), FCLI_FLAG("b","branch","branch-name",&cBranch, "New branch name."), FCLI_FLAG_BOOL("n","dry-run", &fDryRun,"Dry-run mode."), FCLI_FLAG_BOOL("i","integrate",&cOpt.integrate, "Close all merge-parent branches, not just " "integrate-merge branches."), FCLI_FLAG_BOOL(0,"fork", &fAllowFork, "Permit a checkin to a non-leaf version."), FCLI_FLAG_X("t","tag","name[=value]",&App.tagArg, | > > > > > > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | fsl_size_t enqueuedArgCount = 0; fsl_size_t i = 0; bool fNoRCard = false; bool fBaseline = false; bool fDryRun = false; bool fAutoSync = true; bool fAllowFork = false; bool fCloseBranch = false; fsl_id_bag bagCheck = fsl_id_bag_empty /* to verify that we know about any given filename/wildcard */; fcli_pre_setup()/*allocator setup we need for arg processing*/; fcli_cliflag FCliFlags[] = { FCLI_FLAG("m","message","text",&cMsg, "Commit message."), FCLI_FLAG("b","branch","branch-name",&cBranch, "New branch name."), FCLI_FLAG_BOOL(0,"close",&fCloseBranch, "Immediately close the new branch and do not update the " "checkout to its version."), FCLI_FLAG(0,"close-with-comment","comment", &cOpt.closeBranch, "Works like --close but also adds a close-tag comment."), FCLI_FLAG_BOOL("n","dry-run", &fDryRun,"Dry-run mode."), FCLI_FLAG_BOOL("i","integrate",&cOpt.integrate, "Close all merge-parent branches, not just " "integrate-merge branches."), FCLI_FLAG_BOOL(0,"fork", &fAllowFork, "Permit a checkin to a non-leaf version."), FCLI_FLAG_X("t","tag","name[=value]",&App.tagArg, |
︙ | ︙ | |||
235 236 237 238 239 240 241 | goto end; } /* TODO: the "multi-leaf" check, fail if we find one, and add a CLI flag to permit that case to succeed. */ } rc = fsl_cx_transaction_begin(f) | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | goto end; } /* TODO: the "multi-leaf" check, fail if we find one, and add a CLI flag to permit that case to succeed. */ } rc = fsl_cx_transaction_begin(f) /* recall that we can't sync if a transaction is open: the transaction locks the sync out. */; if(rc) goto end; rc = fcli_fingerprint_check(true); if(rc) goto end; fsl_ckout_version_info(f, &ckoutId, NULL) /* re-load ckout id now that we're in a transaction */; if(ckoutId && !fAllowFork && !cBranch |
︙ | ︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 | } cOpt.message = cMsg; cOpt.messageMimeType = cMimeType; cOpt.dumpManifestFile = cDumpMf; cOpt.bgColor = cColor; cOpt.scanForChanges = false /*we'll do this ourselves*/; cOpt.branch = cBranch; fsl_checkin_queue_opt qOpt = fsl_checkin_queue_opt_empty; qOpt.relativeToCwd = true; qOpt.callback = fsl_checkin_queue_f_my; qOpt.callbackState = &enqueuedArgCount; qOpt.scanForChanges = false /* we just did this */; qOpt.vfileIds = &bagCheck; | > > | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | } cOpt.message = cMsg; cOpt.messageMimeType = cMimeType; cOpt.dumpManifestFile = cDumpMf; cOpt.bgColor = cColor; cOpt.scanForChanges = false /*we'll do this ourselves*/; cOpt.branch = cBranch; if( fCloseBranch && !cOpt.closeBranch ) cOpt.closeBranch = ""; cOpt.writeCheckoutVersion = !(fCloseBranch || !!cOpt.closeBranch); fsl_checkin_queue_opt qOpt = fsl_checkin_queue_opt_empty; qOpt.relativeToCwd = true; qOpt.callback = fsl_checkin_queue_f_my; qOpt.callbackState = &enqueuedArgCount; qOpt.scanForChanges = false /* we just did this */; qOpt.vfileIds = &bagCheck; |
︙ | ︙ | |||
348 349 350 351 352 353 354 | if(rc) fsl_card_T_free(tc); } if(rc) goto end; rc = fsl_checkin_commit(f, &cOpt, &newRid, &newUuid); if(rc) goto end; f_out("New version: %s (%"FSL_ID_T_PFMT")\n", newUuid, newRid); | > > > > > > | | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | if(rc) fsl_card_T_free(tc); } if(rc) goto end; rc = fsl_checkin_commit(f, &cOpt, &newRid, &newUuid); if(rc) goto end; f_out("New version: %s (%"FSL_ID_T_PFMT")\n", newUuid, newRid); if( !cOpt.writeCheckoutVersion ){ f_out( "WARNING: because of the --close flag:\n" " - NOT updating checkout to the new version.\n" " - Local changes are retained.\n" ); } if(fcli_is_verbose()>1){ f_out("Post-commit vfile changed contents:\n"); fsl_db_each( fsl_cx_db_ckout(f), fsl_stmt_each_f_dump, NULL, "SELECT vf.vid, vf.id, substr(b.uuid,0,8) hash, chnged, " "deleted, vf.pathname " "FROM vfile vf LEFT JOIN blob b " "ON b.rid=vf.rid " |
︙ | ︙ |
Changes to include/fossil-scm/checkout.h.
︙ | ︙ | |||
745 746 747 748 749 750 751 | the pre-call checkout version, it will, when finished, write the given version in the "checkout" setting of the ckout.vvar table, effectively switching the checkout to that version. It does not do this by default because it is sometimes necessary to have two versions in the vfile table at once and the operation doing so needs to control which version number is the current checkout. */ | | > > > > > > > | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | the pre-call checkout version, it will, when finished, write the given version in the "checkout" setting of the ckout.vvar table, effectively switching the checkout to that version. It does not do this by default because it is sometimes necessary to have two versions in the vfile table at once and the operation doing so needs to control which version number is the current checkout. */ FSL_VFILE_CKSIG_WRITE_CKOUT_VERSION = 0x010, /** Forces a re-load of the vfile table even if the checkout's version matches the provided version. Normally the vfile load is skipped in that case. */ FSL_VFILE_CKSIG_RELOAD = 0x020 }; /** This function populates (if needed) the vfile table of f's checkout db for the given checkin version ID then compares files listed in it against files in the checkout directory, updating vfile's status for the current checkout version id as its goes. If |
︙ | ︙ | |||
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | should be removed from the filesystem. Reminder to self: when we do this, incorporate fsl_rm_empty_dirs(). */ bool rmRemovedFiles; /** Whether to allow (or try to force) a delta manifest or not. 0 means no deltas allowed - it will generate a baseline manifest. Greater than 0 forces generation of a delta if possible (if one can be readily found) even if doing so would not save a notable amount of space. Less than 0 means to decide via some heuristics. | > > > > > > > > > > > > > > > > | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | should be removed from the filesystem. Reminder to self: when we do this, incorporate fsl_rm_empty_dirs(). */ bool rmRemovedFiles; /** Normally after checking in, the local checkout is updated to point to the new checkin version. For cases where this should be suppressed, set writeCheckoutVersion to false. An example is when checking in to a new branch and closing it at the same time, where we would typically want to stay on the originating branch. Added 2024-03-28. Design note: this should arguably be called updateCheckoutVersion, but it's not in order to avoid any confusion about the meaning of "update" in this context (no SCM-level update is performed). Maybe we should call it stampCheckoutVersion? */ bool writeCheckoutVersion; /** Whether to allow (or try to force) a delta manifest or not. 0 means no deltas allowed - it will generate a baseline manifest. Greater than 0 forces generation of a delta if possible (if one can be readily found) even if doing so would not save a notable amount of space. Less than 0 means to decide via some heuristics. |
︙ | ︙ | |||
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | NULL/*bgColor*/, \ false/*isPrivate*/, \ true/*calcRCard*/, \ false/*integrate*/, \ false/*allowMergeConflict*/,\ true/*scanForChanges*/,\ false/*rmRemovedFiles*/,\ 0/*deltaPolicy*/, \ 0.0/*julianTime*/, \ NULL/*closeBranch*/, \ NULL/*dumpManifestFile*/ \ } /** | > | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | NULL/*bgColor*/, \ false/*isPrivate*/, \ true/*calcRCard*/, \ false/*integrate*/, \ false/*allowMergeConflict*/,\ true/*scanForChanges*/,\ false/*rmRemovedFiles*/,\ true/*writeCheckoutVersion*/,\ 0/*deltaPolicy*/, \ 0.0/*julianTime*/, \ NULL/*closeBranch*/, \ NULL/*dumpManifestFile*/ \ } /** |
︙ | ︙ |
Changes to src/checkin.c.
︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 1180 1181 | } if(opt->calcRCard) f->flags |= FSL_CX_F_CALC_R_CARD; else f->flags &= ~FSL_CX_F_CALC_R_CARD; rc = fsl_deck_save( d, opt->isPrivate ); RC; assert(d->rid>0); /* Now get vfile back into shape. We do not do a vfile scan because that loses state like add/rm-queued files. */ | > > | | | | | | | | | | > | | > | > > > | | > > > | | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 | } if(opt->calcRCard) f->flags |= FSL_CX_F_CALC_R_CARD; else f->flags &= ~FSL_CX_F_CALC_R_CARD; rc = fsl_deck_save( d, opt->isPrivate ); RC; assert(d->rid>0); assert(d->f == f); /* Now get vfile back into shape. We do not do a vfile scan because that loses state like add/rm-queued files. */ if(opt->writeCheckoutVersion){ rc = fsl_db_exec_multi(dbC, "DELETE FROM vfile WHERE vid<>" "%" FSL_ID_T_PFMT ";" "UPDATE vfile SET vid=%" FSL_ID_T_PFMT ";" "DELETE FROM vfile WHERE deleted AND " "fsl_is_enqueued(id); " "UPDATE vfile SET rid=mrid, mhash=NULL, " "chnged=0, deleted=0, origname=NULL " "WHERE fsl_is_enqueued(id)", vid, d->rid); RC; rc = fsl__ckout_version_write(f, d->rid, NULL); RC; rc = fsl__ckout_clear_merge_state(f, true); }else{ /* Ensure that the checkout state is still such that the changes just checked in are _still_ listed as changes in the current status.*/ rc = fsl_vfile_unload_except(f, vid); RC; rc = fsl_vfile_changes_scan(f, vid, FSL_VFILE_CKSIG_RELOAD); } RC; rc = fsl_checkin_add_unsent(f, d->rid); RC; /* todo(?) from fossil(1) follows. Most of this seems to be what the vfile handling does (above). db_multi_exec("PRAGMA %s.application_id=252006673;", db_name("repository")); db_multi_exec("PRAGMA %s.application_id=252006674;", db_name("localdb")); |
︙ | ︙ |
Changes to src/checkout.c.
|
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* Copyright 2013-2021 The Libfossil Authors, see LICENSES/BSD-2-Clause.txt SPDX-License-Identifier: BSD-2-Clause-FreeBSD SPDX-FileCopyrightText: 2021 The Libfossil Authors SPDX-ArtifactOfProjectName: Libfossil SPDX-FileType: Code Heavily indebted to the Fossil SCM project (https://fossil-scm.org). */ /* ***************************************************************************** This file houses the code for checkout-level APIS. */ #include <assert.h> #include "fossil-scm/internal.h" #include "fossil-scm/core.h" |
︙ | ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | rc = fsl_repo_ckout_rm_list_fini(f, &rec); if(!rc){ rc = fsl_vfile_unload_except(f, tid); } if(!rc){ rc = fsl__ckout_version_write(f, tid, 0); } | | | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 | rc = fsl_repo_ckout_rm_list_fini(f, &rec); if(!rc){ rc = fsl_vfile_unload_except(f, tid); } if(!rc){ rc = fsl__ckout_version_write(f, tid, 0); } end: /* clang bug? If we declare rc2 here, it says "expression expected". Moving the decl to the top resolves it. Wha? */ if(rec.tgtDir) fsl__cx_scratchpad_yield(f, rec.tgtDir); if(bFullPath) fsl__cx_scratchpad_yield(f, bFullPath); if(bFullNewPath) fsl__cx_scratchpad_yield(f, bFullNewPath); if(bFileUuid) fsl__cx_scratchpad_yield(f, bFileUuid); |
︙ | ︙ |
Changes to src/vfile.c.
︙ | ︙ | |||
119 120 121 122 123 124 125 | rc = fsl_stmt_bind_text_name(&qIns, ":name", fc->name, -1, 0); if(rc) break; rc = fsl_stmt_step(&qIns); if(FSL_RC_STEP_DONE!=rc) break; else rc = 0; fsl_stmt_reset(&qIns); } | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | rc = fsl_stmt_bind_text_name(&qIns, ":name", fc->name, -1, 0); if(rc) break; rc = fsl_stmt_step(&qIns); if(FSL_RC_STEP_DONE!=rc) break; else rc = 0; fsl_stmt_reset(&qIns); } end: fsl_stmt_finalize(&qIns); fsl_stmt_finalize(&qRid); /* Update f->ckout state and some db bits we need when changing the checkout. */ if(!rc && vid>0){ if(!alreadyHad){ |
︙ | ︙ | |||
216 217 218 219 220 221 222 | assert(rootLen); rc = fsl_cx_transaction_begin(f); if(rc){ fsl__cx_scratchpad_yield(f, fileCksum); return rc; } | > > > > > > | > | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | assert(rootLen); rc = fsl_cx_transaction_begin(f); if(rc){ fsl__cx_scratchpad_yield(f, fileCksum); return rc; } if( FSL_VFILE_CKSIG_RELOAD & cksigFlags ){ /* Because fsl_vfile_load() will skip scanning if vfile contains vid, and has no flag to force it to do so, we need to force it by removing that vfile set... */ rc = fsl_vfile_unload(f, vid); } if( !rc && (f->ckout.rid != vid || (FSL_VFILE_CKSIG_RELOAD & cksigFlags)) ){ rc = fsl_vfile_load(f, vid, (FSL_VFILE_CKSIG_KEEP_OTHERS & cksigFlags) ? false : true, NULL); } if(rc) goto end; #if 0 |
︙ | ︙ |