Fossil with Commonmark

Check-in [3209f07284]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Restructure import.c, making it easier to compare with the new svn-import code. No change in functionality.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3209f072849acda0532060411e8f30b3127d8b8a
User & Date: jan.nijtmans 2015-02-06 10:47:23
Context
2015-02-06
14:16
Fix execute permissions check-in: 216798706a user: jan.nijtmans tags: trunk
10:49
merge trunk check-in: 9bc76f6a11 user: jan.nijtmans tags: svn-import
10:47
Restructure import.c, making it easier to compare with the new svn-import code. No change in functionality. check-in: 3209f07284 user: jan.nijtmans tags: trunk
09:55
eol-spacing fixes. check-in: b8e3dc16f4 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

.dockerignore became executable.

.project became executable.

.settings/org.eclipse.core.resources.prefs became executable.

.settings/org.eclipse.core.runtime.prefs became executable.

BUILD.txt became executable.

COPYRIGHT-BSD2.txt became executable.

Dockerfile became executable.

Makefile.classic became executable.

Makefile.in became executable.

VERSION became executable.

ajax/README became executable.

ajax/index.html became executable.

ajax/wiki-editor.html became executable.

art/CollRev1.dia became executable.

art/CollRev2.dia became executable.

art/CollRev3.dia became executable.

art/CollRev4.dia became executable.

art/branching.odp became executable.

cannot compute difference between binary files

art/concept1.dia became executable.

cannot compute difference between binary files

art/concept2.dia became executable.

cannot compute difference between binary files

art/delta1.dia became executable.

art/delta2.dia became executable.

art/delta3.dia became executable.

art/delta4.dia became executable.

art/delta5.dia became executable.

art/delta6.dia became executable.

art/encode1.tex became executable.

art/encode10.dia became executable.

art/encode2.tex became executable.

art/encode3.tex became executable.

art/encode4.tex became executable.

art/encode5.tex became executable.

art/encode6.tex became executable.

art/encode7.tex became executable.

art/encode8.tex became executable.

art/encode9.tex became executable.

auto.def became executable.

autosetup/LICENSE became executable.

autosetup/README.autosetup became executable.

autosetup/cc-db.tcl became executable.

autosetup/cc-lib.tcl became executable.

autosetup/cc-shared.tcl became executable.

autosetup/cc.tcl became executable.

autosetup/default.auto became executable.

autosetup/jimsh0.c became executable.

autosetup/local.tcl became executable.

autosetup/system.tcl became executable.

autosetup/test-tclsh became executable.

debian/makedeb.sh became executable.

setup/fossil.iss became executable.

setup/fossil.nsi became executable.

skins/README.md became executable.

src/Makefile became executable.

src/add.c became executable.

src/allrepo.c became executable.

src/attach.c became executable.

src/bag.c became executable.

src/bisect.c became executable.

src/blob.c became executable.

src/branch.c became executable.

src/browse.c became executable.

src/builtin.c became executable.

src/bundle.c became executable.

src/cache.c became executable.

src/captcha.c became executable.

src/cgi.c became executable.

src/checkin.c became executable.

src/checkout.c became executable.

src/clearsign.c became executable.

src/clone.c became executable.

src/codecheck1.c became executable.

src/comformat.c became executable.

src/config.h became executable.

src/configure.c became executable.

src/content.c became executable.

src/cson_amalgamation.c became executable.

src/cson_amalgamation.h became executable.

src/cygsup.h became executable.

src/db.c became executable.

src/delta.c became executable.

src/deltacmd.c became executable.

src/descendants.c became executable.

src/diff.c became executable.

src/diff.tcl became executable.

src/diffcmd.c became executable.

src/doc.c became executable.

src/encode.c became executable.

src/event.c became executable.

src/export.c became executable.

src/file.c became executable.

src/finfo.c became executable.

src/foci.c became executable.

src/fusefs.c became executable.

src/glob.c became executable.

src/graph.c became executable.

src/gzip.c became executable.

src/http.c became executable.

src/http_socket.c became executable.

