Fossil SCM
prepare for svn branch importing
Commit
bb1d783544b88de5c4d63f8bd0287b3921f25d63
Parent
ffd61eedf5a1e8f…
1 file changed
+14
-12
+14
-12
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1051,12 +1051,16 @@ | ||
| 1051 | 1051 | ** argument. If no input file is supplied the interchange format |
| 1052 | 1052 | ** data is read from standard input. |
| 1053 | 1053 | ** |
| 1054 | 1054 | ** The following formats are currently understood by this command |
| 1055 | 1055 | ** |
| 1056 | -** --git Import from the git-fast-export file format | |
| 1057 | -** --svn Import from the svnadmin-dump file format | |
| 1056 | +** git Import from the git-fast-export file format | |
| 1057 | +** | |
| 1058 | +** svn Import from the svnadmin-dump file format | |
| 1059 | +** Options: | |
| 1060 | +** --flat The whole dump is a single branch. The default | |
| 1061 | +** is to use the trunk/branches/tags svn layout | |
| 1058 | 1062 | ** |
| 1059 | 1063 | ** The --incremental option allows an existing repository to be extended |
| 1060 | 1064 | ** with new content. |
| 1061 | 1065 | ** |
| 1062 | 1066 | ** Options: |
| @@ -1068,34 +1072,32 @@ | ||
| 1068 | 1072 | char *zPassword; |
| 1069 | 1073 | FILE *pIn; |
| 1070 | 1074 | Stmt q; |
| 1071 | 1075 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1072 | 1076 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1073 | - int gitFlag = find_option("git",0,0)!=0; | |
| 1074 | - int svnFlag = find_option("svn",0,0)!=0; | |
| 1075 | 1077 | |
| 1076 | 1078 | verify_all_options(); |
| 1077 | - if( g.argc!=3 && g.argc!=4 ){ | |
| 1079 | + if( g.argc!=4 && g.argc!=5 ){ | |
| 1078 | 1080 | usage("FORMAT REPOSITORY-NAME"); |
| 1079 | 1081 | } |
| 1080 | - if( g.argc==4 ){ | |
| 1081 | - pIn = fossil_fopen(g.argv[3], "rb"); | |
| 1082 | + if( g.argc==5 ){ | |
| 1083 | + pIn = fossil_fopen(g.argv[4], "rb"); | |
| 1082 | 1084 | }else{ |
| 1083 | 1085 | pIn = stdin; |
| 1084 | 1086 | fossil_binary_mode(pIn); |
| 1085 | 1087 | } |
| 1086 | 1088 | if( !incrFlag ){ |
| 1087 | - if( forceFlag ) file_delete(g.argv[2]); | |
| 1088 | - db_create_repository(g.argv[2]); | |
| 1089 | + if( forceFlag ) file_delete(g.argv[3]); | |
| 1090 | + db_create_repository(g.argv[3]); | |
| 1089 | 1091 | } |
| 1090 | - db_open_repository(g.argv[2]); | |
| 1092 | + db_open_repository(g.argv[3]); | |
| 1091 | 1093 | db_open_config(0); |
| 1092 | 1094 | |
| 1093 | 1095 | db_begin_transaction(); |
| 1094 | 1096 | if( !incrFlag ) db_initial_setup(0, 0, 0, 1); |
| 1095 | 1097 | |
| 1096 | - if( gitFlag ){ | |
| 1098 | + if( strncmp(g.argv[2], "git", 3)==0 ){ | |
| 1097 | 1099 | /* The following temp-tables are used to hold information needed for |
| 1098 | 1100 | ** the import. |
| 1099 | 1101 | ** |
| 1100 | 1102 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 1101 | 1103 | ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). |
| @@ -1127,11 +1129,11 @@ | ||
| 1127 | 1129 | fast_insert_content(&record, 0, 0); |
| 1128 | 1130 | import_reset(0); |
| 1129 | 1131 | } |
| 1130 | 1132 | db_finalize(&q); |
| 1131 | 1133 | }else |
| 1132 | - if( svnFlag ){ | |
| 1134 | + if( strncmp(g.argv[2], "svn", 3)==0 ){ | |
| 1133 | 1135 | db_multi_exec( |
| 1134 | 1136 | "CREATE TEMP TABLE xrevisions(" |
| 1135 | 1137 | " trev INT, tuser TEXT, tmsg TEXT, ttime DATETIME" |
| 1136 | 1138 | ");" |
| 1137 | 1139 | "CREATE TEMP TABLE xfiles(" |
| 1138 | 1140 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1051,12 +1051,16 @@ | |
| 1051 | ** argument. If no input file is supplied the interchange format |
| 1052 | ** data is read from standard input. |
| 1053 | ** |
| 1054 | ** The following formats are currently understood by this command |
| 1055 | ** |
| 1056 | ** --git Import from the git-fast-export file format |
| 1057 | ** --svn Import from the svnadmin-dump file format |
| 1058 | ** |
| 1059 | ** The --incremental option allows an existing repository to be extended |
| 1060 | ** with new content. |
| 1061 | ** |
| 1062 | ** Options: |
| @@ -1068,34 +1072,32 @@ | |
| 1068 | char *zPassword; |
| 1069 | FILE *pIn; |
| 1070 | Stmt q; |
| 1071 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1072 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1073 | int gitFlag = find_option("git",0,0)!=0; |
| 1074 | int svnFlag = find_option("svn",0,0)!=0; |
| 1075 | |
| 1076 | verify_all_options(); |
| 1077 | if( g.argc!=3 && g.argc!=4 ){ |
| 1078 | usage("FORMAT REPOSITORY-NAME"); |
| 1079 | } |
| 1080 | if( g.argc==4 ){ |
| 1081 | pIn = fossil_fopen(g.argv[3], "rb"); |
| 1082 | }else{ |
| 1083 | pIn = stdin; |
| 1084 | fossil_binary_mode(pIn); |
| 1085 | } |
| 1086 | if( !incrFlag ){ |
| 1087 | if( forceFlag ) file_delete(g.argv[2]); |
| 1088 | db_create_repository(g.argv[2]); |
| 1089 | } |
| 1090 | db_open_repository(g.argv[2]); |
| 1091 | db_open_config(0); |
| 1092 | |
| 1093 | db_begin_transaction(); |
| 1094 | if( !incrFlag ) db_initial_setup(0, 0, 0, 1); |
| 1095 | |
| 1096 | if( gitFlag ){ |
| 1097 | /* The following temp-tables are used to hold information needed for |
| 1098 | ** the import. |
| 1099 | ** |
| 1100 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 1101 | ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). |
| @@ -1127,11 +1129,11 @@ | |
| 1127 | fast_insert_content(&record, 0, 0); |
| 1128 | import_reset(0); |
| 1129 | } |
| 1130 | db_finalize(&q); |
| 1131 | }else |
| 1132 | if( svnFlag ){ |
| 1133 | db_multi_exec( |
| 1134 | "CREATE TEMP TABLE xrevisions(" |
| 1135 | " trev INT, tuser TEXT, tmsg TEXT, ttime DATETIME" |
| 1136 | ");" |
| 1137 | "CREATE TEMP TABLE xfiles(" |
| 1138 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1051,12 +1051,16 @@ | |
| 1051 | ** argument. If no input file is supplied the interchange format |
| 1052 | ** data is read from standard input. |
| 1053 | ** |
| 1054 | ** The following formats are currently understood by this command |
| 1055 | ** |
| 1056 | ** git Import from the git-fast-export file format |
| 1057 | ** |
| 1058 | ** svn Import from the svnadmin-dump file format |
| 1059 | ** Options: |
| 1060 | ** --flat The whole dump is a single branch. The default |
| 1061 | ** is to use the trunk/branches/tags svn layout |
| 1062 | ** |
| 1063 | ** The --incremental option allows an existing repository to be extended |
| 1064 | ** with new content. |
| 1065 | ** |
| 1066 | ** Options: |
| @@ -1068,34 +1072,32 @@ | |
| 1072 | char *zPassword; |
| 1073 | FILE *pIn; |
| 1074 | Stmt q; |
| 1075 | int forceFlag = find_option("force", "f", 0)!=0; |
| 1076 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1077 | |
| 1078 | verify_all_options(); |
| 1079 | if( g.argc!=4 && g.argc!=5 ){ |
| 1080 | usage("FORMAT REPOSITORY-NAME"); |
| 1081 | } |
| 1082 | if( g.argc==5 ){ |
| 1083 | pIn = fossil_fopen(g.argv[4], "rb"); |
| 1084 | }else{ |
| 1085 | pIn = stdin; |
| 1086 | fossil_binary_mode(pIn); |
| 1087 | } |
| 1088 | if( !incrFlag ){ |
| 1089 | if( forceFlag ) file_delete(g.argv[3]); |
| 1090 | db_create_repository(g.argv[3]); |
| 1091 | } |
| 1092 | db_open_repository(g.argv[3]); |
| 1093 | db_open_config(0); |
| 1094 | |
| 1095 | db_begin_transaction(); |
| 1096 | if( !incrFlag ) db_initial_setup(0, 0, 0, 1); |
| 1097 | |
| 1098 | if( strncmp(g.argv[2], "git", 3)==0 ){ |
| 1099 | /* The following temp-tables are used to hold information needed for |
| 1100 | ** the import. |
| 1101 | ** |
| 1102 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 1103 | ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). |
| @@ -1127,11 +1129,11 @@ | |
| 1129 | fast_insert_content(&record, 0, 0); |
| 1130 | import_reset(0); |
| 1131 | } |
| 1132 | db_finalize(&q); |
| 1133 | }else |
| 1134 | if( strncmp(g.argv[2], "svn", 3)==0 ){ |
| 1135 | db_multi_exec( |
| 1136 | "CREATE TEMP TABLE xrevisions(" |
| 1137 | " trev INT, tuser TEXT, tmsg TEXT, ttime DATETIME" |
| 1138 | ");" |
| 1139 | "CREATE TEMP TABLE xfiles(" |
| 1140 |