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].
Commit
806c6f60c44e0ed4818419aedd9bee1c3e289e62eea2a5ec65cdedcdfd95fc4e
Parent
50eeced0489532f…
1 file changed
+11
-4
+11
-4
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -287,11 +287,14 @@ | ||
| 287 | 287 | import_prior_files(); |
| 288 | 288 | qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp); |
| 289 | 289 | blob_zero(&record); |
| 290 | 290 | blob_appendf(&record, "C %F\n", gg.zComment); |
| 291 | 291 | 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 | + } | |
| 293 | 296 | for(i=0; i<gg.nFile; i++){ |
| 294 | 297 | const char *zUuid = gg.aFile[i].zUuid; |
| 295 | 298 | if( zUuid==0 ) continue; |
| 296 | 299 | blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid); |
| 297 | 300 | if( gg.aFile[i].isExe ){ |
| @@ -725,11 +728,11 @@ | ||
| 725 | 728 | pFile = import_find_file(zName, &i, gg.nFile); |
| 726 | 729 | if( pFile==0 ){ |
| 727 | 730 | pFile = import_add_file(); |
| 728 | 731 | pFile->zName = fossil_strdup(zName); |
| 729 | 732 | } |
| 730 | - pFile->isExe = (fossil_strcmp(zPerm, "100755")==0); | |
| 733 | + pFile->isExe = (sqlite3_strglob("*755",zPerm)==0); | |
| 731 | 734 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 732 | 735 | fossil_free(pFile->zUuid); |
| 733 | 736 | if( strcmp(zUuid,"inline")==0 ){ |
| 734 | 737 | pFile->zUuid = 0; |
| 735 | 738 | gg.pInlineFile = pFile; |
| @@ -765,11 +768,11 @@ | ||
| 765 | 768 | while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){ |
| 766 | 769 | if( pFile->isFrom==0 ) continue; |
| 767 | 770 | pNew = import_add_file(); |
| 768 | 771 | pFile = &gg.aFile[i-1]; |
| 769 | 772 | 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); | |
| 771 | 774 | }else{ |
| 772 | 775 | pNew->zName = fossil_strdup(zTo); |
| 773 | 776 | } |
| 774 | 777 | pNew->isExe = pFile->isExe; |
| 775 | 778 | pNew->isLink = pFile->isLink; |
| @@ -788,11 +791,11 @@ | ||
| 788 | 791 | while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){ |
| 789 | 792 | if( pFile->isFrom==0 ) continue; |
| 790 | 793 | pNew = import_add_file(); |
| 791 | 794 | pFile = &gg.aFile[i-1]; |
| 792 | 795 | 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); | |
| 794 | 797 | }else{ |
| 795 | 798 | pNew->zName = fossil_strdup(zTo); |
| 796 | 799 | } |
| 797 | 800 | pNew->zPrior = pFile->zName; |
| 798 | 801 | pNew->isExe = pFile->isExe; |
| @@ -816,10 +819,14 @@ | ||
| 816 | 819 | ** user-readable branch name. */ |
| 817 | 820 | z = &zLine[21]; |
| 818 | 821 | next_token(&z); |
| 819 | 822 | fossil_free(gg.zBranch); |
| 820 | 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. */ | |
| 821 | 828 | }else |
| 822 | 829 | { |
| 823 | 830 | goto malformed_line; |
| 824 | 831 | } |
| 825 | 832 | } |
| 826 | 833 |
| --- 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 |