src/http_ssl.c became executable.

src/http_transport.c became executable.

Changes to src/import.c.

718
719
720
721
722
723
724
725
726
727
728

729
730
731
732
733
734
735
736
737
738

739
740
741
742
743
744
745
746
747
748

749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795





























796
797
798
799
800
801
802
803
804

805
806
807
808
809
810
811
  fossil_fatal("bad fast-import line: [%s]", zLine);
  return;
}

/*
** COMMAND: import
**
** Usage: %fossil import --git ?OPTIONS? NEW-REPOSITORY
**
** Read text generated by the git-fast-export command and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY

** argument.  The git-fast-export text is read from standard input.
**
** The git-fast-export file format is currently the only VCS interchange
** format that is understood, though other interchange formats may be added
** in the future.
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
** Options:

**   --incremental  allow importing into an existing repository
**
** See also: export
*/
void git_import_cmd(void){
  char *zPassword;
  FILE *pIn;
  Stmt q;
  int forceFlag = find_option("force", "f", 0)!=0;
  int incrFlag = find_option("incremental", "i", 0)!=0;


  find_option("git",0,0);  /* Skip the --git option for now */
  verify_all_options();
  if( g.argc!=3  && g.argc!=4 ){
    usage("REPOSITORY-NAME");
  }
  if( g.argc==4 ){
    pIn = fossil_fopen(g.argv[3], "rb");
  }else{
    pIn = stdin;
    fossil_binary_mode(pIn);
  }
  if( !incrFlag ){
    if( forceFlag ) file_delete(g.argv[2]);
    db_create_repository(g.argv[2]);
  }
  db_open_repository(g.argv[2]);
  db_open_config(0);

  /* The following temp-tables are used to hold information needed for
  ** the import.
  **
  ** The XMARK table provides a mapping from fast-import "marks" and symbols
  ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
  ** Given any valid fast-import symbol, the corresponding fossil rid and
  ** uuid can found by searching against the xmark.tname field.
  **
  ** The XBRANCH table maps commit marks and symbols into the branch those
  ** commits belong to.  If xbranch.tname is a fast-import symbol for a
  ** checkin then xbranch.brnm is the branch that checkin is part of.
  **
  ** The XTAG table records information about tags that need to be applied
  ** to various branches after the import finishes.  The xtag.tcontent field
  ** contains the text of an artifact that will add a tag to a check-in.
  ** The git-fast-export file format might specify the same tag multiple
  ** times but only the last tag should be used.  And we do not know which
  ** occurrence of the tag is the last until the import finishes.
  */
  db_multi_exec(
     "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
     "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
     "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
  );


  db_begin_transaction();
  if( !incrFlag ) db_initial_setup(0, 0, 0, 1);





























  git_fast_import(pIn);
  db_prepare(&q, "SELECT tcontent FROM xtag");
  while( db_step(&q)==SQLITE_ROW ){
    Blob record;
    db_ephemeral_blob(&q, 0, &record);
    fast_insert_content(&record, 0, 0);
    import_reset(0);
  }
  db_finalize(&q);

  db_end_transaction(0);
  db_begin_transaction();
  fossil_print("Rebuilding repository meta-data...\n");
  rebuild_db(0, 1, !incrFlag);
  verify_cancel();
  db_end_transaction(0);
  fossil_print("Vacuuming..."); fflush(stdout);







|

|

>
|









>




|





>




|













<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
>







718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769


























770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
  fossil_fatal("bad fast-import line: [%s]", zLine);
  return;
}

