Fossil SCM
Add the --no-rebuild and --no-vacuum options to the "fossil import" command.
Commit
219f967cd7ac7c438944706e9c8fc8cd1c7c4a86
Parent
ebe25922f5a6031…
1 file changed
+18
-8
+18
-8
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1511,23 +1511,26 @@ | ||
| 1511 | 1511 | ** |
| 1512 | 1512 | ** Common Options: |
| 1513 | 1513 | ** -i|--incremental allow importing into an existing repository |
| 1514 | 1514 | ** -f|--force overwrite repository if already exist |
| 1515 | 1515 | ** -q|--quiet omit progress output |
| 1516 | +** --no-rebuild skip the "rebuilding metadata" step | |
| 1517 | +** --no-vacuum skip the final VACUUM of the database file | |
| 1516 | 1518 | ** |
| 1517 | 1519 | ** The --incremental option allows an existing repository to be extended |
| 1518 | 1520 | ** with new content. |
| 1519 | -** | |
| 1520 | 1521 | ** |
| 1521 | 1522 | ** See also: export |
| 1522 | 1523 | */ |
| 1523 | 1524 | void import_cmd(void){ |
| 1524 | 1525 | char *zPassword; |
| 1525 | 1526 | FILE *pIn; |
| 1526 | 1527 | Stmt q; |
| 1527 | 1528 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1528 | 1529 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1530 | + int omitRebuild = find_option("no-rebuild",0,0)!=0; | |
| 1531 | + int omitVacuum = find_option("no-vacuum",0,0)!=0; | |
| 1529 | 1532 | |
| 1530 | 1533 | /* Options common to all input formats */ |
| 1531 | 1534 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1532 | 1535 | |
| 1533 | 1536 | /* Options for --svn only */ |
| @@ -1661,20 +1664,27 @@ | ||
| 1661 | 1664 | manifest_crosslink_end(MC_NONE); |
| 1662 | 1665 | } |
| 1663 | 1666 | |
| 1664 | 1667 | verify_cancel(); |
| 1665 | 1668 | db_end_transaction(0); |
| 1666 | - db_begin_transaction(); | |
| 1667 | - fossil_print("Rebuilding repository meta-data...\n"); | |
| 1668 | - rebuild_db(0, 1, !incrFlag); | |
| 1669 | - verify_cancel(); | |
| 1670 | - db_end_transaction(0); | |
| 1671 | - fossil_print("Vacuuming..."); fflush(stdout); | |
| 1672 | - db_multi_exec("VACUUM"); | |
| 1669 | + fossil_print(" \r"); | |
| 1670 | + if( omitRebuild ){ | |
| 1671 | + omitVacuum = 1; | |
| 1672 | + }else{ | |
| 1673 | + db_begin_transaction(); | |
| 1674 | + fossil_print("Rebuilding repository meta-data...\n"); | |
| 1675 | + rebuild_db(0, 1, !incrFlag); | |
| 1676 | + verify_cancel(); | |
| 1677 | + db_end_transaction(0); | |
| 1678 | + } | |
| 1679 | + if( !omitVacuum ){ | |
| 1680 | + fossil_print("Vacuuming..."); fflush(stdout); | |
| 1681 | + db_multi_exec("VACUUM"); | |
| 1682 | + } | |
| 1673 | 1683 | fossil_print(" ok\n"); |
| 1674 | 1684 | if( !incrFlag ){ |
| 1675 | 1685 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1676 | 1686 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1677 | 1687 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1678 | 1688 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 1679 | 1689 | } |
| 1680 | 1690 | } |
| 1681 | 1691 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1511,23 +1511,26 @@ | |
| 1511 | ** |
| 1512 | ** Common Options: |
| 1513 | ** -i|--incremental allow importing into an existing repository |
| 1514 | ** -f|--force overwrite repository if already exist |
| 1515 | ** -q|--quiet omit progress output |
| 1516 | ** |
| 1517 | ** The --incremental option allows an existing repository to be extended |
| 1518 | ** with new content. |
| 1519 | ** |
| 1520 | ** |
| 1521 | ** See also: export |
| 1522 | */ |
| 1523 | void import_cmd(void){ |
| 1524 | char *zPassword; |
| 1525 | FILE *pIn; |
| 1526 | Stmt q; |
| 1527 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1528 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1529 | |
| 1530 | /* Options common to all input formats */ |
| 1531 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1532 | |
| 1533 | /* Options for --svn only */ |
| @@ -1661,20 +1664,27 @@ | |
| 1661 | manifest_crosslink_end(MC_NONE); |
| 1662 | } |
| 1663 | |
| 1664 | verify_cancel(); |
| 1665 | db_end_transaction(0); |
| 1666 | db_begin_transaction(); |
| 1667 | fossil_print("Rebuilding repository meta-data...\n"); |
| 1668 | rebuild_db(0, 1, !incrFlag); |
| 1669 | verify_cancel(); |
| 1670 | db_end_transaction(0); |
| 1671 | fossil_print("Vacuuming..."); fflush(stdout); |
| 1672 | db_multi_exec("VACUUM"); |
| 1673 | fossil_print(" ok\n"); |
| 1674 | if( !incrFlag ){ |
| 1675 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1676 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1677 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1678 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 1679 | } |
| 1680 | } |
| 1681 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1511,23 +1511,26 @@ | |
| 1511 | ** |
| 1512 | ** Common Options: |
| 1513 | ** -i|--incremental allow importing into an existing repository |
| 1514 | ** -f|--force overwrite repository if already exist |
| 1515 | ** -q|--quiet omit progress output |
| 1516 | ** --no-rebuild skip the "rebuilding metadata" step |
| 1517 | ** --no-vacuum skip the final VACUUM of the database file |
| 1518 | ** |
| 1519 | ** The --incremental option allows an existing repository to be extended |
| 1520 | ** with new content. |
| 1521 | ** |
| 1522 | ** See also: export |
| 1523 | */ |
| 1524 | void import_cmd(void){ |
| 1525 | char *zPassword; |
| 1526 | FILE *pIn; |
| 1527 | Stmt q; |
| 1528 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1529 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1530 | int omitRebuild = find_option("no-rebuild",0,0)!=0; |
| 1531 | int omitVacuum = find_option("no-vacuum",0,0)!=0; |
| 1532 | |
| 1533 | /* Options common to all input formats */ |
| 1534 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1535 | |
| 1536 | /* Options for --svn only */ |
| @@ -1661,20 +1664,27 @@ | |
| 1664 | manifest_crosslink_end(MC_NONE); |
| 1665 | } |
| 1666 | |
| 1667 | verify_cancel(); |
| 1668 | db_end_transaction(0); |
| 1669 | fossil_print(" \r"); |
| 1670 | if( omitRebuild ){ |
| 1671 | omitVacuum = 1; |
| 1672 | }else{ |
| 1673 | db_begin_transaction(); |
| 1674 | fossil_print("Rebuilding repository meta-data...\n"); |
| 1675 | rebuild_db(0, 1, !incrFlag); |
| 1676 | verify_cancel(); |
| 1677 | db_end_transaction(0); |
| 1678 | } |
| 1679 | if( !omitVacuum ){ |
| 1680 | fossil_print("Vacuuming..."); fflush(stdout); |
| 1681 | db_multi_exec("VACUUM"); |
| 1682 | } |
| 1683 | fossil_print(" ok\n"); |
| 1684 | if( !incrFlag ){ |
| 1685 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1686 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1687 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1688 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 1689 | } |
| 1690 | } |
| 1691 |