Fossil SCM

Improvements to "fossil import" to try to make it work better with breezy - based in part on suggestions in [forum:/info/be2aa46dcecf1802|forum post be2aa46dcecf1802].

drh 2020-11-13 14:49 trunk
Commit 806c6f60c44e0ed4818419aedd9bee1c3e289e62eea2a5ec65cdedcdfd95fc4e
1 file changed +11 -4
+11 -4
--- src/import.c
+++ src/import.c
@@ -287,11 +287,14 @@
287287
import_prior_files();
288288
qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
289289
blob_zero(&record);
290290
blob_appendf(&record, "C %F\n", gg.zComment);
291291
blob_appendf(&record, "D %s\n", gg.zDate);
292
- if( !g.fQuiet ) fossil_print("%.10s\r", gg.zDate);
292
+ if( !g.fQuiet ){
293
+ fossil_print("%.10s\r", gg.zDate);
294
+ fflush(stdout);
295
+ }
293296
for(i=0; i<gg.nFile; i++){
294297
const char *zUuid = gg.aFile[i].zUuid;
295298
if( zUuid==0 ) continue;
296299
blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
297300
if( gg.aFile[i].isExe ){
@@ -725,11 +728,11 @@
725728
pFile = import_find_file(zName, &i, gg.nFile);
726729
if( pFile==0 ){
727730
pFile = import_add_file();
728731
pFile->zName = fossil_strdup(zName);
729732
}
730
- pFile->isExe = (fossil_strcmp(zPerm, "100755")==0);
733
+ pFile->isExe = (sqlite3_strglob("*755",zPerm)==0);
731734
pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
732735
fossil_free(pFile->zUuid);
733736
if( strcmp(zUuid,"inline")==0 ){
734737
pFile->zUuid = 0;
735738
gg.pInlineFile = pFile;
@@ -765,11 +768,11 @@
765768
while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
766769
if( pFile->isFrom==0 ) continue;
767770
pNew = import_add_file();
768771
pFile = &gg.aFile[i-1];
769772
if( strlen(pFile->zName)>nFrom ){
770
- pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
773
+ pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
771774
}else{
772775
pNew->zName = fossil_strdup(zTo);
773776
}
774777
pNew->isExe = pFile->isExe;
775778
pNew->isLink = pFile->isLink;
@@ -788,11 +791,11 @@
788791
while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
789792
if( pFile->isFrom==0 ) continue;
790793
pNew = import_add_file();
791794
pFile = &gg.aFile[i-1];
792795
if( strlen(pFile->zName)>nFrom ){
793
- pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
796
+ pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
794797
}else{
795798
pNew->zName = fossil_strdup(zTo);
796799
}
797800
pNew->zPrior = pFile->zName;
798801
pNew->isExe = pFile->isExe;
@@ -816,10 +819,14 @@
816819
** user-readable branch name. */
817820
z = &zLine[21];
818821
next_token(&z);
819822
fossil_free(gg.zBranch);
820823
gg.zBranch = fossil_strdup(next_token(&z));
824
+ }else
825
+ if( strncmp(zLine, "property rebase-of ", 19)==0 ){
826
+ /* Breezy uses this property to record that a branch
827
+ ** was rebased. Silently ignore it. */
821828
}else
822829
{
823830
goto malformed_line;
824831
}
825832
}
826833
--- src/import.c
+++ src/import.c
@@ -287,11 +287,14 @@
287 import_prior_files();
288 qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
289 blob_zero(&record);
290 blob_appendf(&record, "C %F\n", gg.zComment);
291 blob_appendf(&record, "D %s\n", gg.zDate);
292 if( !g.fQuiet ) fossil_print("%.10s\r", gg.zDate);
 
 
 
293 for(i=0; i<gg.nFile; i++){
294 const char *zUuid = gg.aFile[i].zUuid;
295 if( zUuid==0 ) continue;
296 blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
297 if( gg.aFile[i].isExe ){
@@ -725,11 +728,11 @@
725 pFile = import_find_file(zName, &i, gg.nFile);
726 if( pFile==0 ){
727 pFile = import_add_file();
728 pFile->zName = fossil_strdup(zName);
729 }
730 pFile->isExe = (fossil_strcmp(zPerm, "100755")==0);
731 pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
732 fossil_free(pFile->zUuid);
733 if( strcmp(zUuid,"inline")==0 ){
734 pFile->zUuid = 0;
735 gg.pInlineFile = pFile;
@@ -765,11 +768,11 @@
765 while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
766 if( pFile->isFrom==0 ) continue;
767 pNew = import_add_file();
768 pFile = &gg.aFile[i-1];
769 if( strlen(pFile->zName)>nFrom ){
770 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
771 }else{
772 pNew->zName = fossil_strdup(zTo);
773 }
774 pNew->isExe = pFile->isExe;
775 pNew->isLink = pFile->isLink;
@@ -788,11 +791,11 @@
788 while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
789 if( pFile->isFrom==0 ) continue;
790 pNew = import_add_file();
791 pFile = &gg.aFile[i-1];
792 if( strlen(pFile->zName)>nFrom ){
793 pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
794 }else{
795 pNew->zName = fossil_strdup(zTo);
796 }
797 pNew->zPrior = pFile->zName;
798 pNew->isExe = pFile->isExe;
@@ -816,10 +819,14 @@
816 ** user-readable branch name. */
817 z = &zLine[21];
818 next_token(&z);
819 fossil_free(gg.zBranch);
820 gg.zBranch = fossil_strdup(next_token(&z));
 
 
 
 
821 }else
822 {
823 goto malformed_line;
824 }
825 }
826
--- src/import.c
+++ src/import.c
@@ -287,11 +287,14 @@
287 import_prior_files();
288 qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
289 blob_zero(&record);
290 blob_appendf(&record, "C %F\n", gg.zComment);
291 blob_appendf(&record, "D %s\n", gg.zDate);
292 if( !g.fQuiet ){
293 fossil_print("%.10s\r", gg.zDate);
294 fflush(stdout);
295 }
296 for(i=0; i<gg.nFile; i++){
297 const char *zUuid = gg.aFile[i].zUuid;
298 if( zUuid==0 ) continue;
299 blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
300 if( gg.aFile[i].isExe ){
@@ -725,11 +728,11 @@
728 pFile = import_find_file(zName, &i, gg.nFile);
729 if( pFile==0 ){
730 pFile = import_add_file();
731 pFile->zName = fossil_strdup(zName);
732 }
733 pFile->isExe = (sqlite3_strglob("*755",zPerm)==0);
734 pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
735 fossil_free(pFile->zUuid);
736 if( strcmp(zUuid,"inline")==0 ){
737 pFile->zUuid = 0;
738 gg.pInlineFile = pFile;
@@ -765,11 +768,11 @@
768 while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
769 if( pFile->isFrom==0 ) continue;
770 pNew = import_add_file();
771 pFile = &gg.aFile[i-1];
772 if( strlen(pFile->zName)>nFrom ){
773 pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
774 }else{
775 pNew->zName = fossil_strdup(zTo);
776 }
777 pNew->isExe = pFile->isExe;
778 pNew->isLink = pFile->isLink;
@@ -788,11 +791,11 @@
791 while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
792 if( pFile->isFrom==0 ) continue;
793 pNew = import_add_file();
794 pFile = &gg.aFile[i-1];
795 if( strlen(pFile->zName)>nFrom ){
796 pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
797 }else{
798 pNew->zName = fossil_strdup(zTo);
799 }
800 pNew->zPrior = pFile->zName;
801 pNew->isExe = pFile->isExe;
@@ -816,10 +819,14 @@
819 ** user-readable branch name. */
820 z = &zLine[21];
821 next_token(&z);
822 fossil_free(gg.zBranch);
823 gg.zBranch = fossil_strdup(next_token(&z));
824 }else
825 if( strncmp(zLine, "property rebase-of ", 19)==0 ){
826 /* Breezy uses this property to record that a branch
827 ** was rebased. Silently ignore it. */
828 }else
829 {
830 goto malformed_line;
831 }
832 }
833

Keyboard Shortcuts

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