Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added (branch reopen) subcommand, the inverse of (branch close), per forum feedback. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | branch-close-subcommand |
| Files: | files | file ages | folders |
| SHA3-256: |
6f3ab14165a851f4ab5a2e0418dd6809 |
| User & Date: | stephan 2021-07-23 06:12:19.740 |
Context
|
2021-07-25
| ||
| 02:59 | Add new branch subcommands: close, reopen, hide, unhide. ... (check-in: f1fb1239be user: stephan tags: trunk) | |
|
2021-07-23
| ||
| 06:12 | Added (branch reopen) subcommand, the inverse of (branch close), per forum feedback. ... (Closed-Leaf check-in: 6f3ab14165 user: stephan tags: branch-close-subcommand) | |
| 02:44 | branch hide/unhide subcommands now skip over checkins which have resp. don't have the hidden tag. ... (check-in: 768f30ffb7 user: stephan tags: branch-close-subcommand) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
500 501 502 503 504 505 506 |
zName, zUuid);
}
}
branch_cmd_tag_finalize(fDryRun, fVerbose, zDateOvrd, zUserOvrd);
}
/*
| | | > | | > | > | | > > > | | > > | | | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
zName, zUuid);
}
}
branch_cmd_tag_finalize(fDryRun, fVerbose, zDateOvrd, zUserOvrd);
}
/*
** Implementation of (branch close|reopen) subcommands. nStartAtArg is
** the g.argv index to start reading branch/checkin names. The given
** checkins are closed if fClose is true, else their "closed" tag (if
** any) is cancelled. Fails fatally on error.
*/
static void branch_cmd_close(int nStartAtArg, int fClose){
int argPos = nStartAtArg; /* g.argv pos with first branch name */
char * zUuid = 0; /* Resolved branch UUID. */
const int fVerbose = find_option("verbose","v",0)!=0;
const int fDryRun = find_option("dry-run","n",0)!=0;
const char *zDateOvrd = find_option("date-override",0,1);
const char *zUserOvrd = find_option("user-override",0,1);
verify_all_options();
db_begin_transaction();
for( ; argPos < g.argc; fossil_free(zUuid), ++argPos ){
const char * zName = g.argv[argPos];
const int rid = branch_resolve_name(zName, &zUuid);
const int isClosed = leaf_is_closed(rid);
if(!is_a_leaf(rid)){
/* This behaviour is different from /ci_edit closing, where
** is_a_leaf() adds a "+" tag and !is_a_leaf() adds a "*"
** tag. We might want to change this to match for consistency's
** sake, but it currently seems unnecessary to close/re-open a
** non-leaf. */
fossil_warning("Skipping non-leaf [%s] %s", zName, zUuid);
continue;
}else if(fClose && isClosed){
fossil_warning("Skipping closed leaf [%s] %s", zName, zUuid);
continue;
}else if(!fClose && !isClosed){
fossil_warning("Skipping non-closed leaf [%s] %s", zName, zUuid);
continue;
}
branch_cmd_tag_add(rid, fClose ? "+closed" : "-closed");
if(fVerbose!=0){
fossil_print("%s branch [%s] %s\n",
fClose ? "Closing" : "Re-opening",
zName, zUuid);
}
}
branch_cmd_tag_finalize(fDryRun, fVerbose, zDateOvrd, zUserOvrd);
}
/*
** COMMAND: branch
**
** Usage: %fossil branch SUBCOMMAND ... ?OPTIONS?
**
** Run various subcommands to manage branches of the open repository or
** of the repository identified by the -R or --repository option.
**
** > fossil branch close|reopen ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES?
**
** Adds or cancels the "closed" tag to one or more branches.
** It accepts arbitrary unambiguous symbolic names but
** will only resolve checkin names and skips any which resolve
** to non-leaf checkins. Options:
** -n|--dry-run do not commit changes and dump artifact
** to stdout
** -v|--verbose output more information
** --date-override DATE DATE to use instead of 'now'
** --user-override USER USER to use instead of the current default
**
** > fossil branch current
|
| ︙ | ︙ | |||
665 666 667 668 669 670 671 |
db_finalize(&q);
}else if( strncmp(zCmd,"new",n)==0 ){
branch_new();
}else if( strncmp(zCmd,"close",5)==0 ){
if(g.argc<4){
usage("branch close branch-name(s)...");
}
| | > > > > > | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
db_finalize(&q);
}else if( strncmp(zCmd,"new",n)==0 ){
branch_new();
}else if( strncmp(zCmd,"close",5)==0 ){
if(g.argc<4){
usage("branch close branch-name(s)...");
}
branch_cmd_close(3, 1);
}else if( strncmp(zCmd,"reopen",6)==0 ){
if(g.argc<4){
usage("branch reopen branch-name(s)...");
}
branch_cmd_close(3, 0);
}else if( strncmp(zCmd,"hide",4)==0 ){
if(g.argc<4){
usage("branch hide branch-name(s)...");
}
branch_cmd_hide(3,1);
}else if( strncmp(zCmd,"unhide",6)==0 ){
if(g.argc<4){
usage("branch unhide branch-name(s)...");
}
branch_cmd_hide(3,0);
}else{
fossil_fatal("branch subcommand should be one of: "
"close current hide info list ls new reopen unhide");
}
}
/*
** This is the new-style branch-list page that shows the branch names
** together with their ages (time of last check-in) and whether or not
** they are closed or merged to another branch.
|
| ︙ | ︙ |