Fossil

Check-in [05b152ae]
Login

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

Overview
Comment:Fix bugs in the handling of deleted and added files on delta manifests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: 05b152aedfe742089d44ad387a83774bbbd5e63c
User & Date: drh 2010-10-25 17:21:20
Context
2010-10-25
20:10
Remove an processing-order dependency from the rebuild command. check-in: 3770d89f user: drh tags: experimental
17:21
Fix bugs in the handling of deleted and added files on delta manifests. check-in: 05b152ae user: drh tags: experimental
13:52
Redesign the control-artifact and manifest parser to run faster. check-in: fa0ea2c3 user: drh tags: experimental
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

632
633
634
635
636
637
638





639
640
641
642
643
644
645
      }
      nFBcard++;
    }
    if( cmp==0 ) pFile = manifest_file_next(pBaseline,0);
  }
  blob_reset(&filename);
  db_finalize(&q);





  blob_appendf(pOut, "P %s", zParentUuid);
  if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate);
  free(zParentUuid);
  db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=:id");
  db_bind_int(&q2, ":id", 0);
  while( db_step(&q2)==SQLITE_ROW ){
    char *zMergeUuid;







>
>
>
>
>







632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
      }
      nFBcard++;
    }
    if( cmp==0 ) pFile = manifest_file_next(pBaseline,0);
  }
  blob_reset(&filename);
  db_finalize(&q);
  while( pFile ){
    blob_appendf(pOut, "F %F\n", pFile->zName);
    pFile = manifest_file_next(pBaseline, 0);
    nFBcard++;
  }
  blob_appendf(pOut, "P %s", zParentUuid);
  if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate);
  free(zParentUuid);
  db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=:id");
  db_bind_int(&q2, ":id", 0);
  while( db_step(&q2)==SQLITE_ROW ){
    char *zMergeUuid;

Changes to src/manifest.c.

1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131














1132
1133
1134
1135
1136
1137
1138
....
1179
1180
1181
1182
1183
1184
1185

1186

1187
1188
1189
1190
1191









1192
1193
1194
1195
1196
1197
1198
**
** We assume that filenames are in sorted order and use a binary search.
*/
ManifestFile *manifest_file_seek(Manifest *p, const char *zName){
  ManifestFile *pFile;
  
  pFile = manifest_file_seek_base(p, zName);
  if( pFile && pFile->zUuid[0]==0 ) return 0;
  if( pFile==0 && p->zBaseline ){
    fetch_baseline(p);
    pFile = manifest_file_seek_base(p->pBaseline, zName);
  }
  return pFile;
}















/*
** Add mlink table entries associated with manifest cid.  The
** parent manifest is pid.
**
** A single mlink entry is added for every file that changed content
** and/or name going from pid to cid.
................................................................................
       if( pParentFile ){
         add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
                       pChildFile->zName, pChildFile->zPrior);
       }
    }else{
       pParentFile = manifest_file_seek(pParent, pChildFile->zName);
       if( pParentFile==0 ){

         add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0);

       }else if( strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0 ){
         add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
                       pChildFile->zName, 0);
       }
    }









  }
  manifest_cache_insert(*ppOther);
}

/*
** True if manifest_crosslink_begin() has been called but
** manifest_crosslink_end() is still pending.







|






>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
|
>
|




>
>
>
>
>
>
>
>
>







1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
....
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
**
** We assume that filenames are in sorted order and use a binary search.
*/
ManifestFile *manifest_file_seek(Manifest *p, const char *zName){
  ManifestFile *pFile;
  
  pFile = manifest_file_seek_base(p, zName);
  if( pFile && pFile->zUuid==0 ) return 0;
  if( pFile==0 && p->zBaseline ){
    fetch_baseline(p);
    pFile = manifest_file_seek_base(p->pBaseline, zName);
  }
  return pFile;
}

/*
** This strcmp() function handles NULL arguments.  NULLs sort first.
*/
static int strcmp_null(const char *zOne, const char *zTwo){
  if( zOne==0 ){
    if( zTwo==0 ) return 0;
    return -1;
  }else if( zTwo==0 ){
    return +1;
  }else{
    return strcmp(zOne, zTwo);
  }
}

/*
** Add mlink table entries associated with manifest cid.  The
** parent manifest is pid.
**
** A single mlink entry is added for every file that changed content
** and/or name going from pid to cid.
................................................................................
       if( pParentFile ){
         add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
                       pChildFile->zName, pChildFile->zPrior);
       }
    }else{
       pParentFile = manifest_file_seek(pParent, pChildFile->zName);
       if( pParentFile==0 ){
         if( pChildFile->zUuid ){
           add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0);
         }
       }else if( strcmp_null(pChildFile->zUuid, pParentFile->zUuid)!=0 ){
         add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
                       pChildFile->zName, 0);
       }
    }
  }
  if( pParent->zBaseline && pChild->zBaseline ){
    for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){
      if( pParentFile->zUuid ) continue;
      pChildFile = manifest_file_seek(pChild, pParentFile->zName);
      if( pChildFile ){
        add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0);
      }
    }
  }
  manifest_cache_insert(*ppOther);
}

/*
** True if manifest_crosslink_begin() has been called but
** manifest_crosslink_end() is still pending.