Fossil

Check-in [806c6f60c4]
Login

Check-in [806c6f60c4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 806c6f60c44e0ed4818419aedd9bee1c3e289e62eea2a5ec65cdedcdfd95fc4e
User & Date: drh 2020-11-13 14:49:53.579
Context
2020-11-14
06:34
Add documentation for the new '--attribute' option introduced with check-in [cd4fbdee00], 'fx_git' repository database table that's created when it's used, and subsequent operational changes to 'git export' and incremental 'import --git' calls. ... (check-in: dd15d28d89 user: jamsek tags: trunk)
2020-11-13
14:49
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]. ... (check-in: 806c6f60c4 user: drh tags: trunk)
2020-11-12
22:42
Nearly complete rewrite of the "Caps Affect Web Interfaces Only" section of the caps/index.md doc, disentangling the concepts for greater clarity. ... (check-in: 50eeced048 user: wyoung tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/import.c.
285
286
287
288
289
290
291

292


293
294
295
296
297
298
299
  Blob record, cksum;

  import_prior_files();
  qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
  blob_zero(&record);
  blob_appendf(&record, "C %F\n", gg.zComment);
  blob_appendf(&record, "D %s\n", gg.zDate);

  if( !g.fQuiet ) fossil_print("%.10s\r", gg.zDate);


  for(i=0; i<gg.nFile; i++){
    const char *zUuid = gg.aFile[i].zUuid;
    if( zUuid==0 ) continue;
    blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
    if( gg.aFile[i].isExe ){
      blob_append(&record, " x\n", 3);
    }else if( gg.aFile[i].isLink ){







>
|
>
>







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
  Blob record, cksum;

  import_prior_files();
  qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
  blob_zero(&record);
  blob_appendf(&record, "C %F\n", gg.zComment);
  blob_appendf(&record, "D %s\n", gg.zDate);
  if( !g.fQuiet ){
    fossil_print("%.10s\r", gg.zDate);
    fflush(stdout);
  }
  for(i=0; i<gg.nFile; i++){
    const char *zUuid = gg.aFile[i].zUuid;
    if( zUuid==0 ) continue;
    blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
    if( gg.aFile[i].isExe ){
      blob_append(&record, " x\n", 3);
    }else if( gg.aFile[i].isLink ){
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
      dequote_git_filename(zName);
      i = 0;
      pFile = import_find_file(zName, &i, gg.nFile);
      if( pFile==0 ){
        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);
      if( strcmp(zUuid,"inline")==0 ){
        pFile->zUuid = 0;
        gg.pInlineFile = pFile;
      }else{
        pFile->zUuid = resolve_committish(zUuid);







|







726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
      dequote_git_filename(zName);
      i = 0;
      pFile = import_find_file(zName, &i, gg.nFile);
      if( pFile==0 ){
        pFile = import_add_file();
        pFile->zName = fossil_strdup(zName);
      }
      pFile->isExe = (sqlite3_strglob("*755",zPerm)==0);
      pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
      fossil_free(pFile->zUuid);
      if( strcmp(zUuid,"inline")==0 ){
        pFile->zUuid = 0;
        gg.pInlineFile = pFile;
      }else{
        pFile->zUuid = resolve_committish(zUuid);
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
      mx = gg.nFile;
      nFrom = strlen(zFrom);
      while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
        if( pFile->isFrom==0 ) continue;
        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;







|







766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
      mx = gg.nFile;
      nFrom = strlen(zFrom);
      while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
        if( pFile->isFrom==0 ) continue;
        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;
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
      i = 0;
      nFrom = strlen(zFrom);
      while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
        if( pFile->isFrom==0 ) continue;
        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->zPrior = pFile->zName;
        pNew->isExe = pFile->isExe;
        pNew->isLink = pFile->isLink;
        pNew->zUuid = pFile->zUuid;







|







789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
      i = 0;
      nFrom = strlen(zFrom);
      while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
        if( pFile->isFrom==0 ) continue;
        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->zPrior = pFile->zName;
        pNew->isExe = pFile->isExe;
        pNew->isLink = pFile->isLink;
        pNew->zUuid = pFile->zUuid;
814
815
816
817
818
819
820




821
822
823
824
825
826
827
      /* Breezy uses this property to store the branch name.
      ** It has two values. Integer branch number, then the 
      ** user-readable branch name. */
      z = &zLine[21];
      next_token(&z);
      fossil_free(gg.zBranch);
      gg.zBranch = fossil_strdup(next_token(&z));




    }else
    {
      goto malformed_line;
    }
  }
  gg.xFinish();
  import_reset(1);







>
>
>
>







817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
      /* Breezy uses this property to store the branch name.
      ** It has two values. Integer branch number, then the 
      ** user-readable branch name. */
      z = &zLine[21];
      next_token(&z);
      fossil_free(gg.zBranch);
      gg.zBranch = fossil_strdup(next_token(&z));
    }else
    if( strncmp(zLine, "property rebase-of ", 19)==0 ){
      /* Breezy uses this property to record that a branch
      ** was rebased.  Silently ignore it. */
    }else
    {
      goto malformed_line;
    }
  }
  gg.xFinish();
  import_reset(1);