Fossil SCM

Add an --incremental option to the "import" command.

drh 2011-02-22 21:09 trunk
Commit 59ef7cb40c8e3354de9f98258c952e39db19b0e6
1 file changed +9 -3
+9 -3
--- src/import.c
+++ src/import.c
@@ -674,16 +674,20 @@
674674
** argument. The git-fast-export text is read from standard input.
675675
**
676676
** The git-fast-export file format is currently the only VCS interchange
677677
** format that is understood, though other interchange formats may be added
678678
** in the future.
679
+**
680
+** The --incremental option allows an existing repository to be extended
681
+** with new content.
679682
*/
680683
void git_import_cmd(void){
681684
char *zPassword;
682685
FILE *pIn;
683686
Stmt q;
684687
int forceFlag = find_option("force", "f", 0)!=0;
688
+ int incrFlag = find_option("incremental", "i", 0)!=0;
685689
686690
find_option("git",0,0); /* Skip the --git option for now */
687691
verify_all_options();
688692
if( g.argc!=3 && g.argc!=4 ){
689693
usage("REPOSITORY-NAME");
@@ -692,12 +696,14 @@
692696
pIn = fopen(g.argv[3], "rb");
693697
}else{
694698
pIn = stdin;
695699
fossil_binary_mode(pIn);
696700
}
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
+ }
699705
db_open_repository(g.argv[2]);
700706
db_open_config(0);
701707
702708
/* The following temp-tables are used to hold information needed for
703709
** the import.
@@ -724,11 +730,11 @@
724730
"CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
725731
);
726732
727733
728734
db_begin_transaction();
729
- db_initial_setup(0, 0, 1);
735
+ if( !incrFlag ) db_initial_setup(0, 0, 1);
730736
git_fast_import(pIn);
731737
db_prepare(&q, "SELECT tcontent FROM xtag");
732738
while( db_step(&q)==SQLITE_ROW ){
733739
Blob record;
734740
db_ephemeral_blob(&q, 0, &record);
735741
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button