Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | branch close: minor doc and style cleanups. Delay output of control artifact in dry-run mode until after Z-card is calculated. Only show new dry-run artifact in --verbose mode. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | branch-close-subcommand |
| Files: | files | file ages | folders |
| SHA3-256: |
25197505b1f0fbef05840023b149169c |
| User & Date: | stephan 2021-07-22 06:25:26.484 |
Context
|
2021-07-22
| ||
| 07:47 | branch close: added --user/date-override options, per forum feedback. ... (check-in: 94764e962c user: stephan tags: branch-close-subcommand) | |
| 06:25 | branch close: minor doc and style cleanups. Delay output of control artifact in dry-run mode until after Z-card is calculated. Only show new dry-run artifact in --verbose mode. ... (check-in: 25197505b1 user: stephan tags: branch-close-subcommand) | |
| 06:16 | branch close: dry-run mode no longer skips the saving steps. ... (check-in: a6a1a3cf0c user: stephan tags: branch-close-subcommand) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
347 348 349 350 351 352 353 | } /* ** Implementation of (branch close) subcommand. nStartAtArg is the ** g.argv index to start reading branch names. If fDryRun is true then ** the change is run in dry-run mode. Fails fatally on error. */ | | > | | | | | < | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
}
/*
** Implementation of (branch close) subcommand. nStartAtArg is the
** g.argv index to start reading branch names. If fDryRun is true then
** the change is run in dry-run mode. Fails fatally on error.
*/
static void branch_cmd_close(int nStartAtArg, int fVerbose,
int fDryRun){
int argPos = nStartAtArg; /* g.argv pos with first branch name */
Blob manifest = empty_blob; /* Control artifact */
Stmt q = empty_Stmt;
int nQueued = 0; /* # of branches queued for closing */
char * zUuid = 0; /* Resolved branch UUID. */
int doRollback = fDryRun!=0; /* Roll back transaction if true */
db_begin_transaction();
db_multi_exec("CREATE TEMP TABLE brclose("
"rid INTEGER UNIQUE ON CONFLICT IGNORE"
")");
db_prepare(&q, "INSERT INTO brclose(rid) VALUES(:rid)");
for( ; argPos < g.argc; fossil_free(zUuid), ++argPos ){
const char * zBranch = g.argv[argPos];
const int rid = name_to_uuid2(zBranch, "ci", &zUuid);
if(0==rid){
fossil_fatal("Cannot resolve branch name: %s", zBranch);
}else if(rid<0){
fossil_fatal("Ambiguous branch name: %s", zBranch);
|
| ︙ | ︙ | |||
389 390 391 392 393 394 395 |
db_finalize(&q);
if(!nQueued){
fossil_warning("No branches queued for closing. Nothing to do.");
doRollback = 1;
goto br_close_end;
}
blob_appendf(&manifest, "D %z\n", date_in_standard_format("now"));
| | < < < > < < | < < < < < > > > > > > > | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
db_finalize(&q);
if(!nQueued){
fossil_warning("No branches queued for closing. Nothing to do.");
doRollback = 1;
goto br_close_end;
}
blob_appendf(&manifest, "D %z\n", date_in_standard_format("now"));
db_prepare(&q, "SELECT uuid FROM blob WHERE rid IN brclose");
while(SQLITE_ROW==db_step(&q)){
const char * zHash = db_column_text(&q, 0);
blob_appendf(&manifest, "T +closed %s\n", zHash);
}
db_finalize(&q);
user_select();
blob_appendf(&manifest, "U %F\n", login_name());
{ /* Z-card and save artifact */
int newRid;
Blob cksum = empty_blob;
md5sum_blob(&manifest, &cksum);
blob_appendf(&manifest, "Z %b\n", &cksum);
blob_reset(&cksum);
if(fDryRun && fVerbose){
fossil_print("Dry-run mode: will roll back new artifact:\n%b",
&manifest);
/* Run through the saving steps, though, noting that doing so
** will clear out &manifest, which is why we output it here
** instead of after saving. */
}
newRid = content_put(&manifest);
if(0==newRid){
fossil_fatal("Problem saving new artifact: %s\n%b",
g.zErrMsg, &manifest);
}else if(manifest_crosslink(newRid, &manifest, 0)==0){
fossil_fatal("Crosslinking error: %s", g.zErrMsg);
}
|
| ︙ | ︙ |