/*
** COMMAND: import
**
** Usage: %fossil import ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
**
** Read interchange format generated by another VCS and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY
** argument.  If no input file is supplied the interchange format
** data is read from standard input.
**
** The git-fast-export file format is currently the only VCS interchange
** format that is understood, though other interchange formats may be added
** in the future.
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
** Options:
**   --git          import from the git-fast-export file format (default)
**   --incremental  allow importing into an existing repository
**
** See also: export
*/
void import_cmd(void){
  char *zPassword;
  FILE *pIn;
  Stmt q;
  int forceFlag = find_option("force", "f", 0)!=0;
  int incrFlag = find_option("incremental", "i", 0)!=0;
  int svnFlag = find_option("svn", 0, 0)!=0;

  find_option("git",0,0);  /* Skip the --git option for now */
  verify_all_options();
  if( g.argc!=3  && g.argc!=4 ){
    usage("NEW-REPOSITORY ?INPUT-FILE?");
  }
  if( g.argc==4 ){
    pIn = fossil_fopen(g.argv[3], "rb");
  }else{
    pIn = stdin;
    fossil_binary_mode(pIn);
  }
  if( !incrFlag ){
    if( forceFlag ) file_delete(g.argv[2]);
    db_create_repository(g.argv[2]);
  }
  db_open_repository(g.argv[2]);
  db_open_config(0);



























  db_begin_transaction();
  if( !incrFlag ) db_initial_setup(0, 0, 0, 1);

  if( svnFlag ){
    fossil_fatal("--svn format not implemented yet");
  }else{
    /* The following temp-tables are used to hold information needed for
    ** the import.
    **
    ** The XMARK table provides a mapping from fast-import "marks" and symbols
    ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
    ** Given any valid fast-import symbol, the corresponding fossil rid and
    ** uuid can found by searching against the xmark.tname field.
    **
    ** The XBRANCH table maps commit marks and symbols into the branch those
    ** commits belong to.  If xbranch.tname is a fast-import symbol for a
    ** checkin then xbranch.brnm is the branch that checkin is part of.
    **
    ** The XTAG table records information about tags that need to be applied
    ** to various branches after the import finishes.  The xtag.tcontent field
    ** contains the text of an artifact that will add a tag to a check-in.
    ** The git-fast-export file format might specify the same tag multiple
    ** times but only the last tag should be used.  And we do not know which
    ** occurrence of the tag is the last until the import finishes.
    */
    db_multi_exec(
       "CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
       "CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
       "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
    );

    git_fast_import(pIn);
    db_prepare(&q, "SELECT tcontent FROM xtag");
    while( db_step(&q)==SQLITE_ROW ){
      Blob record;
      db_ephemeral_blob(&q, 0, &record);
      fast_insert_content(&record, 0, 0);
      import_reset(0);
    }
    db_finalize(&q);
  }
  db_end_transaction(0);
  db_begin_transaction();
  fossil_print("Rebuilding repository meta-data...\n");
  rebuild_db(0, 1, !incrFlag);
  verify_cancel();
  db_end_transaction(0);
  fossil_print("Vacuuming..."); fflush(stdout);

src/info.c became executable.

src/json.c became executable.

src/json_artifact.c became executable.

src/json_branch.c became executable.

src/json_config.c became executable.

src/json_detail.h became executable.

src/json_diff.c became executable.

src/json_dir.c became executable.

src/json_finfo.c became executable.

src/json_login.c became executable.

src/json_query.c became executable.

src/json_report.c became executable.

src/json_status.c became executable.

src/json_tag.c became executable.

src/json_timeline.c became executable.

src/json_user.c became executable.

src/json_wiki.c became executable.

src/leaf.c became executable.

src/loadctrl.c became executable.

src/login.c became executable.

src/lookslike.c became executable.

src/main.c became executable.

src/main.mk became executable.

src/makeheaders.c became executable.

src/makeheaders.html became executable.

src/makemake.tcl became executable.

src/manifest.c became executable.

src/markdown.c became executable.

src/markdown.md became executable.

src/markdown_html.c became executable.

src/md5.c became executable.

src/merge.c became executable.

src/merge3.c became executable.

src/miniz.c became executable.

src/mkbuiltin.c became executable.

src/mkindex.c became executable.

src/mkversion.c became executable.

src/moderate.c became executable.

src/name.c became executable.

src/path.c became executable.

src/pivot.c became executable.

src/popen.c became executable.

src/pqueue.c became executable.

src/printf.c became executable.

src/publish.c became executable.

src/purge.c became executable.

src/rebuild.c became executable.

src/regexp.c became executable.

src/report.c became executable.

src/rss.c became executable.

src/schema.c became executable.

src/search.c became executable.

src/setup.c became executable.

src/sha1.c became executable.

src/shell.c became executable.

src/shun.c became executable.

src/sitemap.c became executable.

src/skins.c became executable.

src/sqlcmd.c became executable.

src/sqlite3.c became executable.

src/sqlite3.h became executable.

src/stash.c became executable.

src/stat.c became executable.

src/statrep.c became executable.

src/style.c became executable.

src/sync.c became executable.

src/tag.c became executable.

src/tar.c became executable.

src/th.c became executable.

src/th.h became executable.

src/th_lang.c became executable.

src/th_main.c became executable.

src/th_tcl.c became executable.

src/timeline.c became executable.

src/tkt.c became executable.

src/tktsetup.c became executable.

src/translate.c became executable.

src/undo.c became executable.

src/unicode.c became executable.

src/update.c became executable.

src/url.c became executable.

src/user.c became executable.

src/utf8.c became executable.

src/util.c became executable.

src/verify.c became executable.

src/vfile.c became executable.

src/wiki.c became executable.

src/wikiformat.c became executable.

src/winfile.c became executable.

src/winhttp.c became executable.

src/wysiwyg.c became executable.

src/xfer.c became executable.

src/xfersetup.c became executable.

src/zip.c became executable.

test/Greek-Lipsum-1.txt became executable.

test/Greek-Lipsum-2.txt became executable.

test/cmdline.test became executable.

test/comment.test became executable.

test/delta1.test became executable.

test/diff-test-1.wiki became executable.

test/file1.test became executable.

test/glob.test became executable.

test/graph-test-1.wiki became executable.

test/many-www.tcl became executable.

test/markdown-test1.md became executable.

test/merge1.test became executable.

test/merge2.test became executable.

test/merge3.test became executable.

test/merge4.test became executable.

test/merge5.test became executable.

test/merge5_repo.sql became executable.

test/merge6.test became executable.

test/merge_renames.test became executable.

test/release-checklist.wiki became executable.

test/revert.test became executable.

test/test-page++.wiki became executable.

test/tester.tcl became executable.

test/th1-hooks-input.txt became executable.

test/th1-hooks.test became executable.

test/th1-tcl.test became executable.

test/th1-tcl1.txt became executable.

test/th1-tcl2.txt became executable.

test/th1-tcl3.txt became executable.

test/th1-tcl4.txt became executable.

test/th1-tcl5.txt became executable.

test/th1-tcl6.txt became executable.

test/th1-tcl7.txt became executable.

test/th1-tcl8.txt became executable.

test/th1-tcl9.txt became executable.

test/th1.test became executable.

test/update-test-1.sh became executable.

test/update-test-2.sh became executable.

test/utf.test became executable.

test/utf16be.txt became executable.

test/utf16le.txt became executable.

test/valgrind-www.tcl became executable.

tools/encode_math.sh became executable.

tools/fossil-autocomplete.bash became executable.

tools/fossil_chat.tcl became executable.

win/Makefile.PellesCGMake became executable.

win/Makefile.dmc became executable.

win/Makefile.mingw became executable.

win/Makefile.mingw.mistachkin became executable.

win/Makefile.msc became executable.

win/buildmsvc.bat became executable.

win/fossil.exe.manifest became executable.

win/fossil.ico became executable.

cannot compute difference between binary files

win/fossil.rc became executable.

www/CollRev1.gif became executable.

cannot compute difference between binary files

www/CollRev2.gif became executable.

cannot compute difference between binary files

www/CollRev3.gif became executable.

cannot compute difference between binary files

www/CollRev4.gif became executable.

cannot compute difference between binary files

www/adding_code.wiki became executable.

www/antibot.wiki became executable.

www/apple-touch-icon.png became executable.

cannot compute difference between binary files

www/background.jpg became executable.

cannot compute difference between binary files

www/branch01.gif became executable.

cannot compute difference between binary files

www/branch02.gif became executable.

cannot compute difference between binary files

www/branch03.gif became executable.

cannot compute difference between binary files

www/branch04.gif became executable.

cannot compute difference between binary files

www/branch05.gif became executable.

cannot compute difference between binary files

www/branching.wiki became executable.

www/bugtheory.wiki became executable.

www/build.wiki became executable.

www/changes.wiki became executable.

www/checkin.wiki became executable.

www/checkin_names.wiki became executable.

www/cmd_.wiki-template became executable.

www/concept1.gif became executable.

cannot compute difference between binary files

www/concept2.gif became executable.

cannot compute difference between binary files

www/concepts.wiki became executable.

www/contribute.wiki became executable.

www/copyright-release.html became executable.

www/copyright-release.pdf became executable.

cannot compute difference between binary files

www/custom_ticket.wiki became executable.

www/delta1.gif became executable.

cannot compute difference between binary files

www/delta2.gif became executable.

cannot compute difference between binary files

www/delta3.gif became executable.

cannot compute difference between binary files

www/delta4.gif became executable.

cannot compute difference between binary files

www/delta5.gif became executable.

cannot compute difference between binary files

www/delta6.gif became executable.

cannot compute difference between binary files

www/delta_encoder_algorithm.wiki became executable.

www/delta_format.wiki became executable.

www/embeddeddoc.wiki became executable.

www/encode1.gif became executable.

cannot compute difference between binary files

www/encode10.gif became executable.

cannot compute difference between binary files

www/encode2.gif became executable.

cannot compute difference between binary files

www/encode3.gif became executable.

cannot compute difference between binary files

www/encode4.gif became executable.

cannot compute difference between binary files

www/encode5.gif became executable.

cannot compute difference between binary files

www/encode6.gif became executable.

cannot compute difference between binary files

www/encode7.gif became executable.

cannot compute difference between binary files

www/encode8.gif became executable.

cannot compute difference between binary files

www/encode9.gif became executable.

cannot compute difference between binary files

www/event.wiki became executable.

www/faq.tcl became executable.

www/faq.wiki became executable.

www/fileformat.wiki became executable.

www/fiveminutes.wiki became executable.

www/foss-cklist.wiki became executable.

www/fossil-from-msvc.wiki became executable.

www/fossil-v-git.wiki became executable.

www/fossil.eps became executable.

www/fossil.gif became executable.

cannot compute difference between binary files

www/fossil2.eps became executable.

www/fossil2.gif became executable.

cannot compute difference between binary files

www/fossil3.gif became executable.

cannot compute difference between binary files

www/fossil_logo_small.gif became executable.

cannot compute difference between binary files

www/fossil_logo_small2.gif became executable.

cannot compute difference between binary files

www/fossil_logo_small3.gif became executable.

cannot compute difference between binary files

www/fossil_prompt.sh became executable.

www/fossil_prompt.wiki became executable.

www/hacker-howto.wiki became executable.

www/hints.wiki became executable.

www/index.wiki became executable.

www/inout.wiki became executable.

www/makefile.wiki became executable.

www/mkdownload.tcl became executable.

www/mkindex.tcl became executable.

www/newrepo.wiki became executable.

www/password.wiki became executable.

www/permutedindex.html became executable.

www/pop.wiki became executable.

www/private.wiki became executable.

www/qandc.wiki became executable.

www/quickstart.wiki became executable.

www/quotes.wiki became executable.

www/reviews.wiki became executable.

www/scgi.wiki became executable.

www/selfcheck.wiki became executable.

www/selfhost.wiki became executable.

www/server.wiki became executable.

www/settings.wiki became executable.

www/shunning.wiki became executable.

www/ssl.wiki became executable.

www/stats.wiki became executable.

www/style.wiki became executable.

www/sync.wiki became executable.

www/tech_overview.wiki became executable.

www/theory1.wiki became executable.

www/tickets.wiki became executable.

www/uitest.html became executable.

www/webui.wiki became executable.

www/wikitheory.wiki became executable.