Login
Check-in [1f286fb52a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ci-close
Files: files | file ages | folders
SHA1: 1f286fb52af8db0ed1507c085f490ad44dd2c17c
User & Date: stephan 2024-03-28 09:49:08.578
Original Comment: 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.
Context
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
Changes
Unified Diff Ignore Whitespace Patch
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 */

|









|







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
242
243
244
245
246
247
248
249
      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







|







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;
Changes to include/fossil-scm/checkout.h.
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.







>
>
>
>
>
>
>
>
>
>
>







1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
     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.
  */
  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*/               \
}

/**







>







1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
  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.
1185
1186
1187
1188
1189
1190
1191

1192

1193
1194
1195
1196
1197
1198
1199
                         "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);

  if(!rc) rc = fsl__ckout_version_write(f, d->rid, NULL);

  RC;
  assert(d->f == f);
  rc = fsl_checkin_add_unsent(f, d->rid);
  RC;
  rc = fsl__ckout_clear_merge_state(f, true);
  RC;
  /*







>
|
>







1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
                         "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);
  if(!rc && opt->writeCheckoutVersion ){
    rc = fsl__ckout_version_write(f, d->rid, NULL);
  }
  RC;
  assert(d->f == f);
  rc = fsl_checkin_add_unsent(f, d->rid);
  RC;
  rc = fsl__ckout_clear_merge_state(f, true);
  RC;
  /*
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"
|











|







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
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);







|







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);