Fossil SCM
Fix handling paths when branching to/from a subdir
Commit
261ff58e2302ba295e07899b03ec9ed92175593a
Parent
bb020aed6259245…
1 file changed
+12
-2
+12
-2
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1200,19 +1200,19 @@ | ||
| 1200 | 1200 | db_prepare(&addRev, |
| 1201 | 1201 | "INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)" |
| 1202 | 1202 | ); |
| 1203 | 1203 | db_prepare(&cpyPath, |
| 1204 | 1204 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1205 | - " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm" | |
| 1205 | + " SELECT :path||:sep||substr(filename, length(:srcpath)+2), :branch, uuid, perm" | |
| 1206 | 1206 | " FROM xfoci" |
| 1207 | 1207 | " WHERE checkinID=:rid" |
| 1208 | 1208 | " AND filename>:srcpath||'/'" |
| 1209 | 1209 | " AND filename<:srcpath||'0'" |
| 1210 | 1210 | ); |
| 1211 | 1211 | db_prepare(&cpyRoot, |
| 1212 | 1212 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1213 | - " SELECT :path||filename, :branch, uuid, perm" | |
| 1213 | + " SELECT :path||:sep||filename, :branch, uuid, perm" | |
| 1214 | 1214 | " FROM xfoci" |
| 1215 | 1215 | " WHERE checkinID=:rid" |
| 1216 | 1216 | ); |
| 1217 | 1217 | db_prepare(&revSrc, |
| 1218 | 1218 | "UPDATE xrevisions SET tparent=:parent" |
| @@ -1309,16 +1309,26 @@ | ||
| 1309 | 1309 | }else if( strncmp(zKind, "dir", 3)==0 ){ |
| 1310 | 1310 | if( zSrcPath ){ |
| 1311 | 1311 | if( srcRid>0 ){ |
| 1312 | 1312 | if( zSrcFile[0]==0 ){ |
| 1313 | 1313 | db_bind_text(&cpyRoot, ":path", zFile); |
| 1314 | + if( zFile[0]!=0 ){ | |
| 1315 | + db_bind_text(&cpyRoot, ":sep", "/"); | |
| 1316 | + }else{ | |
| 1317 | + db_bind_text(&cpyRoot, ":sep", ""); | |
| 1318 | + } | |
| 1314 | 1319 | db_bind_int(&cpyRoot, ":branch", branchId); |
| 1315 | 1320 | db_bind_int(&cpyRoot, ":rid", srcRid); |
| 1316 | 1321 | db_step(&cpyRoot); |
| 1317 | 1322 | db_reset(&cpyRoot); |
| 1318 | 1323 | }else{ |
| 1319 | 1324 | db_bind_text(&cpyPath, ":path", zFile); |
| 1325 | + if( zFile[0]!=0 ){ | |
| 1326 | + db_bind_text(&cpyPath, ":sep", "/"); | |
| 1327 | + }else{ | |
| 1328 | + db_bind_text(&cpyPath, ":sep", ""); | |
| 1329 | + } | |
| 1320 | 1330 | db_bind_int(&cpyPath, ":branch", branchId); |
| 1321 | 1331 | db_bind_text(&cpyPath, ":srcpath", zSrcFile); |
| 1322 | 1332 | db_bind_int(&cpyPath, ":rid", srcRid); |
| 1323 | 1333 | db_step(&cpyPath); |
| 1324 | 1334 | db_reset(&cpyPath); |
| 1325 | 1335 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1200,19 +1200,19 @@ | |
| 1200 | db_prepare(&addRev, |
| 1201 | "INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)" |
| 1202 | ); |
| 1203 | db_prepare(&cpyPath, |
| 1204 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1205 | " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm" |
| 1206 | " FROM xfoci" |
| 1207 | " WHERE checkinID=:rid" |
| 1208 | " AND filename>:srcpath||'/'" |
| 1209 | " AND filename<:srcpath||'0'" |
| 1210 | ); |
| 1211 | db_prepare(&cpyRoot, |
| 1212 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1213 | " SELECT :path||filename, :branch, uuid, perm" |
| 1214 | " FROM xfoci" |
| 1215 | " WHERE checkinID=:rid" |
| 1216 | ); |
| 1217 | db_prepare(&revSrc, |
| 1218 | "UPDATE xrevisions SET tparent=:parent" |
| @@ -1309,16 +1309,26 @@ | |
| 1309 | }else if( strncmp(zKind, "dir", 3)==0 ){ |
| 1310 | if( zSrcPath ){ |
| 1311 | if( srcRid>0 ){ |
| 1312 | if( zSrcFile[0]==0 ){ |
| 1313 | db_bind_text(&cpyRoot, ":path", zFile); |
| 1314 | db_bind_int(&cpyRoot, ":branch", branchId); |
| 1315 | db_bind_int(&cpyRoot, ":rid", srcRid); |
| 1316 | db_step(&cpyRoot); |
| 1317 | db_reset(&cpyRoot); |
| 1318 | }else{ |
| 1319 | db_bind_text(&cpyPath, ":path", zFile); |
| 1320 | db_bind_int(&cpyPath, ":branch", branchId); |
| 1321 | db_bind_text(&cpyPath, ":srcpath", zSrcFile); |
| 1322 | db_bind_int(&cpyPath, ":rid", srcRid); |
| 1323 | db_step(&cpyPath); |
| 1324 | db_reset(&cpyPath); |
| 1325 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1200,19 +1200,19 @@ | |
| 1200 | db_prepare(&addRev, |
| 1201 | "INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)" |
| 1202 | ); |
| 1203 | db_prepare(&cpyPath, |
| 1204 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1205 | " SELECT :path||:sep||substr(filename, length(:srcpath)+2), :branch, uuid, perm" |
| 1206 | " FROM xfoci" |
| 1207 | " WHERE checkinID=:rid" |
| 1208 | " AND filename>:srcpath||'/'" |
| 1209 | " AND filename<:srcpath||'0'" |
| 1210 | ); |
| 1211 | db_prepare(&cpyRoot, |
| 1212 | "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)" |
| 1213 | " SELECT :path||:sep||filename, :branch, uuid, perm" |
| 1214 | " FROM xfoci" |
| 1215 | " WHERE checkinID=:rid" |
| 1216 | ); |
| 1217 | db_prepare(&revSrc, |
| 1218 | "UPDATE xrevisions SET tparent=:parent" |
| @@ -1309,16 +1309,26 @@ | |
| 1309 | }else if( strncmp(zKind, "dir", 3)==0 ){ |
| 1310 | if( zSrcPath ){ |
| 1311 | if( srcRid>0 ){ |
| 1312 | if( zSrcFile[0]==0 ){ |
| 1313 | db_bind_text(&cpyRoot, ":path", zFile); |
| 1314 | if( zFile[0]!=0 ){ |
| 1315 | db_bind_text(&cpyRoot, ":sep", "/"); |
| 1316 | }else{ |
| 1317 | db_bind_text(&cpyRoot, ":sep", ""); |
| 1318 | } |
| 1319 | db_bind_int(&cpyRoot, ":branch", branchId); |
| 1320 | db_bind_int(&cpyRoot, ":rid", srcRid); |
| 1321 | db_step(&cpyRoot); |
| 1322 | db_reset(&cpyRoot); |
| 1323 | }else{ |
| 1324 | db_bind_text(&cpyPath, ":path", zFile); |
| 1325 | if( zFile[0]!=0 ){ |
| 1326 | db_bind_text(&cpyPath, ":sep", "/"); |
| 1327 | }else{ |
| 1328 | db_bind_text(&cpyPath, ":sep", ""); |
| 1329 | } |
| 1330 | db_bind_int(&cpyPath, ":branch", branchId); |
| 1331 | db_bind_text(&cpyPath, ":srcpath", zSrcFile); |
| 1332 | db_bind_int(&cpyPath, ":rid", srcRid); |
| 1333 | db_step(&cpyPath); |
| 1334 | db_reset(&cpyPath); |
| 1335 |