Fossil SCM
Add an --incremental option to the "import" command.
Commit
59ef7cb40c8e3354de9f98258c952e39db19b0e6
Parent
6f1cc96ff0da613…
1 file changed
+9
-3
+9
-3
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -674,16 +674,20 @@ | ||
| 674 | 674 | ** argument. The git-fast-export text is read from standard input. |
| 675 | 675 | ** |
| 676 | 676 | ** The git-fast-export file format is currently the only VCS interchange |
| 677 | 677 | ** format that is understood, though other interchange formats may be added |
| 678 | 678 | ** in the future. |
| 679 | +** | |
| 680 | +** The --incremental option allows an existing repository to be extended | |
| 681 | +** with new content. | |
| 679 | 682 | */ |
| 680 | 683 | void git_import_cmd(void){ |
| 681 | 684 | char *zPassword; |
| 682 | 685 | FILE *pIn; |
| 683 | 686 | Stmt q; |
| 684 | 687 | int forceFlag = find_option("force", "f", 0)!=0; |
| 688 | + int incrFlag = find_option("incremental", "i", 0)!=0; | |
| 685 | 689 | |
| 686 | 690 | find_option("git",0,0); /* Skip the --git option for now */ |
| 687 | 691 | verify_all_options(); |
| 688 | 692 | if( g.argc!=3 && g.argc!=4 ){ |
| 689 | 693 | usage("REPOSITORY-NAME"); |
| @@ -692,12 +696,14 @@ | ||
| 692 | 696 | pIn = fopen(g.argv[3], "rb"); |
| 693 | 697 | }else{ |
| 694 | 698 | pIn = stdin; |
| 695 | 699 | fossil_binary_mode(pIn); |
| 696 | 700 | } |
| 697 | - if( forceFlag ) unlink(g.argv[2]); | |
| 698 | - db_create_repository(g.argv[2]); | |
| 701 | + if( !incrFlag ){ | |
| 702 | + if( forceFlag ) unlink(g.argv[2]); | |
| 703 | + db_create_repository(g.argv[2]); | |
| 704 | + } | |
| 699 | 705 | db_open_repository(g.argv[2]); |
| 700 | 706 | db_open_config(0); |
| 701 | 707 | |
| 702 | 708 | /* The following temp-tables are used to hold information needed for |
| 703 | 709 | ** the import. |
| @@ -724,11 +730,11 @@ | ||
| 724 | 730 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);" |
| 725 | 731 | ); |
| 726 | 732 | |
| 727 | 733 | |
| 728 | 734 | db_begin_transaction(); |
| 729 | - db_initial_setup(0, 0, 1); | |
| 735 | + if( !incrFlag ) db_initial_setup(0, 0, 1); | |
| 730 | 736 | git_fast_import(pIn); |
| 731 | 737 | db_prepare(&q, "SELECT tcontent FROM xtag"); |
| 732 | 738 | while( db_step(&q)==SQLITE_ROW ){ |
| 733 | 739 | Blob record; |
| 734 | 740 | db_ephemeral_blob(&q, 0, &record); |
| 735 | 741 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -674,16 +674,20 @@ | |
| 674 | ** argument. The git-fast-export text is read from standard input. |
| 675 | ** |
| 676 | ** The git-fast-export file format is currently the only VCS interchange |
| 677 | ** format that is understood, though other interchange formats may be added |
| 678 | ** in the future. |
| 679 | */ |
| 680 | void git_import_cmd(void){ |
| 681 | char *zPassword; |
| 682 | FILE *pIn; |
| 683 | Stmt q; |
| 684 | int forceFlag = find_option("force", "f", 0)!=0; |
| 685 | |
| 686 | find_option("git",0,0); /* Skip the --git option for now */ |
| 687 | verify_all_options(); |
| 688 | if( g.argc!=3 && g.argc!=4 ){ |
| 689 | usage("REPOSITORY-NAME"); |
| @@ -692,12 +696,14 @@ | |
| 692 | pIn = fopen(g.argv[3], "rb"); |
| 693 | }else{ |
| 694 | pIn = stdin; |
| 695 | fossil_binary_mode(pIn); |
| 696 | } |
| 697 | if( forceFlag ) unlink(g.argv[2]); |
| 698 | db_create_repository(g.argv[2]); |
| 699 | db_open_repository(g.argv[2]); |
| 700 | db_open_config(0); |
| 701 | |
| 702 | /* The following temp-tables are used to hold information needed for |
| 703 | ** the import. |
| @@ -724,11 +730,11 @@ | |
| 724 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);" |
| 725 | ); |
| 726 | |
| 727 | |
| 728 | db_begin_transaction(); |
| 729 | db_initial_setup(0, 0, 1); |
| 730 | git_fast_import(pIn); |
| 731 | db_prepare(&q, "SELECT tcontent FROM xtag"); |
| 732 | while( db_step(&q)==SQLITE_ROW ){ |
| 733 | Blob record; |
| 734 | db_ephemeral_blob(&q, 0, &record); |
| 735 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -674,16 +674,20 @@ | |
| 674 | ** argument. The git-fast-export text is read from standard input. |
| 675 | ** |
| 676 | ** The git-fast-export file format is currently the only VCS interchange |
| 677 | ** format that is understood, though other interchange formats may be added |
| 678 | ** in the future. |
| 679 | ** |
| 680 | ** The --incremental option allows an existing repository to be extended |
| 681 | ** with new content. |
| 682 | */ |
| 683 | void git_import_cmd(void){ |
| 684 | char *zPassword; |
| 685 | FILE *pIn; |
| 686 | Stmt q; |
| 687 | int forceFlag = find_option("force", "f", 0)!=0; |
| 688 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 689 | |
| 690 | find_option("git",0,0); /* Skip the --git option for now */ |
| 691 | verify_all_options(); |
| 692 | if( g.argc!=3 && g.argc!=4 ){ |
| 693 | usage("REPOSITORY-NAME"); |
| @@ -692,12 +696,14 @@ | |
| 696 | pIn = fopen(g.argv[3], "rb"); |
| 697 | }else{ |
| 698 | pIn = stdin; |
| 699 | fossil_binary_mode(pIn); |
| 700 | } |
| 701 | if( !incrFlag ){ |
| 702 | if( forceFlag ) unlink(g.argv[2]); |
| 703 | db_create_repository(g.argv[2]); |
| 704 | } |
| 705 | db_open_repository(g.argv[2]); |
| 706 | db_open_config(0); |
| 707 | |
| 708 | /* The following temp-tables are used to hold information needed for |
| 709 | ** the import. |
| @@ -724,11 +730,11 @@ | |
| 730 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);" |
| 731 | ); |
| 732 | |
| 733 | |
| 734 | db_begin_transaction(); |
| 735 | if( !incrFlag ) db_initial_setup(0, 0, 1); |
| 736 | git_fast_import(pIn); |
| 737 | db_prepare(&q, "SELECT tcontent FROM xtag"); |
| 738 | while( db_step(&q)==SQLITE_ROW ){ |
| 739 | Blob record; |
| 740 | db_ephemeral_blob(&q, 0, &record); |
| 741 |