Fossil SCM
I am convinced by the [forum:/forumpost/4f8e128413|forum discussion] to back out the "fossil changes --scp" change and instead add a separate TCL script that accomplishes what is needed.
Commit
e51531c15d0d5fa534e64cec628bbc90bf3a0276fde7d485524a276eacd264ff
Parent
ba7b4317926cd7d…
1 file changed
+3
-45
+3
-45
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -410,17 +410,10 @@ | ||
| 410 | 410 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 411 | 411 | ** same is true of --classify and --no-classify. |
| 412 | 412 | ** |
| 413 | 413 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 414 | 414 | ** |
| 415 | -** The "fossil changes --scp REMOTE" invokes the "scp" command repeatedly | |
| 416 | -** to move all changed files to a directory on another machine identified | |
| 417 | -** by REMOTE. If REMOTE begins with "dryrun:" then the scp commands that | |
| 418 | -** would have been issued are printed, but no copying is actually done. | |
| 419 | -** The --scp command causes most other options to be ignored, with the | |
| 420 | -** notable exception of --extra. | |
| 421 | -** | |
| 422 | 415 | ** General options: |
| 423 | 416 | ** --abs-paths Display absolute pathnames. |
| 424 | 417 | ** --rel-paths Display pathnames relative to the current working |
| 425 | 418 | ** directory. |
| 426 | 419 | ** --hash Verify file status using hashing rather than |
| @@ -428,15 +421,14 @@ | ||
| 428 | 421 | ** --case-sensitive BOOL Override case-sensitive setting. |
| 429 | 422 | ** --dotfiles Include unmanaged files beginning with a dot. |
| 430 | 423 | ** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns. |
| 431 | 424 | ** |
| 432 | 425 | ** Options specific to the changes command: |
| 433 | -** --classify Start each line with the file's change type. | |
| 434 | 426 | ** --header Identify the repository if report is non-empty. |
| 435 | -** --no-classify Do not print file change types. | |
| 436 | -** --scp REMOTE Used scp to move changed files to REMOTE | |
| 437 | 427 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 428 | +** --classify Start each line with the file's change type. | |
| 429 | +** --no-classify Do not print file change types. | |
| 438 | 430 | ** |
| 439 | 431 | ** Filter options: |
| 440 | 432 | ** --edited Display edited, merged, and conflicted files. |
| 441 | 433 | ** --updated Display files updated by merge/integrate. |
| 442 | 434 | ** --changed Combination of the above two options. |
| @@ -478,11 +470,10 @@ | ||
| 478 | 470 | /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */ |
| 479 | 471 | int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0; |
| 480 | 472 | int showHdr = command==CHANGES && find_option("header", 0, 0); |
| 481 | 473 | int verboseFlag = command==CHANGES && find_option("verbose", "v", 0); |
| 482 | 474 | const char *zIgnoreFlag = find_option("ignore", 0, 1); |
| 483 | - const char *zScpRemote = find_option("scp",0,1); | |
| 484 | 475 | unsigned scanFlags = 0; |
| 485 | 476 | unsigned flags = 0; |
| 486 | 477 | int vid, i; |
| 487 | 478 | |
| 488 | 479 | fossil_pledge("stdio rpath wpath cpath fattr id flock tty chown"); |
| @@ -563,47 +554,14 @@ | ||
| 563 | 554 | show_common_info(vid, "checkout:", 1, 1); |
| 564 | 555 | } |
| 565 | 556 | db_record_repository_filename(0); |
| 566 | 557 | } |
| 567 | 558 | |
| 568 | - /* If the --scp command is present override other options so that | |
| 569 | - ** we get only changes with --no-classify */ | |
| 570 | - if( zScpRemote ){ | |
| 571 | - flags &= ~(C_CLASSIFY|C_MISSING|C_DELETED|C_RENAMED|C_RELPATH| | |
| 572 | - C_MERGE|C_MTIME|C_SIZE|C_COMMENT); | |
| 573 | - } | |
| 574 | - | |
| 575 | 559 | /* Find and print all requested changes. */ |
| 576 | 560 | blob_zero(&report); |
| 577 | 561 | status_report(&report, flags); |
| 578 | - if( zScpRemote ){ | |
| 579 | - Blob line; | |
| 580 | - int n = (int)strlen(zScpRemote); | |
| 581 | - while( n && zScpRemote[n-1]=='/' ){ n--; } | |
| 582 | - while( blob_line(&report, &line) ){ | |
| 583 | - Blob cmd; | |
| 584 | - char *zArg; | |
| 585 | - const char *zFile; | |
| 586 | - blob_trim(&line); | |
| 587 | - zFile = blob_str(&line); | |
| 588 | - blob_init(&cmd, 0, 0); | |
| 589 | - blob_append(&cmd, "scp ", 4); | |
| 590 | - zArg = mprintf("%s%s", g.zLocalRoot, zFile); | |
| 591 | - blob_append_escaped_arg(&cmd, zArg); | |
| 592 | - fossil_free(zArg); | |
| 593 | - blob_append_char(&cmd, ' '); | |
| 594 | - zArg = mprintf("%.*s/%s", n, zScpRemote, zFile); | |
| 595 | - blob_append_escaped_arg(&cmd, zArg); | |
| 596 | - fossil_free(zArg); | |
| 597 | - fossil_print("%s\n", blob_str(&cmd)); | |
| 598 | - if( strncmp(zScpRemote, "dryrun:", 7) ){ | |
| 599 | - /* Run the command if it does NOT begin with "dryrun:" */ | |
| 600 | - fossil_system(blob_str(&cmd)); | |
| 601 | - } | |
| 602 | - blob_reset(&cmd); | |
| 603 | - } | |
| 604 | - }else if( blob_size(&report) ){ | |
| 562 | + if( blob_size(&report) ){ | |
| 605 | 563 | if( showHdr ){ |
| 606 | 564 | fossil_print( |
| 607 | 565 | "Changes for %s at %s:\n", db_get("project-name", "<unnamed>"), |
| 608 | 566 | g.zLocalRoot); |
| 609 | 567 | } |
| 610 | 568 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -410,17 +410,10 @@ | |
| 410 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 411 | ** same is true of --classify and --no-classify. |
| 412 | ** |
| 413 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 414 | ** |
| 415 | ** The "fossil changes --scp REMOTE" invokes the "scp" command repeatedly |
| 416 | ** to move all changed files to a directory on another machine identified |
| 417 | ** by REMOTE. If REMOTE begins with "dryrun:" then the scp commands that |
| 418 | ** would have been issued are printed, but no copying is actually done. |
| 419 | ** The --scp command causes most other options to be ignored, with the |
| 420 | ** notable exception of --extra. |
| 421 | ** |
| 422 | ** General options: |
| 423 | ** --abs-paths Display absolute pathnames. |
| 424 | ** --rel-paths Display pathnames relative to the current working |
| 425 | ** directory. |
| 426 | ** --hash Verify file status using hashing rather than |
| @@ -428,15 +421,14 @@ | |
| 428 | ** --case-sensitive BOOL Override case-sensitive setting. |
| 429 | ** --dotfiles Include unmanaged files beginning with a dot. |
| 430 | ** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns. |
| 431 | ** |
| 432 | ** Options specific to the changes command: |
| 433 | ** --classify Start each line with the file's change type. |
| 434 | ** --header Identify the repository if report is non-empty. |
| 435 | ** --no-classify Do not print file change types. |
| 436 | ** --scp REMOTE Used scp to move changed files to REMOTE |
| 437 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 438 | ** |
| 439 | ** Filter options: |
| 440 | ** --edited Display edited, merged, and conflicted files. |
| 441 | ** --updated Display files updated by merge/integrate. |
| 442 | ** --changed Combination of the above two options. |
| @@ -478,11 +470,10 @@ | |
| 478 | /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */ |
| 479 | int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0; |
| 480 | int showHdr = command==CHANGES && find_option("header", 0, 0); |
| 481 | int verboseFlag = command==CHANGES && find_option("verbose", "v", 0); |
| 482 | const char *zIgnoreFlag = find_option("ignore", 0, 1); |
| 483 | const char *zScpRemote = find_option("scp",0,1); |
| 484 | unsigned scanFlags = 0; |
| 485 | unsigned flags = 0; |
| 486 | int vid, i; |
| 487 | |
| 488 | fossil_pledge("stdio rpath wpath cpath fattr id flock tty chown"); |
| @@ -563,47 +554,14 @@ | |
| 563 | show_common_info(vid, "checkout:", 1, 1); |
| 564 | } |
| 565 | db_record_repository_filename(0); |
| 566 | } |
| 567 | |
| 568 | /* If the --scp command is present override other options so that |
| 569 | ** we get only changes with --no-classify */ |
| 570 | if( zScpRemote ){ |
| 571 | flags &= ~(C_CLASSIFY|C_MISSING|C_DELETED|C_RENAMED|C_RELPATH| |
| 572 | C_MERGE|C_MTIME|C_SIZE|C_COMMENT); |
| 573 | } |
| 574 | |
| 575 | /* Find and print all requested changes. */ |
| 576 | blob_zero(&report); |
| 577 | status_report(&report, flags); |
| 578 | if( zScpRemote ){ |
| 579 | Blob line; |
| 580 | int n = (int)strlen(zScpRemote); |
| 581 | while( n && zScpRemote[n-1]=='/' ){ n--; } |
| 582 | while( blob_line(&report, &line) ){ |
| 583 | Blob cmd; |
| 584 | char *zArg; |
| 585 | const char *zFile; |
| 586 | blob_trim(&line); |
| 587 | zFile = blob_str(&line); |
| 588 | blob_init(&cmd, 0, 0); |
| 589 | blob_append(&cmd, "scp ", 4); |
| 590 | zArg = mprintf("%s%s", g.zLocalRoot, zFile); |
| 591 | blob_append_escaped_arg(&cmd, zArg); |
| 592 | fossil_free(zArg); |
| 593 | blob_append_char(&cmd, ' '); |
| 594 | zArg = mprintf("%.*s/%s", n, zScpRemote, zFile); |
| 595 | blob_append_escaped_arg(&cmd, zArg); |
| 596 | fossil_free(zArg); |
| 597 | fossil_print("%s\n", blob_str(&cmd)); |
| 598 | if( strncmp(zScpRemote, "dryrun:", 7) ){ |
| 599 | /* Run the command if it does NOT begin with "dryrun:" */ |
| 600 | fossil_system(blob_str(&cmd)); |
| 601 | } |
| 602 | blob_reset(&cmd); |
| 603 | } |
| 604 | }else if( blob_size(&report) ){ |
| 605 | if( showHdr ){ |
| 606 | fossil_print( |
| 607 | "Changes for %s at %s:\n", db_get("project-name", "<unnamed>"), |
| 608 | g.zLocalRoot); |
| 609 | } |
| 610 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -410,17 +410,10 @@ | |
| 410 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 411 | ** same is true of --classify and --no-classify. |
| 412 | ** |
| 413 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 414 | ** |
| 415 | ** General options: |
| 416 | ** --abs-paths Display absolute pathnames. |
| 417 | ** --rel-paths Display pathnames relative to the current working |
| 418 | ** directory. |
| 419 | ** --hash Verify file status using hashing rather than |
| @@ -428,15 +421,14 @@ | |
| 421 | ** --case-sensitive BOOL Override case-sensitive setting. |
| 422 | ** --dotfiles Include unmanaged files beginning with a dot. |
| 423 | ** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns. |
| 424 | ** |
| 425 | ** Options specific to the changes command: |
| 426 | ** --header Identify the repository if report is non-empty. |
| 427 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 428 | ** --classify Start each line with the file's change type. |
| 429 | ** --no-classify Do not print file change types. |
| 430 | ** |
| 431 | ** Filter options: |
| 432 | ** --edited Display edited, merged, and conflicted files. |
| 433 | ** --updated Display files updated by merge/integrate. |
| 434 | ** --changed Combination of the above two options. |
| @@ -478,11 +470,10 @@ | |
| 470 | /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */ |
| 471 | int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0; |
| 472 | int showHdr = command==CHANGES && find_option("header", 0, 0); |
| 473 | int verboseFlag = command==CHANGES && find_option("verbose", "v", 0); |
| 474 | const char *zIgnoreFlag = find_option("ignore", 0, 1); |
| 475 | unsigned scanFlags = 0; |
| 476 | unsigned flags = 0; |
| 477 | int vid, i; |
| 478 | |
| 479 | fossil_pledge("stdio rpath wpath cpath fattr id flock tty chown"); |
| @@ -563,47 +554,14 @@ | |
| 554 | show_common_info(vid, "checkout:", 1, 1); |
| 555 | } |
| 556 | db_record_repository_filename(0); |
| 557 | } |
| 558 | |
| 559 | /* Find and print all requested changes. */ |
| 560 | blob_zero(&report); |
| 561 | status_report(&report, flags); |
| 562 | if( blob_size(&report) ){ |
| 563 | if( showHdr ){ |
| 564 | fossil_print( |
| 565 | "Changes for %s at %s:\n", db_get("project-name", "<unnamed>"), |
| 566 | g.zLocalRoot); |
| 567 | } |
| 568 |