Fossil SCM
Restructure import.c, making it easier to compare with the new svn-import code. No change in functionality.
62a99875598b8c3f99893bc91999a6b51ed45389
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
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
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -720,39 +720,42 @@ | ||
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /* |
| 723 | 723 | ** COMMAND: import |
| 724 | 724 | ** |
| 725 | -** Usage: %fossil import --git ?OPTIONS? NEW-REPOSITORY | |
| 725 | +** Usage: %fossil import ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE? | |
| 726 | 726 | ** |
| 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 | |
| 728 | 728 | ** 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. | |
| 730 | 731 | ** |
| 731 | 732 | ** The git-fast-export file format is currently the only VCS interchange |
| 732 | 733 | ** format that is understood, though other interchange formats may be added |
| 733 | 734 | ** in the future. |
| 734 | 735 | ** |
| 735 | 736 | ** The --incremental option allows an existing repository to be extended |
| 736 | 737 | ** with new content. |
| 737 | 738 | ** |
| 738 | 739 | ** Options: |
| 740 | +** --git import from the git-fast-export file format (default) | |
| 739 | 741 | ** --incremental allow importing into an existing repository |
| 740 | 742 | ** |
| 741 | 743 | ** See also: export |
| 742 | 744 | */ |
| 743 | -void git_import_cmd(void){ | |
| 745 | +void import_cmd(void){ | |
| 744 | 746 | char *zPassword; |
| 745 | 747 | FILE *pIn; |
| 746 | 748 | Stmt q; |
| 747 | 749 | int forceFlag = find_option("force", "f", 0)!=0; |
| 748 | 750 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 751 | + int svnFlag = find_option("svn", 0, 0)!=0; | |
| 749 | 752 | |
| 750 | 753 | find_option("git",0,0); /* Skip the --git option for now */ |
| 751 | 754 | verify_all_options(); |
| 752 | 755 | if( g.argc!=3 && g.argc!=4 ){ |
| 753 | - usage("REPOSITORY-NAME"); | |
| 756 | + usage("NEW-REPOSITORY ?INPUT-FILE?"); | |
| 754 | 757 | } |
| 755 | 758 | if( g.argc==4 ){ |
| 756 | 759 | pIn = fossil_fopen(g.argv[3], "rb"); |
| 757 | 760 | }else{ |
| 758 | 761 | pIn = stdin; |
| @@ -762,48 +765,52 @@ | ||
| 762 | 765 | if( forceFlag ) file_delete(g.argv[2]); |
| 763 | 766 | db_create_repository(g.argv[2]); |
| 764 | 767 | } |
| 765 | 768 | db_open_repository(g.argv[2]); |
| 766 | 769 | 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 | 770 | |
| 794 | 771 | db_begin_transaction(); |
| 795 | 772 | 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 | + } | |
| 805 | 812 | db_end_transaction(0); |
| 806 | 813 | db_begin_transaction(); |
| 807 | 814 | fossil_print("Rebuilding repository meta-data...\n"); |
| 808 | 815 | rebuild_db(0, 1, !incrFlag); |
| 809 | 816 | verify_cancel(); |
| 810 | 817 |
| --- 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
Binary file
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
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