Fossil SCM

Restructure import.c, making it easier to compare with the new svn-import code. No change in functionality.

jan.nijtmans 2015-02-06 10:00 trunk
Commit 62a99875598b8c3f99893bc91999a6b51ed45389
234 files changed +47 -40
~ .dockerignore ~ .project ~ .settings/org.eclipse.core.resources.prefs ~ .settings/org.eclipse.core.runtime.prefs ~ BUILD.txt ~ COPYRIGHT-BSD2.txt ~ Dockerfile ~ Makefile.classic ~ Makefile.in ~ VERSION ~ ajax/README ~ ajax/index.html ~ ajax/wiki-editor.html ~ art/CollRev1.dia ~ art/CollRev2.dia ~ art/CollRev3.dia ~ art/CollRev4.dia ~ art/branching.odp ~ art/concept1.dia ~ art/concept2.dia ~ art/delta1.dia ~ art/delta2.dia ~ art/delta3.dia ~ art/delta4.dia ~ art/delta5.dia ~ art/delta6.dia ~ art/encode1.tex ~ art/encode10.dia ~ art/encode2.tex ~ art/encode3.tex ~ art/encode4.tex ~ art/encode5.tex ~ art/encode6.tex ~ art/encode7.tex ~ art/encode8.tex ~ art/encode9.tex ~ auto.def ~ autosetup/LICENSE ~ autosetup/README.autosetup ~ autosetup/cc-db.tcl ~ autosetup/cc-lib.tcl ~ autosetup/cc-shared.tcl ~ autosetup/cc.tcl ~ autosetup/default.auto ~ autosetup/jimsh0.c ~ autosetup/local.tcl ~ autosetup/system.tcl ~ autosetup/test-tclsh ~ debian/makedeb.sh ~ setup/fossil.iss ~ setup/fossil.nsi ~ skins/README.md ~ src/Makefile ~ src/builtin.c ~ src/bundle.c ~ src/cache.c ~ src/codecheck1.c ~ src/comformat.c ~ src/config.h ~ src/cson_amalgamation.h ~ src/cygsup.h ~ src/diff.tcl ~ src/foci.c ~ src/fusefs.c ~ src/import.c ~ src/json_detail.h ~ src/loadctrl.c ~ src/lookslike.c ~ src/main.mk ~ src/makeheaders.html ~ src/makemake.tcl ~ src/markdown.md ~ src/miniz.c ~ src/mkbuiltin.c ~ src/publish.c ~ src/purge.c ~ src/schema.c ~ src/shell.c ~ src/sitemap.c ~ src/sqlite3.h ~ src/statrep.c ~ src/th.h ~ src/unicode.c ~ src/winfile.c ~ src/wysiwyg.c ~ test/Greek-Lipsum-1.txt ~ test/Greek-Lipsum-2.txt ~ test/cmdline.test ~ test/comment.test ~ test/delta1.test ~ test/diff-test-1.wiki ~ test/file1.test ~ test/glob.test ~ test/graph-test-1.wiki ~ test/many-www.tcl ~ test/markdown-test1.md ~ test/merge1.test ~ test/merge2.test ~ test/merge3.test ~ test/merge4.test ~ test/merge5.test ~ test/merge5_repo.sql ~ test/merge6.test ~ test/merge_renames.test ~ test/release-checklist.wiki ~ test/revert.test ~ test/test-page++.wiki ~ test/tester.tcl ~ test/th1-hooks-input.txt ~ test/th1-hooks.test ~ test/th1-tcl1.txt ~ test/th1-tcl2.txt ~ test/th1-tcl3.txt ~ test/th1-tcl4.txt ~ test/th1-tcl5.txt ~ test/th1-tcl6.txt ~ test/th1-tcl7.txt ~ test/th1-tcl8.txt ~ test/th1-tcl9.txt ~ test/th1.test ~ test/update-test-1.sh ~ test/update-test-2.sh ~ test/utf.test ~ test/utf16be.txt ~ test/utf16le.txt ~ test/valgrind-www.tcl ~ tools/encode_math.sh ~ tools/fossil-autocomplete.bash ~ tools/fossil_chat.tcl ~ win/Makefile.PellesCGMake ~ win/Makefile.dmc ~ win/Makefile.mingw ~ win/Makefile.mingw.mistachkin ~ win/Makefile.msc ~ win/buildmsvc.bat ~ win/fossil.exe.manifest ~ win/fossil.ico ~ win/fossil.rc ~ www/CollRev1.gif ~ www/CollRev2.gif ~ www/CollRev3.gif ~ www/CollRev4.gif ~ www/adding_code.wiki ~ www/antibot.wiki ~ www/apple-touch-icon.png ~ www/background.jpg ~ www/branch01.gif ~ www/branch02.gif ~ www/branch03.gif ~ www/branch04.gif ~ www/branch05.gif ~ www/branching.wiki ~ www/bugtheory.wiki ~ www/build.wiki ~ www/changes.wiki ~ www/checkin.wiki ~ www/checkin_names.wiki ~ www/cmd_.wiki-template ~ www/concept1.gif ~ www/concept2.gif ~ www/concepts.wiki ~ www/contribute.wiki ~ www/copyright-release.html ~ www/copyright-release.pdf ~ www/custom_ticket.wiki ~ www/delta1.gif ~ www/delta2.gif ~ www/delta3.gif ~ www/delta4.gif ~ www/delta5.gif ~ www/delta6.gif ~ www/delta_encoder_algorithm.wiki ~ www/delta_format.wiki ~ www/embeddeddoc.wiki ~ www/encode1.gif ~ www/encode10.gif ~ www/encode2.gif ~ www/encode3.gif ~ www/encode4.gif ~ www/encode5.gif ~ www/encode6.gif ~ www/encode7.gif ~ www/encode8.gif ~ www/encode9.gif ~ www/event.wiki ~ www/faq.tcl ~ www/faq.wiki ~ www/fileformat.wiki ~ www/fiveminutes.wiki ~ www/foss-cklist.wiki ~ www/fossil-from-msvc.wiki ~ www/fossil-v-git.wiki ~ www/fossil.eps ~ www/fossil.gif ~ www/fossil2.eps ~ www/fossil2.gif ~ www/fossil3.gif ~ www/fossil_logo_small.gif ~ www/fossil_logo_small2.gif ~ www/fossil_logo_small3.gif ~ www/fossil_prompt.sh ~ www/fossil_prompt.wiki ~ www/hacker-howto.wiki ~ www/hints.wiki ~ www/index.wiki ~ www/inout.wiki ~ www/makefile.wiki ~ www/mkdownload.tcl ~ www/mkindex.tcl ~ www/newrepo.wiki ~ www/password.wiki ~ www/permutedindex.html ~ www/pop.wiki ~ www/private.wiki ~ www/qandc.wiki ~ www/quickstart.wiki ~ www/quotes.wiki ~ www/reviews.wiki ~ www/scgi.wiki ~ www/selfcheck.wiki ~ www/selfhost.wiki ~ www/server.wiki ~ www/settings.wiki ~ www/shunning.wiki ~ www/ssl.wiki ~ www/stats.wiki ~ www/style.wiki ~ www/sync.wiki ~ www/tech_overview.wiki ~ www/theory1.wiki ~ www/tickets.wiki ~ www/uitest.html ~ www/webui.wiki ~ www/wikitheory.wiki

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Binary file

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

