Fossil SCM

prepare for input from svn dumps

baruch 2014-09-15 11:52 trunk
Commit 6def3251d45ebe6f5847068ff8182cf797aa4d30
2 files changed +1 -1 +50 -43
+1 -1
--- src/db.c
+++ src/db.c
@@ -2524,11 +2524,11 @@
25242524
}
25252525
}
25262526
}else{
25272527
isManifest = 0;
25282528
while( ctrlSettings[i].name
2529
- && strncmp(ctrlSettings[i].name, zName, n)==0
2529
+ && strncmp(ctrlSettings[i].name, zName, n)==0
25302530
){
25312531
print_setting(&ctrlSettings[i], db_open_local(0));
25322532
i++;
25332533
}
25342534
}
25352535
--- src/db.c
+++ src/db.c
@@ -2524,11 +2524,11 @@
2524 }
2525 }
2526 }else{
2527 isManifest = 0;
2528 while( ctrlSettings[i].name
2529 && strncmp(ctrlSettings[i].name, zName, n)==0
2530 ){
2531 print_setting(&ctrlSettings[i], db_open_local(0));
2532 i++;
2533 }
2534 }
2535
--- src/db.c
+++ src/db.c
@@ -2524,11 +2524,11 @@
2524 }
2525 }
2526 }else{
2527 isManifest = 0;
2528 while( ctrlSettings[i].name
2529 && strncmp(ctrlSettings[i].name, zName, n)==0
2530 ){
2531 print_setting(&ctrlSettings[i], db_open_local(0));
2532 i++;
2533 }
2534 }
2535
+50 -43
--- src/import.c
+++ src/import.c
@@ -720,19 +720,21 @@
720720
}
721721
722722
/*
723723
** COMMAND: import
724724
**
725
-** Usage: %fossil import --git ?OPTIONS? NEW-REPOSITORY
725
+** Usage: %fossil import FORMAT ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
726726
**
727
-** Read text generated by the git-fast-export command and use it to
727
+** Read interchange format generated by another VCS and use it to
728728
** construct a new Fossil repository named by the NEW-REPOSITORY
729
-** argument. The git-fast-export text is read from standard input.
729
+** argument. If no input file is supplied the interchange format
730
+** data is read from standard input.
731
+**
732
+** The following formats are currently understood by this command
730733
**
731
-** The git-fast-export file format is currently the only VCS interchange
732
-** format that is understood, though other interchange formats may be added
733
-** in the future.
734
+** --git Import from the git-fast-export file format
735
+** --svn Import from the svnadmin-dump file format
734736
**
735737
** The --incremental option allows an existing repository to be extended
736738
** with new content.
737739
**
738740
** Options:
@@ -744,15 +746,16 @@
744746
char *zPassword;
745747
FILE *pIn;
746748
Stmt q;
747749
int forceFlag = find_option("force", "f", 0)!=0;
748750
int incrFlag = find_option("incremental", "i", 0)!=0;
751
+ int gitFlag = find_option("git",0,0)!=0;
752
+ int svnFlag = find_option("svn",0,0)!=0;
749753
750
- find_option("git",0,0); /* Skip the --git option for now */
751754
verify_all_options();
752755
if( g.argc!=3 && g.argc!=4 ){
753
- usage("REPOSITORY-NAME");
756
+ usage("FORMAT REPOSITORY-NAME");
754757
}
755758
if( g.argc==4 ){
756759
pIn = fossil_fopen(g.argv[3], "rb");
757760
}else{
758761
pIn = stdin;
@@ -762,48 +765,52 @@
762765
if( forceFlag ) file_delete(g.argv[2]);
763766
db_create_repository(g.argv[2]);
764767
}
765768
db_open_repository(g.argv[2]);
766769
db_open_config(0);
767
-
768
- /* The following temp-tables are used to hold information needed for
769
- ** the import.
770
- **
771
- ** The XMARK table provides a mapping from fast-import "marks" and symbols
772
- ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
773
- ** Given any valid fast-import symbol, the corresponding fossil rid and
774
- ** uuid can found by searching against the xmark.tname field.
775
- **
776
- ** The XBRANCH table maps commit marks and symbols into the branch those
777
- ** commits belong to. If xbranch.tname is a fast-import symbol for a
778
- ** checkin then xbranch.brnm is the branch that checkin is part of.
779
- **
780
- ** The XTAG table records information about tags that need to be applied
781
- ** to various branches after the import finishes. The xtag.tcontent field
782
- ** contains the text of an artifact that will add a tag to a check-in.
783
- ** The git-fast-export file format might specify the same tag multiple
784
- ** times but only the last tag should be used. And we do not know which
785
- ** occurrence of the tag is the last until the import finishes.
786
- */
787
- db_multi_exec(
788
- "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
789
- "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
790
- "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
791
- );
792
-
793770
794771
db_begin_transaction();
795772
if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
796
- git_fast_import(pIn);
797
- db_prepare(&q, "SELECT tcontent FROM xtag");
798
- while( db_step(&q)==SQLITE_ROW ){
799
- Blob record;
800
- db_ephemeral_blob(&q, 0, &record);
801
- fast_insert_content(&record, 0, 0);
802
- import_reset(0);
803
- }
804
- db_finalize(&q);
773
+
774
+ if( gitFlag ){
775
+ /* The following temp-tables are used to hold information needed for
776
+ ** the import.
777
+ **
778
+ ** The XMARK table provides a mapping from fast-import "marks" and symbols
779
+ ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
780
+ ** Given any valid fast-import symbol, the corresponding fossil rid and
781
+ ** uuid can found by searching against the xmark.tname field.
782
+ **
783
+ ** The XBRANCH table maps commit marks and symbols into the branch those
784
+ ** commits belong to. If xbranch.tname is a fast-import symbol for a
785
+ ** checkin then xbranch.brnm is the branch that checkin is part of.
786
+ **
787
+ ** The XTAG table records information about tags that need to be applied
788
+ ** to various branches after the import finishes. The xtag.tcontent field
789
+ ** contains the text of an artifact that will add a tag to a check-in.
790
+ ** The git-fast-export file format might specify the same tag multiple
791
+ ** times but only the last tag should be used. And we do not know which
792
+ ** occurrence of the tag is the last until the import finishes.
793
+ */
794
+ db_multi_exec(
795
+ "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
796
+ "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
797
+ "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
798
+ );
799
+
800
+ git_fast_import(pIn);
801
+ db_prepare(&q, "SELECT tcontent FROM xtag");
802
+ while( db_step(&q)==SQLITE_ROW ){
803
+ Blob record;
804
+ db_ephemeral_blob(&q, 0, &record);
805
+ fast_insert_content(&record, 0, 0);
806
+ import_reset(0);
807
+ }
808
+ db_finalize(&q);
809
+ }else if( svnFlag ){
810
+ }
811
+
805812
db_end_transaction(0);
806813
db_begin_transaction();
807814
fossil_print("Rebuilding repository meta-data...\n");
808815
rebuild_db(0, 1, !incrFlag);
809816
verify_cancel();
810817
--- src/import.c
+++ src/import.c
@@ -720,19 +720,21 @@
720 }
721
722 /*
723 ** COMMAND: import
724 **
725 ** Usage: %fossil import --git ?OPTIONS? NEW-REPOSITORY
726 **
727 ** Read text generated by the git-fast-export command and use it to
728 ** construct a new Fossil repository named by the NEW-REPOSITORY
729 ** argument. The git-fast-export text is read from standard input.
 
 
 
730 **
731 ** The git-fast-export file format is currently the only VCS interchange
732 ** format that is understood, though other interchange formats may be added
733 ** in the future.
734 **
735 ** The --incremental option allows an existing repository to be extended
736 ** with new content.
737 **
738 ** Options:
@@ -744,15 +746,16 @@
744 char *zPassword;
745 FILE *pIn;
746 Stmt q;
747 int forceFlag = find_option("force", "f", 0)!=0;
748 int incrFlag = find_option("incremental", "i", 0)!=0;
 
 
749
750 find_option("git",0,0); /* Skip the --git option for now */
751 verify_all_options();
752 if( g.argc!=3 && g.argc!=4 ){
753 usage("REPOSITORY-NAME");
754 }
755 if( g.argc==4 ){
756 pIn = fossil_fopen(g.argv[3], "rb");
757 }else{
758 pIn = stdin;
@@ -762,48 +765,52 @@
762 if( forceFlag ) file_delete(g.argv[2]);
763 db_create_repository(g.argv[2]);
764 }
765 db_open_repository(g.argv[2]);
766 db_open_config(0);
767
768 /* The following temp-tables are used to hold information needed for
769 ** the import.
770 **
771 ** The XMARK table provides a mapping from fast-import "marks" and symbols
772 ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
773 ** Given any valid fast-import symbol, the corresponding fossil rid and
774 ** uuid can found by searching against the xmark.tname field.
775 **
776 ** The XBRANCH table maps commit marks and symbols into the branch those
777 ** commits belong to. If xbranch.tname is a fast-import symbol for a
778 ** checkin then xbranch.brnm is the branch that checkin is part of.
779 **
780 ** The XTAG table records information about tags that need to be applied
781 ** to various branches after the import finishes. The xtag.tcontent field
782 ** contains the text of an artifact that will add a tag to a check-in.
783 ** The git-fast-export file format might specify the same tag multiple
784 ** times but only the last tag should be used. And we do not know which
785 ** occurrence of the tag is the last until the import finishes.
786 */
787 db_multi_exec(
788 "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
789 "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
790 "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
791 );
792
793
794 db_begin_transaction();
795 if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
796 git_fast_import(pIn);
797 db_prepare(&q, "SELECT tcontent FROM xtag");
798 while( db_step(&q)==SQLITE_ROW ){
799 Blob record;
800 db_ephemeral_blob(&q, 0, &record);
801 fast_insert_content(&record, 0, 0);
802 import_reset(0);
803 }
804 db_finalize(&q);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805 db_end_transaction(0);
806 db_begin_transaction();
807 fossil_print("Rebuilding repository meta-data...\n");
808 rebuild_db(0, 1, !incrFlag);
809 verify_cancel();
810
--- src/import.c
+++ src/import.c
@@ -720,19 +720,21 @@
720 }
721
722 /*
723 ** COMMAND: import
724 **
725 ** Usage: %fossil import FORMAT ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
726 **
727 ** Read interchange format generated by another VCS and use it to
728 ** construct a new Fossil repository named by the NEW-REPOSITORY
729 ** argument. If no input file is supplied the interchange format
730 ** data is read from standard input.
731 **
732 ** The following formats are currently understood by this command
733 **
734 ** --git Import from the git-fast-export file format
735 ** --svn Import from the svnadmin-dump file format
 
736 **
737 ** The --incremental option allows an existing repository to be extended
738 ** with new content.
739 **
740 ** Options:
@@ -744,15 +746,16 @@
746 char *zPassword;
747 FILE *pIn;
748 Stmt q;
749 int forceFlag = find_option("force", "f", 0)!=0;
750 int incrFlag = find_option("incremental", "i", 0)!=0;
751 int gitFlag = find_option("git",0,0)!=0;
752 int svnFlag = find_option("svn",0,0)!=0;
753
 
754 verify_all_options();
755 if( g.argc!=3 && g.argc!=4 ){
756 usage("FORMAT REPOSITORY-NAME");
757 }
758 if( g.argc==4 ){
759 pIn = fossil_fopen(g.argv[3], "rb");
760 }else{
761 pIn = stdin;
@@ -762,48 +765,52 @@
765 if( forceFlag ) file_delete(g.argv[2]);
766 db_create_repository(g.argv[2]);
767 }
768 db_open_repository(g.argv[2]);
769 db_open_config(0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
771 db_begin_transaction();
772 if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
773
774 if( gitFlag ){
775 /* The following temp-tables are used to hold information needed for
776 ** the import.
777 **
778 ** The XMARK table provides a mapping from fast-import "marks" and symbols
779 ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
780 ** Given any valid fast-import symbol, the corresponding fossil rid and
781 ** uuid can found by searching against the xmark.tname field.
782 **
783 ** The XBRANCH table maps commit marks and symbols into the branch those
784 ** commits belong to. If xbranch.tname is a fast-import symbol for a
785 ** checkin then xbranch.brnm is the branch that checkin is part of.
786 **
787 ** The XTAG table records information about tags that need to be applied
788 ** to various branches after the import finishes. The xtag.tcontent field
789 ** contains the text of an artifact that will add a tag to a check-in.
790 ** The git-fast-export file format might specify the same tag multiple
791 ** times but only the last tag should be used. And we do not know which
792 ** occurrence of the tag is the last until the import finishes.
793 */
794 db_multi_exec(
795 "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
796 "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
797 "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
798 );
799
800 git_fast_import(pIn);
801 db_prepare(&q, "SELECT tcontent FROM xtag");
802 while( db_step(&q)==SQLITE_ROW ){
803 Blob record;
804 db_ephemeral_blob(&q, 0, &record);
805 fast_insert_content(&record, 0, 0);
806 import_reset(0);
807 }
808 db_finalize(&q);
809 }else if( svnFlag ){
810 }
811
812 db_end_transaction(0);
813 db_begin_transaction();
814 fossil_print("Rebuilding repository meta-data...\n");
815 rebuild_db(0, 1, !incrFlag);
816 verify_cancel();
817

Keyboard Shortcuts

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