Fossil SCM

Fix the "fossil import" command so that it correctly handles cases where a file is deleted then replaced by a directory with the same name.

drh 2010-11-11 13:36 trunk
Commit e5a734a19a9826973e1d073b49dc2a16aa2308f9
2 files changed +42 -21 +5
+42 -21
--- src/import.c
+++ src/import.c
@@ -19,10 +19,24 @@
1919
** repository.
2020
*/
2121
#include "config.h"
2222
#include "import.h"
2323
#include <assert.h>
24
+
25
+#if INTERFACE
26
+/*
27
+** A single file change record.
28
+*/
29
+struct ImportFile {
30
+ char *zName; /* Name of a file */
31
+ char *zUuid; /* UUID of the file */
32
+ char *zPrior; /* Prior name if the name was changed */
33
+ char isFrom; /* True if obtained from the parent */
34
+ char isExe; /* True if executable */
35
+};
36
+#endif
37
+
2438
2539
/*
2640
** State information about an on-going fast-import parse.
2741
*/
2842
static struct {
@@ -40,11 +54,11 @@
4054
int nMerge; /* Number of merge values */
4155
int nMergeAlloc; /* Number of slots in azMerge[] */
4256
char **azMerge; /* Merge values */
4357
int nFile; /* Number of aFile values */
4458
int nFileAlloc; /* Number of slots in aFile[] */
45
- ManifestFile *aFile; /* Information about files in a commit */
59
+ ImportFile *aFile; /* Information about files in a commit */
4660
int fromLoaded; /* True zFrom content loaded into aFile[] */
4761
} gg;
4862
4963
/*
5064
** A no-op "xFinish" method
@@ -74,11 +88,10 @@
7488
}
7589
gg.nMerge = 0;
7690
for(i=0; i<gg.nFile; i++){
7791
fossil_free(gg.aFile[i].zName);
7892
fossil_free(gg.aFile[i].zUuid);
79
- fossil_free(gg.aFile[i].zPerm);
8093
fossil_free(gg.aFile[i].zPrior);
8194
}
8295
memset(gg.aFile, 0, gg.nFile*sizeof(gg.aFile[0]));
8396
gg.nFile = 0;
8497
if( freeAll ){
@@ -165,15 +178,15 @@
165178
}
166179
import_reset(0);
167180
}
168181
169182
/*
170
-** Compare two ManifestFile objects for sorting
183
+** Compare two ImportFile objects for sorting
171184
*/
172185
static int mfile_cmp(const void *pLeft, const void *pRight){
173
- const ManifestFile *pA = (const ManifestFile*)pLeft;
174
- const ManifestFile *pB = (const ManifestFile*)pRight;
186
+ const ImportFile *pA = (const ImportFile*)pLeft;
187
+ const ImportFile *pB = (const ImportFile*)pRight;
175188
return strcmp(pA->zName, pB->zName);
176189
}
177190
178191
/*
179192
** Use data accumulated in gg from a "commit" record to add a new
@@ -187,12 +200,12 @@
187200
blob_zero(&record);
188201
blob_appendf(&record, "C %F\n", gg.zComment);
189202
blob_appendf(&record, "D %s\n", gg.zDate);
190203
for(i=0; i<gg.nFile; i++){
191204
blob_appendf(&record, "F %F %s", gg.aFile[i].zName, gg.aFile[i].zUuid);
192
- if( gg.aFile[i].zPerm && gg.aFile[i].zPerm[0] ){
193
- blob_appendf(&record, " %s\n", gg.aFile[i].zPerm);
205
+ if( gg.aFile[i].isExe ){
206
+ blob_append(&record, " x\n", 3);
194207
}else{
195208
blob_append(&record, "\n", 1);
196209
}
197210
}
198211
if( gg.zFrom ){
@@ -211,10 +224,11 @@
211224
blob_appendf(&record, "T *sym-%F *\n", gg.zBranch);
212225
if( zFromBranch ){
213226
blob_appendf(&record, "T -sym-%F *\n", zFromBranch);
214227
}
215228
}
229
+ free(zFromBranch);
216230
if( gg.zFrom==0 ){
217231
blob_appendf(&record, "T +sym-trunk *\n");
218232
}
219233
db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
220234
gg.zMark, gg.zBranch);
@@ -280,12 +294,12 @@
280294
}
281295
282296
/*
283297
** Create a new entry in the gg.aFile[] array
284298
*/
285
-static ManifestFile *import_add_file(void){
286
- ManifestFile *pFile;
299
+static ImportFile *import_add_file(void){
300
+ ImportFile *pFile;
287301
if( gg.nFile>=gg.nFileAlloc ){
288302
gg.nFileAlloc = gg.nFileAlloc*2 + 100;
289303
gg.aFile = fossil_realloc(gg.aFile, gg.nFileAlloc*sizeof(gg.aFile[0]));
290304
}
291305
pFile = &gg.aFile[gg.nFile++];
@@ -298,11 +312,12 @@
298312
** Load all file information out of the gg.zFrom check-in
299313
*/
300314
static void import_prior_files(void){
301315
Manifest *p;
302316
int rid;
303
- ManifestFile *pOld, *pNew;
317
+ ManifestFile *pOld;
318
+ ImportFile *pNew;
304319
if( gg.fromLoaded ) return;
305320
gg.fromLoaded = 1;
306321
if( gg.zFrom==0 ) return;
307322
rid = fast_uuid_to_rid(gg.zFrom);
308323
if( rid==0 ) return;
@@ -310,22 +325,23 @@
310325
if( p==0 ) return;
311326
manifest_file_rewind(p);
312327
while( (pOld = manifest_file_next(p, 0))!=0 ){
313328
pNew = import_add_file();
314329
pNew->zName = import_strdup(pOld->zName);
315
- pNew->zPerm = import_strdup(pOld->zPerm);
330
+ pNew->isExe = pOld->zPerm && strstr(pOld->zPerm, "x")!=0;
316331
pNew->zUuid = import_strdup(pOld->zUuid);
332
+ pNew->isFrom = 1;
317333
}
318334
manifest_destroy(p);
319335
}
320336
321337
/*
322338
** Locate a file in the gg.aFile[] array by its name. Begin the search
323339
** with the *pI-th file. Update *pI to be one past the file found.
324340
** Do not search past the mx-th file.
325341
*/
326
-static ManifestFile *import_find_file(const char *zName, int *pI, int mx){
342
+static ImportFile *import_find_file(const char *zName, int *pI, int mx){
327343
int i = *pI;
328344
int nName = strlen(zName);
329345
while( i<mx ){
330346
const char *z = gg.aFile[i].zName;
331347
if( memcmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){
@@ -341,11 +357,11 @@
341357
/*
342358
** Read the git-fast-import format from pIn and insert the corresponding
343359
** content into the database.
344360
*/
345361
static void git_fast_import(FILE *pIn){
346
- ManifestFile *pFile;
362
+ ImportFile *pFile, *pNew;
347363
int i, mx;
348364
char *z;
349365
char *zUuid;
350366
char *zName;
351367
char *zPerm;
@@ -464,23 +480,24 @@
464480
pFile = import_find_file(zName, &i, gg.nFile);
465481
if( pFile==0 ){
466482
pFile = import_add_file();
467483
pFile->zName = import_strdup(zName);
468484
}
469
- if( strcmp(zPerm, "100755")==0 ){
470
- pFile->zPerm = mprintf("x");
471
- }
485
+ pFile->isExe = (strcmp(zPerm, "100755")==0);
486
+ fossil_free(pFile->zUuid);
472487
pFile->zUuid = resolve_committish(zUuid);
488
+ pFile->isFrom = 0;
473489
}else
474490
if( memcmp(zLine, "D ", 2)==0 ){
475491
import_prior_files();
476492
z = &zLine[2];
477493
zName = next_token(&z);
478494
i = 0;
479495
while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){
496
+ if( pFile->isFrom==0 ) continue;
480497
fossil_free(pFile->zName);
481
- fossil_free(pFile->zPerm);
498
+ fossil_free(pFile->zPrior);
482499
fossil_free(pFile->zUuid);
483500
*pFile = gg.aFile[--gg.nFile];
484501
i--;
485502
}
486503
}else
@@ -492,19 +509,21 @@
492509
zTo = next_token(&z);
493510
i = 0;
494511
mx = gg.nFile;
495512
nFrom = strlen(zFrom);
496513
while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
497
- ManifestFile *pNew = import_add_file();
514
+ if( pFile->isFrom==0 ) continue;
515
+ pNew = import_add_file();
498516
pFile = &gg.aFile[i-1];
499517
if( strlen(pFile->zName)>nFrom ){
500518
pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
501519
}else{
502520
pNew->zName = import_strdup(pFile->zName);
503521
}
504
- pNew->zPerm = import_strdup(pFile->zPerm);
522
+ pNew->isExe = pFile->isExe;
505523
pNew->zUuid = import_strdup(pFile->zUuid);
524
+ pNew->isFrom = 0;
506525
}
507526
}else
508527
if( memcmp(zLine, "R ", 2)==0 ){
509528
int nFrom;
510529
import_prior_files();
@@ -512,20 +531,22 @@
512531
zFrom = next_token(&z);
513532
zTo = next_token(&z);
514533
i = 0;
515534
nFrom = strlen(zFrom);
516535
while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
517
- ManifestFile *pNew = import_add_file();
536
+ if( pFile->isFrom==0 ) continue;
537
+ pNew = import_add_file();
518538
pFile = &gg.aFile[i-1];
519539
if( strlen(pFile->zName)>nFrom ){
520540
pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
521541
}else{
522542
pNew->zName = import_strdup(pFile->zName);
523543
}
524544
pNew->zPrior = pFile->zName;
525
- pNew->zPerm = pFile->zPerm;
545
+ pNew->isExe = pFile->isExe;
526546
pNew->zUuid = pFile->zUuid;
547
+ pNew->isFrom = 0;
527548
gg.nFile--;
528549
*pFile = *pNew;
529550
memset(pNew, 0, sizeof(*pNew));
530551
}
531552
fossil_fatal("cannot handle R records, use --full-tree");
532553
--- src/import.c
+++ src/import.c
@@ -19,10 +19,24 @@
19 ** repository.
20 */
21 #include "config.h"
22 #include "import.h"
23 #include <assert.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
25 /*
26 ** State information about an on-going fast-import parse.
27 */
28 static struct {
@@ -40,11 +54,11 @@
40 int nMerge; /* Number of merge values */
41 int nMergeAlloc; /* Number of slots in azMerge[] */
42 char **azMerge; /* Merge values */
43 int nFile; /* Number of aFile values */
44 int nFileAlloc; /* Number of slots in aFile[] */
45 ManifestFile *aFile; /* Information about files in a commit */
46 int fromLoaded; /* True zFrom content loaded into aFile[] */
47 } gg;
48
49 /*
50 ** A no-op "xFinish" method
@@ -74,11 +88,10 @@
74 }
75 gg.nMerge = 0;
76 for(i=0; i<gg.nFile; i++){
77 fossil_free(gg.aFile[i].zName);
78 fossil_free(gg.aFile[i].zUuid);
79 fossil_free(gg.aFile[i].zPerm);
80 fossil_free(gg.aFile[i].zPrior);
81 }
82 memset(gg.aFile, 0, gg.nFile*sizeof(gg.aFile[0]));
83 gg.nFile = 0;
84 if( freeAll ){
@@ -165,15 +178,15 @@
165 }
166 import_reset(0);
167 }
168
169 /*
170 ** Compare two ManifestFile objects for sorting
171 */
172 static int mfile_cmp(const void *pLeft, const void *pRight){
173 const ManifestFile *pA = (const ManifestFile*)pLeft;
174 const ManifestFile *pB = (const ManifestFile*)pRight;
175 return strcmp(pA->zName, pB->zName);
176 }
177
178 /*
179 ** Use data accumulated in gg from a "commit" record to add a new
@@ -187,12 +200,12 @@
187 blob_zero(&record);
188 blob_appendf(&record, "C %F\n", gg.zComment);
189 blob_appendf(&record, "D %s\n", gg.zDate);
190 for(i=0; i<gg.nFile; i++){
191 blob_appendf(&record, "F %F %s", gg.aFile[i].zName, gg.aFile[i].zUuid);
192 if( gg.aFile[i].zPerm && gg.aFile[i].zPerm[0] ){
193 blob_appendf(&record, " %s\n", gg.aFile[i].zPerm);
194 }else{
195 blob_append(&record, "\n", 1);
196 }
197 }
198 if( gg.zFrom ){
@@ -211,10 +224,11 @@
211 blob_appendf(&record, "T *sym-%F *\n", gg.zBranch);
212 if( zFromBranch ){
213 blob_appendf(&record, "T -sym-%F *\n", zFromBranch);
214 }
215 }
 
216 if( gg.zFrom==0 ){
217 blob_appendf(&record, "T +sym-trunk *\n");
218 }
219 db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
220 gg.zMark, gg.zBranch);
@@ -280,12 +294,12 @@
280 }
281
282 /*
283 ** Create a new entry in the gg.aFile[] array
284 */
285 static ManifestFile *import_add_file(void){
286 ManifestFile *pFile;
287 if( gg.nFile>=gg.nFileAlloc ){
288 gg.nFileAlloc = gg.nFileAlloc*2 + 100;
289 gg.aFile = fossil_realloc(gg.aFile, gg.nFileAlloc*sizeof(gg.aFile[0]));
290 }
291 pFile = &gg.aFile[gg.nFile++];
@@ -298,11 +312,12 @@
298 ** Load all file information out of the gg.zFrom check-in
299 */
300 static void import_prior_files(void){
301 Manifest *p;
302 int rid;
303 ManifestFile *pOld, *pNew;
 
304 if( gg.fromLoaded ) return;
305 gg.fromLoaded = 1;
306 if( gg.zFrom==0 ) return;
307 rid = fast_uuid_to_rid(gg.zFrom);
308 if( rid==0 ) return;
@@ -310,22 +325,23 @@
310 if( p==0 ) return;
311 manifest_file_rewind(p);
312 while( (pOld = manifest_file_next(p, 0))!=0 ){
313 pNew = import_add_file();
314 pNew->zName = import_strdup(pOld->zName);
315 pNew->zPerm = import_strdup(pOld->zPerm);
316 pNew->zUuid = import_strdup(pOld->zUuid);
 
317 }
318 manifest_destroy(p);
319 }
320
321 /*
322 ** Locate a file in the gg.aFile[] array by its name. Begin the search
323 ** with the *pI-th file. Update *pI to be one past the file found.
324 ** Do not search past the mx-th file.
325 */
326 static ManifestFile *import_find_file(const char *zName, int *pI, int mx){
327 int i = *pI;
328 int nName = strlen(zName);
329 while( i<mx ){
330 const char *z = gg.aFile[i].zName;
331 if( memcmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){
@@ -341,11 +357,11 @@
341 /*
342 ** Read the git-fast-import format from pIn and insert the corresponding
343 ** content into the database.
344 */
345 static void git_fast_import(FILE *pIn){
346 ManifestFile *pFile;
347 int i, mx;
348 char *z;
349 char *zUuid;
350 char *zName;
351 char *zPerm;
@@ -464,23 +480,24 @@
464 pFile = import_find_file(zName, &i, gg.nFile);
465 if( pFile==0 ){
466 pFile = import_add_file();
467 pFile->zName = import_strdup(zName);
468 }
469 if( strcmp(zPerm, "100755")==0 ){
470 pFile->zPerm = mprintf("x");
471 }
472 pFile->zUuid = resolve_committish(zUuid);
 
473 }else
474 if( memcmp(zLine, "D ", 2)==0 ){
475 import_prior_files();
476 z = &zLine[2];
477 zName = next_token(&z);
478 i = 0;
479 while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){
 
480 fossil_free(pFile->zName);
481 fossil_free(pFile->zPerm);
482 fossil_free(pFile->zUuid);
483 *pFile = gg.aFile[--gg.nFile];
484 i--;
485 }
486 }else
@@ -492,19 +509,21 @@
492 zTo = next_token(&z);
493 i = 0;
494 mx = gg.nFile;
495 nFrom = strlen(zFrom);
496 while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
497 ManifestFile *pNew = import_add_file();
 
498 pFile = &gg.aFile[i-1];
499 if( strlen(pFile->zName)>nFrom ){
500 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
501 }else{
502 pNew->zName = import_strdup(pFile->zName);
503 }
504 pNew->zPerm = import_strdup(pFile->zPerm);
505 pNew->zUuid = import_strdup(pFile->zUuid);
 
506 }
507 }else
508 if( memcmp(zLine, "R ", 2)==0 ){
509 int nFrom;
510 import_prior_files();
@@ -512,20 +531,22 @@
512 zFrom = next_token(&z);
513 zTo = next_token(&z);
514 i = 0;
515 nFrom = strlen(zFrom);
516 while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
517 ManifestFile *pNew = import_add_file();
 
518 pFile = &gg.aFile[i-1];
519 if( strlen(pFile->zName)>nFrom ){
520 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
521 }else{
522 pNew->zName = import_strdup(pFile->zName);
523 }
524 pNew->zPrior = pFile->zName;
525 pNew->zPerm = pFile->zPerm;
526 pNew->zUuid = pFile->zUuid;
 
527 gg.nFile--;
528 *pFile = *pNew;
529 memset(pNew, 0, sizeof(*pNew));
530 }
531 fossil_fatal("cannot handle R records, use --full-tree");
532
--- src/import.c
+++ src/import.c
@@ -19,10 +19,24 @@
19 ** repository.
20 */
21 #include "config.h"
22 #include "import.h"
23 #include <assert.h>
24
25 #if INTERFACE
26 /*
27 ** A single file change record.
28 */
29 struct ImportFile {
30 char *zName; /* Name of a file */
31 char *zUuid; /* UUID of the file */
32 char *zPrior; /* Prior name if the name was changed */
33 char isFrom; /* True if obtained from the parent */
34 char isExe; /* True if executable */
35 };
36 #endif
37
38
39 /*
40 ** State information about an on-going fast-import parse.
41 */
42 static struct {
@@ -40,11 +54,11 @@
54 int nMerge; /* Number of merge values */
55 int nMergeAlloc; /* Number of slots in azMerge[] */
56 char **azMerge; /* Merge values */
57 int nFile; /* Number of aFile values */
58 int nFileAlloc; /* Number of slots in aFile[] */
59 ImportFile *aFile; /* Information about files in a commit */
60 int fromLoaded; /* True zFrom content loaded into aFile[] */
61 } gg;
62
63 /*
64 ** A no-op "xFinish" method
@@ -74,11 +88,10 @@
88 }
89 gg.nMerge = 0;
90 for(i=0; i<gg.nFile; i++){
91 fossil_free(gg.aFile[i].zName);
92 fossil_free(gg.aFile[i].zUuid);
 
93 fossil_free(gg.aFile[i].zPrior);
94 }
95 memset(gg.aFile, 0, gg.nFile*sizeof(gg.aFile[0]));
96 gg.nFile = 0;
97 if( freeAll ){
@@ -165,15 +178,15 @@
178 }
179 import_reset(0);
180 }
181
182 /*
183 ** Compare two ImportFile objects for sorting
184 */
185 static int mfile_cmp(const void *pLeft, const void *pRight){
186 const ImportFile *pA = (const ImportFile*)pLeft;
187 const ImportFile *pB = (const ImportFile*)pRight;
188 return strcmp(pA->zName, pB->zName);
189 }
190
191 /*
192 ** Use data accumulated in gg from a "commit" record to add a new
@@ -187,12 +200,12 @@
200 blob_zero(&record);
201 blob_appendf(&record, "C %F\n", gg.zComment);
202 blob_appendf(&record, "D %s\n", gg.zDate);
203 for(i=0; i<gg.nFile; i++){
204 blob_appendf(&record, "F %F %s", gg.aFile[i].zName, gg.aFile[i].zUuid);
205 if( gg.aFile[i].isExe ){
206 blob_append(&record, " x\n", 3);
207 }else{
208 blob_append(&record, "\n", 1);
209 }
210 }
211 if( gg.zFrom ){
@@ -211,10 +224,11 @@
224 blob_appendf(&record, "T *sym-%F *\n", gg.zBranch);
225 if( zFromBranch ){
226 blob_appendf(&record, "T -sym-%F *\n", zFromBranch);
227 }
228 }
229 free(zFromBranch);
230 if( gg.zFrom==0 ){
231 blob_appendf(&record, "T +sym-trunk *\n");
232 }
233 db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
234 gg.zMark, gg.zBranch);
@@ -280,12 +294,12 @@
294 }
295
296 /*
297 ** Create a new entry in the gg.aFile[] array
298 */
299 static ImportFile *import_add_file(void){
300 ImportFile *pFile;
301 if( gg.nFile>=gg.nFileAlloc ){
302 gg.nFileAlloc = gg.nFileAlloc*2 + 100;
303 gg.aFile = fossil_realloc(gg.aFile, gg.nFileAlloc*sizeof(gg.aFile[0]));
304 }
305 pFile = &gg.aFile[gg.nFile++];
@@ -298,11 +312,12 @@
312 ** Load all file information out of the gg.zFrom check-in
313 */
314 static void import_prior_files(void){
315 Manifest *p;
316 int rid;
317 ManifestFile *pOld;
318 ImportFile *pNew;
319 if( gg.fromLoaded ) return;
320 gg.fromLoaded = 1;
321 if( gg.zFrom==0 ) return;
322 rid = fast_uuid_to_rid(gg.zFrom);
323 if( rid==0 ) return;
@@ -310,22 +325,23 @@
325 if( p==0 ) return;
326 manifest_file_rewind(p);
327 while( (pOld = manifest_file_next(p, 0))!=0 ){
328 pNew = import_add_file();
329 pNew->zName = import_strdup(pOld->zName);
330 pNew->isExe = pOld->zPerm && strstr(pOld->zPerm, "x")!=0;
331 pNew->zUuid = import_strdup(pOld->zUuid);
332 pNew->isFrom = 1;
333 }
334 manifest_destroy(p);
335 }
336
337 /*
338 ** Locate a file in the gg.aFile[] array by its name. Begin the search
339 ** with the *pI-th file. Update *pI to be one past the file found.
340 ** Do not search past the mx-th file.
341 */
342 static ImportFile *import_find_file(const char *zName, int *pI, int mx){
343 int i = *pI;
344 int nName = strlen(zName);
345 while( i<mx ){
346 const char *z = gg.aFile[i].zName;
347 if( memcmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){
@@ -341,11 +357,11 @@
357 /*
358 ** Read the git-fast-import format from pIn and insert the corresponding
359 ** content into the database.
360 */
361 static void git_fast_import(FILE *pIn){
362 ImportFile *pFile, *pNew;
363 int i, mx;
364 char *z;
365 char *zUuid;
366 char *zName;
367 char *zPerm;
@@ -464,23 +480,24 @@
480 pFile = import_find_file(zName, &i, gg.nFile);
481 if( pFile==0 ){
482 pFile = import_add_file();
483 pFile->zName = import_strdup(zName);
484 }
485 pFile->isExe = (strcmp(zPerm, "100755")==0);
486 fossil_free(pFile->zUuid);
 
487 pFile->zUuid = resolve_committish(zUuid);
488 pFile->isFrom = 0;
489 }else
490 if( memcmp(zLine, "D ", 2)==0 ){
491 import_prior_files();
492 z = &zLine[2];
493 zName = next_token(&z);
494 i = 0;
495 while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){
496 if( pFile->isFrom==0 ) continue;
497 fossil_free(pFile->zName);
498 fossil_free(pFile->zPrior);
499 fossil_free(pFile->zUuid);
500 *pFile = gg.aFile[--gg.nFile];
501 i--;
502 }
503 }else
@@ -492,19 +509,21 @@
509 zTo = next_token(&z);
510 i = 0;
511 mx = gg.nFile;
512 nFrom = strlen(zFrom);
513 while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
514 if( pFile->isFrom==0 ) continue;
515 pNew = import_add_file();
516 pFile = &gg.aFile[i-1];
517 if( strlen(pFile->zName)>nFrom ){
518 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
519 }else{
520 pNew->zName = import_strdup(pFile->zName);
521 }
522 pNew->isExe = pFile->isExe;
523 pNew->zUuid = import_strdup(pFile->zUuid);
524 pNew->isFrom = 0;
525 }
526 }else
527 if( memcmp(zLine, "R ", 2)==0 ){
528 int nFrom;
529 import_prior_files();
@@ -512,20 +531,22 @@
531 zFrom = next_token(&z);
532 zTo = next_token(&z);
533 i = 0;
534 nFrom = strlen(zFrom);
535 while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
536 if( pFile->isFrom==0 ) continue;
537 pNew = import_add_file();
538 pFile = &gg.aFile[i-1];
539 if( strlen(pFile->zName)>nFrom ){
540 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
541 }else{
542 pNew->zName = import_strdup(pFile->zName);
543 }
544 pNew->zPrior = pFile->zName;
545 pNew->isExe = pFile->isExe;
546 pNew->zUuid = pFile->zUuid;
547 pNew->isFrom = 0;
548 gg.nFile--;
549 *pFile = *pNew;
550 memset(pNew, 0, sizeof(*pNew));
551 }
552 fossil_fatal("cannot handle R records, use --full-tree");
553
--- src/manifest.c
+++ src/manifest.c
@@ -1472,10 +1472,15 @@
14721472
while( db_step(&q)==SQLITE_ROW ){
14731473
int cid = db_column_int(&q, 0);
14741474
add_mlink(rid, p, cid, 0);
14751475
}
14761476
db_finalize(&q);
1477
+ if( p->nParent==0 ){
1478
+ for(i=0; i<p->nFile; i++){
1479
+ add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0);
1480
+ }
1481
+ }
14771482
db_multi_exec(
14781483
"REPLACE INTO event(type,mtime,objid,user,comment,"
14791484
"bgcolor,euser,ecomment)"
14801485
"VALUES('ci',"
14811486
" coalesce("
14821487
--- src/manifest.c
+++ src/manifest.c
@@ -1472,10 +1472,15 @@
1472 while( db_step(&q)==SQLITE_ROW ){
1473 int cid = db_column_int(&q, 0);
1474 add_mlink(rid, p, cid, 0);
1475 }
1476 db_finalize(&q);
 
 
 
 
 
1477 db_multi_exec(
1478 "REPLACE INTO event(type,mtime,objid,user,comment,"
1479 "bgcolor,euser,ecomment)"
1480 "VALUES('ci',"
1481 " coalesce("
1482
--- src/manifest.c
+++ src/manifest.c
@@ -1472,10 +1472,15 @@
1472 while( db_step(&q)==SQLITE_ROW ){
1473 int cid = db_column_int(&q, 0);
1474 add_mlink(rid, p, cid, 0);
1475 }
1476 db_finalize(&q);
1477 if( p->nParent==0 ){
1478 for(i=0; i<p->nFile; i++){
1479 add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0);
1480 }
1481 }
1482 db_multi_exec(
1483 "REPLACE INTO event(type,mtime,objid,user,comment,"
1484 "bgcolor,euser,ecomment)"
1485 "VALUES('ci',"
1486 " coalesce("
1487

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button