26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*
** A single file change record.
*/
struct ImportFile {
char *zName; /* Name of a file */
char *zUuid; /* UUID of the file */
char *zPrior; /* Prior name if the name was changed */
char isFrom; /* True if obtained from the parent */
char isExe; /* True if executable */
char isLink; /* True if symlink */
};
#endif
/*
|
<
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*
** A single file change record.
*/
struct ImportFile {
char *zName; /* Name of a file */
char *zUuid; /* UUID of the file */
char *zPrior; /* Prior name if the name was changed */
char isExe; /* True if executable */
char isLink; /* True if symlink */
};
#endif
/*
|
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
|
manifest_file_rewind(p);
while( (pOld = manifest_file_next(p, 0))!=0 ){
pNew = import_add_file();
pNew->zName = fossil_strdup(pOld->zName);
pNew->isExe = pOld->zPerm && strstr(pOld->zPerm, "x")!=0;
pNew->isLink = pOld->zPerm && strstr(pOld->zPerm, "l")!=0;
pNew->zUuid = fossil_strdup(pOld->zUuid);
pNew->isFrom = 1;
}
manifest_destroy(p);
}
/*
** Locate a file in the gg.aFile[] array by its name. Begin the search
** with the *pI-th file. Update *pI to be one past the file found.
|
<
|
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
manifest_file_rewind(p);
while( (pOld = manifest_file_next(p, 0))!=0 ){
pNew = import_add_file();
pNew->zName = fossil_strdup(pOld->zName);
pNew->isExe = pOld->zPerm && strstr(pOld->zPerm, "x")!=0;
pNew->isLink = pOld->zPerm && strstr(pOld->zPerm, "l")!=0;
pNew->zUuid = fossil_strdup(pOld->zUuid);
}
manifest_destroy(p);
}
/*
** Locate a file in the gg.aFile[] array by its name. Begin the search
** with the *pI-th file. Update *pI to be one past the file found.
|
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
|
pFile = import_add_file();
pFile->zName = fossil_strdup(zName);
}
pFile->isExe = (fossil_strcmp(zPerm, "100755")==0);
pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
fossil_free(pFile->zUuid);
pFile->zUuid = resolve_committish(zUuid);
pFile->isFrom = 0;
}else
if( memcmp(zLine, "D ", 2)==0 ){
import_prior_files();
z = &zLine[2];
zName = rest_of_line(&z);
dequote_git_filename(zName);
i = 0;
while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){
if( pFile->isFrom==0 ) continue;
fossil_free(pFile->zName);
fossil_free(pFile->zPrior);
pFile->zPrior = 0;
fossil_free(pFile->zUuid);
*pFile = gg.aFile[--gg.nFile];
i--;
}
}else
if( memcmp(zLine, "C ", 2)==0 ){
int nFrom;
import_prior_files();
z = &zLine[2];
zFrom = next_token(&z);
zTo = rest_of_line(&z);
i = 0;
mx = gg.nFile;
nFrom = strlen(zFrom);
while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
pNew = import_add_file();
pFile = &gg.aFile[i-1];
if( strlen(pFile->zName)>nFrom ){
pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
}else{
pNew->zName = fossil_strdup(zTo);
}
pNew->isExe = pFile->isExe;
pNew->isLink = pFile->isLink;
pNew->zUuid = fossil_strdup(pFile->zUuid);
pNew->isFrom = 0;
}
}else
if( memcmp(zLine, "R ", 2)==0 ){
import_prior_files();
z = &zLine[2];
zFrom = next_token(&z);
zTo = rest_of_line(&z);
i = 0;
while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
if( pFile->isFrom==0 ) continue;
pFile = &gg.aFile[i-1];
pFile->zPrior = pFile->zName;
pFile->zName = fossil_strdup(zTo);
pFile->isFrom = 0;
}
}else
if( memcmp(zLine, "deleteall", 9)==0 ){
gg.fromLoaded = 1;
}else
if( memcmp(zLine, "N ", 2)==0 ){
/* No-op */
|
<
|
|
<
<
|
>
<
<
|
|
<
<
|
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
pFile = import_add_file();
pFile->zName = fossil_strdup(zName);
}
pFile->isExe = (fossil_strcmp(zPerm, "100755")==0);
pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
fossil_free(pFile->zUuid);
pFile->zUuid = resolve_committish(zUuid);
}else
if( memcmp(zLine, "D ", 2)==0 ){
import_prior_files();
z = &zLine[2];
zName = rest_of_line(&z);
dequote_git_filename(zName);
i = 0;
pFile = import_find_file(zName, &i, gg.nFile);
if( pFile!=0 ){
fossil_free(pFile->zName);
fossil_free(pFile->zPrior);
pFile->zPrior = 0;
fossil_free(pFile->zUuid);
*pFile = gg.aFile[--gg.nFile];
}
}else
if( memcmp(zLine, "C ", 2)==0 ){
int nFrom;
import_prior_files();
z = &zLine[2];
zFrom = next_token(&z);
zTo = rest_of_line(&z);
i = 0;
nFrom = strlen(zFrom);
pFile = import_find_file(zFrom, &i, gg.nFile);
if( pFile!=0 ){
pNew = import_add_file();
if( strlen(pFile->zName)>nFrom ){
pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
}else{
pNew->zName = fossil_strdup(zTo);
}
pNew->isExe = pFile->isExe;
pNew->isLink = pFile->isLink;
pNew->zUuid = fossil_strdup(pFile->zUuid);
}
}else
if( memcmp(zLine, "R ", 2)==0 ){
import_prior_files();
z = &zLine[2];
zFrom = next_token(&z);
zTo = rest_of_line(&z);
i = 0;
pFile = import_find_file(zFrom, &i, gg.nFile);
if( pFile!=0 ){
pFile->zPrior = pFile->zName;
pFile->zName = fossil_strdup(zTo);
}
}else
if( memcmp(zLine, "deleteall", 9)==0 ){
gg.fromLoaded = 1;
}else
if( memcmp(zLine, "N ", 2)==0 ){
/* No-op */
|