Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix issue with branching from a branch |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | svn-import |
Files: | files | file ages | folders |
SHA1: | 93134dda26e295ac6ec1e56c9024c82b |
User & Date: | baruch 2015-01-11 08:02:00 |
Context
2015-01-11
| ||
11:30 | Allow using tags as copy-source Move variables to smaller scope, as per coding style guidelines check-in: 997da4f0 user: baruch tags: svn-import | |
08:02 | Fix issue with branching from a branch check-in: 93134dda user: baruch tags: svn-import | |
2015-01-08
| ||
11:14 | Fix memory leaks check-in: fa8f12b6 user: baruch tags: svn-import | |
Changes
Changes to src/import.c.
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 .... 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 .... 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 .... 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 .... 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 .... 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 |
*zFile = 0; if( gsvn.lenTrunk==0 ){ zBranch = "trunk"; *zFile = zPath; type = 1; }else if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){ zBranch = "trunk"; if( zPath[gsvn.lenTrunk-1]=='/' ){ *zFile = zPath+gsvn.lenTrunk;; }else if( zPath[gsvn.lenTrunk-1]==0 ){ *zFile = 0; }else{ *zFile = zBranch = 0; type = 0; } type = 1; }else if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){ *zFile = zBranch = zPath+gsvn.lenBranches; while( **zFile && **zFile!='/' ){ (*zFile)++; } if( **zFile ){ **zFile = '\0'; (*zFile)++; }else{ *zFile = 0; } type = 2; }else if( strncmp(zPath, gsvn.zTags, gsvn.lenTags)==0 ){ *zFile = zBranch = zPath+gsvn.lenTags; while( **zFile && **zFile!='/' ){ (*zFile)++; } if( **zFile ){ **zFile = '\0'; (*zFile)++; }else{ *zFile = 0; } type = 3; } if( type>0 ){ branchId = db_int(0, "SELECT tid FROM xbranches WHERE tname=%Q AND ttype=%d", zBranch, type); ................................................................................ int ver; char *zTemp; const char *zUuid; Stmt addFile; Stmt delPath; Stmt addRev; Stmt cpyPath; Stmt revSrc; /* version */ if( svn_read_rec(pIn, &rec) && (zTemp = svn_find_header(rec, "SVN-fs-dump-format-version")) ){ ver = atoi(zTemp); if( ver!=2 && ver!=3 ){ ................................................................................ "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm" " FROM xfoci" " WHERE checkinID=:rid" " AND filename>:srcpath||'/'" " AND filename<:srcpath||'0'" ); db_prepare(&revSrc, "UPDATE xrevisions SET tparent=:parent" " WHERE trev=:rev AND tbranch=:branch AND tparent<:parent" ); gsvn.rev = -1; bag_init(&gsvn.newBranches); while( svn_read_rec(pIn, &rec) ){ ................................................................................ fossil_fatal("Missing copyfrom-rev"); } srcBranch = svn_parse_path(zSrcPath, &zSrcFile); if( srcBranch==0 ){ fossil_fatal("Copy from path outside the import paths"); } } if( zFile==0 ){ bag_insert(&gsvn.newBranches, branchId); } if( strncmp(zAction, "delete", 6)==0 || strncmp(zAction, "replace", 7)==0 ) { db_bind_text(&delPath, ":path", zFile); db_bind_int(&delPath, ":branch", branchId); db_step(&delPath); db_reset(&delPath); db_bind_int(&addRev, ":branch", branchId); db_step(&addRev); db_reset(&addRev); ................................................................................ fossil_fatal("Missing Node-kind"); }else if( strncmp(zKind, "dir", 3)==0 ){ if( zSrcPath ){ srcRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions" " WHERE trev<=%d AND tbranch=%d", srcRev, srcBranch); if( srcRid>0 ){ db_bind_text(&cpyPath, ":path", zFile); db_bind_int(&cpyPath, ":branch", branchId); db_bind_text(&cpyPath, ":srcpath", zSrcFile); db_bind_int(&cpyPath, ":rid", srcRid); db_step(&cpyPath); db_reset(&cpyPath); db_bind_int(&addRev, ":branch", branchId); db_step(&addRev); db_reset(&addRev); } } }else{ int rid = 0; ................................................................................ fossil_free(gsvn.zUser); fossil_free(gsvn.zComment); fossil_free(gsvn.zDate); db_finalize(&addFile); db_finalize(&delPath); db_finalize(&addRev); db_finalize(&cpyPath); db_finalize(&revSrc); fossil_print(" Done!\n"); } /* ** COMMAND: import ** |
> | < | < | | < < < < < > > > > > > > | > > > > > > > > | | | | | | > > |
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 .... 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 .... 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 .... 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 .... 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 .... 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 |
*zFile = 0; if( gsvn.lenTrunk==0 ){ zBranch = "trunk"; *zFile = zPath; type = 1; }else if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){ if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){ zBranch = "trunk"; *zFile = zPath+gsvn.lenTrunk; type = 1; }else{ zBranch = 0; type = 0; } }else if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){ *zFile = zBranch = zPath+gsvn.lenBranches; while( **zFile && **zFile!='/' ){ (*zFile)++; } if( **zFile ){ **zFile = '\0'; (*zFile)++; } type = 2; }else if( strncmp(zPath, gsvn.zTags, gsvn.lenTags)==0 ){ *zFile = zBranch = zPath+gsvn.lenTags; while( **zFile && **zFile!='/' ){ (*zFile)++; } if( **zFile ){ **zFile = '\0'; (*zFile)++; } type = 3; } if( type>0 ){ branchId = db_int(0, "SELECT tid FROM xbranches WHERE tname=%Q AND ttype=%d", zBranch, type); ................................................................................ int ver; char *zTemp; const char *zUuid; Stmt addFile; Stmt delPath; Stmt addRev; Stmt cpyPath; Stmt cpyRoot; Stmt revSrc; /* version */ if( svn_read_rec(pIn, &rec) && (zTemp = svn_find_header(rec, "SVN-fs-dump-format-version")) ){ ver = atoi(zTemp); if( ver!=2 && ver!=3 ){ ................................................................................ "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm" " FROM xfoci" " WHERE checkinID=:rid" " AND filename>:srcpath||'/'" " AND filename<:srcpath||'0'" ); db_prepare(&cpyRoot, "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" " SELECT :path||filename, :branch, uuid, perm" " FROM xfoci" " WHERE checkinID=:rid" ); db_prepare(&revSrc, "UPDATE xrevisions SET tparent=:parent" " WHERE trev=:rev AND tbranch=:branch AND tparent<:parent" ); gsvn.rev = -1; bag_init(&gsvn.newBranches); while( svn_read_rec(pIn, &rec) ){ ................................................................................ fossil_fatal("Missing copyfrom-rev"); } srcBranch = svn_parse_path(zSrcPath, &zSrcFile); if( srcBranch==0 ){ fossil_fatal("Copy from path outside the import paths"); } } if( zFile[0]==0 ){ bag_insert(&gsvn.newBranches, branchId); } if( strncmp(zAction, "delete", 6)==0 || strncmp(zAction, "replace", 7)==0 ) { //TODO delete root db_bind_text(&delPath, ":path", zFile); db_bind_int(&delPath, ":branch", branchId); db_step(&delPath); db_reset(&delPath); db_bind_int(&addRev, ":branch", branchId); db_step(&addRev); db_reset(&addRev); ................................................................................ fossil_fatal("Missing Node-kind"); }else if( strncmp(zKind, "dir", 3)==0 ){ if( zSrcPath ){ srcRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions" " WHERE trev<=%d AND tbranch=%d", srcRev, srcBranch); if( srcRid>0 ){ if( zFile[0]==0 ){ db_bind_text(&cpyRoot, ":path", zFile); db_bind_int(&cpyRoot, ":branch", branchId); db_bind_int(&cpyRoot, ":rid", srcRid); db_step(&cpyRoot); db_reset(&cpyRoot); }else{ db_bind_text(&cpyPath, ":path", zFile); db_bind_int(&cpyPath, ":branch", branchId); db_bind_text(&cpyPath, ":srcpath", zSrcFile); db_bind_int(&cpyPath, ":rid", srcRid); db_step(&cpyPath); db_reset(&cpyPath); } db_bind_int(&addRev, ":branch", branchId); db_step(&addRev); db_reset(&addRev); } } }else{ int rid = 0; ................................................................................ fossil_free(gsvn.zUser); fossil_free(gsvn.zComment); fossil_free(gsvn.zDate); db_finalize(&addFile); db_finalize(&delPath); db_finalize(&addRev); db_finalize(&cpyPath); db_finalize(&cpyRoot); db_finalize(&revSrc); fossil_print(" Done!\n"); } /* ** COMMAND: import ** |