Fossil

Check-in [ea54a298]
Login

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

Overview
Comment:fix bug with multi-window svndiff
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:ea54a29848ba316ce7c7e61b01d053f1ce3170c0
User & Date: baruch 2014-10-28 12:19:45
Context
2014-10-31
08:05
Significant speed improvment check-in: 31b1e5a8 user: baruch tags: svn-import
2014-10-28
12:19
fix bug with multi-window svndiff check-in: ea54a298 user: baruch tags: svn-import
10:44
Support version 3 format (diff dumps) check-in: eb0bf087 user: baruch tags: svn-import
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/import.c.

1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
....
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
....
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
....
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
    u64 lenSrc = svn_get_varint(&zDiff);
    u64 lenOut = svn_get_varint(&zDiff);
    u64 lenInst = svn_get_varint(&zDiff);
    u64 lenData = svn_get_varint(&zDiff);
    const char *zInst = zDiff;
    const char *zData = zInst+lenInst;
    u64 lenOld = blob_size(pOut);
    blob_resize(pOut, lenOut);
    zOut = blob_buffer(pOut) + lenOld;
    while( zDiff<zInst+lenInst ){
      u64 lenCpy = (*zDiff)&0x3f;
      const char *zCpy;
      switch( (*zDiff)&0xC0 ){
        case 0x00: zCpy = blob_buffer(pSrc)+offSrc; break;
        case 0x40: zCpy = blob_buffer(pOut); break;
        case 0x80: zCpy = zData; break;
................................................................................
      db_reset(&insRev);
      fossil_free(zDate);
      if( rev>0 ){
        db_multi_exec("INSERT INTO xfiles (trev, tpath, trid, tperm) "
                      "SELECT %d, tpath, trid, tperm FROM xfiles "
                      "WHERE trev=%d", rev, rev-1);
      }
fossil_print("rev: %d\n", rev);
    }else
    if( zTemp = svn_find_header(rec, "Node-path") ){
      const char *zPath = zTemp;
      const char *zAction = svn_find_header(rec, "Node-action");
      const char *zKind = svn_find_header(rec, "Node-kind");
      const char *zSrcPath = svn_find_header(rec, "Node-copyfrom-path");
      const char *zPerm = svn_find_prop(rec, "svn:executable") ? "x" : 0;
      int deltaFlag = 0;
      int srcRev = -1;
      int rid = 0;
fossil_print("file: %s ...", zPath);
      if( zTemp = svn_find_header(rec, "Text-delta") ){
        deltaFlag = strncmp(zTemp, "true", 4)==0;
      }
      if( zSrcPath ){
        zTemp = svn_find_header(rec, "Node-copyfrom-rev");
        if( zTemp ){
          srcRev = atoi(zTemp);
................................................................................
            rid = db_int(0,
                         "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q",
                         srcRev, zSrcPath);
          }
          if( deltaFlag ){
            Blob deltaSrc;
            Blob target;
fossil_print("diff-size: %d ", blob_size(&rec.content));
            if( rid!=0 ){
              content_get(rid, &deltaSrc);
            }else{
              blob_zero(&deltaSrc);
            }
            svn_apply_svndiff(&rec.content, &deltaSrc, &target);
fossil_print("real-size: %d ", blob_size(&target));
            rid = content_put(&target);
          }else if( rec.contentFlag ){
fossil_print("size: %d ", blob_size(&rec.content));
            rid = content_put(&rec.content);
          }
fossil_print("rid: %d ", rid);
          db_bind_int(&insFile, ":rev", rev);
          db_bind_int(&insFile, ":rid", rid);
          db_bind_text(&insFile, ":path", zPath);
          db_bind_text(&insFile, ":perm", zPerm);
          db_step(&insFile);
          db_reset(&insFile);
        }
................................................................................
      }else{
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }
    svn_free_rec(&rec);
fossil_print("done\n");
  }
  if( !flatFlag ){
    if( *zBranch ){
      db_bind_text(&setBranch, ":branch", zBranch);
      db_bind_int(&setBranch, ":rev", rev);
      db_step(&setBranch);
    }







|
|







 







<










<







 







<






<


<


<







 







<







1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
....
1141
1142
1143
1144
1145
1146
1147

1148
1149
1150
1151
1152
1153
1154
1155
1156
1157

1158
1159
1160
1161
1162
1163
1164
....
1224
1225
1226
1227
1228
1229
1230

1231
1232
1233
1234
1235
1236

1237
1238

1239
1240

1241
1242
1243
1244
1245
1246
1247
....
1273
1274
1275
1276
1277
1278
1279

1280
1281
1282
1283
1284
1285
1286
    u64 lenSrc = svn_get_varint(&zDiff);
    u64 lenOut = svn_get_varint(&zDiff);
    u64 lenInst = svn_get_varint(&zDiff);
    u64 lenData = svn_get_varint(&zDiff);
    const char *zInst = zDiff;
    const char *zData = zInst+lenInst;
    u64 lenOld = blob_size(pOut);
    blob_resize(pOut, lenOut+lenOld);
    zOut = blob_buffer(pOut)+lenOld;
    while( zDiff<zInst+lenInst ){
      u64 lenCpy = (*zDiff)&0x3f;
      const char *zCpy;
      switch( (*zDiff)&0xC0 ){
        case 0x00: zCpy = blob_buffer(pSrc)+offSrc; break;
        case 0x40: zCpy = blob_buffer(pOut); break;
        case 0x80: zCpy = zData; break;
................................................................................
      db_reset(&insRev);
      fossil_free(zDate);
      if( rev>0 ){
        db_multi_exec("INSERT INTO xfiles (trev, tpath, trid, tperm) "
                      "SELECT %d, tpath, trid, tperm FROM xfiles "
                      "WHERE trev=%d", rev, rev-1);
      }

    }else
    if( zTemp = svn_find_header(rec, "Node-path") ){
      const char *zPath = zTemp;
      const char *zAction = svn_find_header(rec, "Node-action");
      const char *zKind = svn_find_header(rec, "Node-kind");
      const char *zSrcPath = svn_find_header(rec, "Node-copyfrom-path");
      const char *zPerm = svn_find_prop(rec, "svn:executable") ? "x" : 0;
      int deltaFlag = 0;
      int srcRev = -1;
      int rid = 0;

      if( zTemp = svn_find_header(rec, "Text-delta") ){
        deltaFlag = strncmp(zTemp, "true", 4)==0;
      }
      if( zSrcPath ){
        zTemp = svn_find_header(rec, "Node-copyfrom-rev");
        if( zTemp ){
          srcRev = atoi(zTemp);
................................................................................
            rid = db_int(0,
                         "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q",
                         srcRev, zSrcPath);
          }
          if( deltaFlag ){
            Blob deltaSrc;
            Blob target;

            if( rid!=0 ){
              content_get(rid, &deltaSrc);
            }else{
              blob_zero(&deltaSrc);
            }
            svn_apply_svndiff(&rec.content, &deltaSrc, &target);

            rid = content_put(&target);
          }else if( rec.contentFlag ){

            rid = content_put(&rec.content);
          }

          db_bind_int(&insFile, ":rev", rev);
          db_bind_int(&insFile, ":rid", rid);
          db_bind_text(&insFile, ":path", zPath);
          db_bind_text(&insFile, ":perm", zPerm);
          db_step(&insFile);
          db_reset(&insFile);
        }
................................................................................
      }else{
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }
    svn_free_rec(&rec);

  }
  if( !flatFlag ){
    if( *zBranch ){
      db_bind_text(&setBranch, ":branch", zBranch);
      db_bind_int(&setBranch, ":rev", rev);
      db_step(&setBranch);
    }