+47 -40
--- src/import.c
+++ src/import.c
@@ -720,39 +720,42 @@
720720
}
721721
722722
/*
723723
** COMMAND: import
724724
**
725
-** Usage: %fossil import --git ?OPTIONS? NEW-REPOSITORY
725
+** Usage: %fossil import ?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.
730731
**
731732
** The git-fast-export file format is currently the only VCS interchange
732733
** format that is understood, though other interchange formats may be added
733734
** in the future.
734735
**
735736
** The --incremental option allows an existing repository to be extended
736737
** with new content.
737738
**
738739
** Options:
740
+** --git import from the git-fast-export file format (default)
739741
** --incremental allow importing into an existing repository
740742
**
741743
** See also: export
742744
*/
743
-void git_import_cmd(void){
745
+void import_cmd(void){
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 svnFlag = find_option("svn", 0, 0)!=0;
749752
750753
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("NEW-REPOSITORY ?INPUT-FILE?");
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( svnFlag ){
775
+ fossil_fatal("--svn format not implemented yet");
776
+ }else{
777
+ /* The following temp-tables are used to hold information needed for
778
+ ** the import.
779
+ **
780
+ ** The XMARK table provides a mapping from fast-import "marks" and symbols
781
+ ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
782
+ ** Given any valid fast-import symbol, the corresponding fossil rid and
783
+ ** uuid can found by searching against the xmark.tname field.
784
+ **
785
+ ** The XBRANCH table maps commit marks and symbols into the branch those
786
+ ** commits belong to. If xbranch.tname is a fast-import symbol for a
787
+ ** checkin then xbranch.brnm is the branch that checkin is part of.
788
+ **
789
+ ** The XTAG table records information about tags that need to be applied
790
+ ** to various branches after the import finishes. The xtag.tcontent field
791
+ ** contains the text of an artifact that will add a tag to a check-in.
792
+ ** The git-fast-export file format might specify the same tag multiple
793
+ ** times but only the last tag should be used. And we do not know which
794
+ ** occurrence of the tag is the last until the import finishes.
795
+ */
796
+ db_multi_exec(
797
+ "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
798
+ "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
799
+ "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
800
+ );
801
+
802
+ git_fast_import(pIn);
803
+ db_prepare(&q, "SELECT tcontent FROM xtag");
804
+ while( db_step(&q)==SQLITE_ROW ){
805
+ Blob record;
806
+ db_ephemeral_blob(&q, 0, &record);
807
+ fast_insert_content(&record, 0, 0);
808
+ import_reset(0);
809
+ }
810
+ db_finalize(&q);
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,39 +720,42 @@
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:
 
739 ** --incremental allow importing into an existing repository
740 **
741 ** See also: export
742 */
743 void git_import_cmd(void){
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,39 +720,42 @@
720 }
721
722 /*
723 ** COMMAND: import
724 **
725 ** Usage: %fossil import ?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 git-fast-export file format is currently the only VCS interchange
733 ** format that is understood, though other interchange formats may be added
734 ** in the future.
735 **
736 ** The --incremental option allows an existing repository to be extended
737 ** with new content.
738 **
739 ** Options:
740 ** --git import from the git-fast-export file format (default)
741 ** --incremental allow importing into an existing repository
742 **
743 ** See also: export
744 */
745 void import_cmd(void){
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 svnFlag = find_option("svn", 0, 0)!=0;
752
753 find_option("git",0,0); /* Skip the --git option for now */
754 verify_all_options();
755 if( g.argc!=3 && g.argc!=4 ){
756 usage("NEW-REPOSITORY ?INPUT-FILE?");
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( svnFlag ){
775 fossil_fatal("--svn format not implemented yet");
776 }else{
777 /* The following temp-tables are used to hold information needed for
778 ** the import.
779 **
780 ** The XMARK table provides a mapping from fast-import "marks" and symbols
781 ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
782 ** Given any valid fast-import symbol, the corresponding fossil rid and
783 ** uuid can found by searching against the xmark.tname field.
784 **
785 ** The XBRANCH table maps commit marks and symbols into the branch those
786 ** commits belong to. If xbranch.tname is a fast-import symbol for a
787 ** checkin then xbranch.brnm is the branch that checkin is part of.
788 **
789 ** The XTAG table records information about tags that need to be applied
790 ** to various branches after the import finishes. The xtag.tcontent field
791 ** contains the text of an artifact that will add a tag to a check-in.
792 ** The git-fast-export file format might specify the same tag multiple
793 ** times but only the last tag should be used. And we do not know which
794 ** occurrence of the tag is the last until the import finishes.
795 */
796 db_multi_exec(
797 "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
798 "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
799 "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
800 );
801
802 git_fast_import(pIn);
803 db_prepare(&q, "SELECT tcontent FROM xtag");
804 while( db_step(&q)==SQLITE_ROW ){
805 Blob record;
806 db_ephemeral_blob(&q, 0, &record);
807 fast_insert_content(&record, 0, 0);
808 import_reset(0);
809 }
810 db_finalize(&q);
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

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Binary file

No diff available

Binary file

Binary file

Binary file

Binary file

No diff available

No diff available

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

No diff available

No diff available

No diff available

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Binary file

No diff available

Binary file

Binary file

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

Keyboard Shortcuts

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