Fossil with Commonmark

Check-in [57fa3896f3]
Login

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

Overview
Comment:Fix --flat option
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:57fa3896f3b489cda51748e1ed834d2ebf1f2215
User & Date: baruch 2014-11-04 10:36:33
Context
2014-11-04
12:29
Fix --filter option check-in: 64c65816da user: baruch tags: svn-import
10:36
Fix --flat option check-in: 57fa3896f3 user: baruch tags: svn-import
2014-11-03
16:05
Fix bugs with filter and with add+change in same commit check-in: 65dc40a1ed user: baruch tags: svn-import
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/import.c.

941
942
943
944
945
946
947

948
949
950
951



952
953
954
955
956
957
958
....
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195

1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208

1209
1210
1211
1212
1213
1214
1215
....
1244
1245
1246
1247
1248
1249
1250

1251
1252
1253
1254
1255
1256
1257
....
1268
1269
1270
1271
1272
1273
1274

1275
1276
1277
1278
1279
1280
1281
  if( gsvn.zComment ){
    blob_appendf(&manifest, "C %F\n", gsvn.zComment);
  }else{
    blob_append(&manifest, "C (no\\scomment)\n", 16);
  }
  blob_appendf(&manifest, "D %s\n", gsvn.zDate);
  nBaseFilter = blob_size(&gsvn.filter);

  if( strncmp(gsvn.zBranch, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
    blob_appendf(&gsvn.filter, "%s*", gsvn.zTrunk);
  }else{
    blob_appendf(&gsvn.filter, "%s%s/*", gsvn.zBranches, gsvn.zBranch);



  }
  db_bind_text(&qFiles, ":filter", blob_str(&gsvn.filter));
  nFilter = blob_size(&gsvn.filter)-1;
  while( db_step(&qFiles)==SQLITE_ROW ){
    const char *zFile = db_column_text(&qFiles, 0);
    int rid = db_column_int(&qFiles, 1);
    const char *zPerm = db_column_text(&qFiles, 2);
................................................................................
            if( strncmp(zTemp, gsvn.zBranch, lenBranch)!=0 ){
              fossil_fatal("Commit to multiple branches");
            }
          }else{
            gsvn.zBranch = fossil_malloc(lenBranch+1);
            memcpy(gsvn.zBranch, zTemp, lenBranch);
            gsvn.zBranch[lenBranch] = '\0';
            bHasFiles = 1;
          }
        }else
        if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk)==0 ){
          if( gsvn.zBranch!=0 ){
            if( strncmp(gsvn.zTrunk, gsvn.zBranch, gsvn.lenTrunk-1)!=0 ){
              fossil_fatal("Commit to multiple branches");
            }
          }else{
            gsvn.zBranch = fossil_malloc(gsvn.lenTrunk);
            memcpy(gsvn.zBranch, gsvn.zTrunk, gsvn.lenTrunk-1);
            gsvn.zBranch[gsvn.lenTrunk-1] = '\0';
            bHasFiles = 1;
          }
        }
      }
      if( strncmp(zAction, "delete", 6)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        db_bind_text(&delPath, ":path", zPath);
        db_step(&delPath);
        db_reset(&delPath);

      } /* no 'else' here since 'replace' does both a 'delete' and an 'add' */
      if( strncmp(zAction, "add", 3)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }else if( strncmp(zKind, "dir", 3)==0 ){
          if( zSrcPath ){
            db_bind_int(&cpyPath, ":srcrev", srcRev);
            db_bind_text(&cpyPath, ":path", zPath);
            db_bind_text(&cpyPath, ":srcpath", zSrcPath);
            db_step(&cpyPath);
            db_reset(&cpyPath);

            if( !gsvn.flatFlag ){
              if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){
                zTemp = zPath+gsvn.lenBranches+strlen(gsvn.zBranch);
                if( *zTemp==0 ){
                  gsvn.parent = srcRev;
                }
              }else if( strncmp(zPath, gsvn.zTags, gsvn.lenTags)==0 ){
................................................................................
            rid = content_put(&rec.content);
          }
          db_bind_int(&addHist, ":rid", rid);
          db_bind_text(&addHist, ":path", zPath);
          db_bind_text(&addHist, ":perm", zPerm);
          db_step(&addHist);
          db_reset(&addHist);

        }
      }else
      if( strncmp(zAction, "change", 6)==0 ){
        int rid = 0;
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }
................................................................................
          rid = content_put(&rec.content);
        }
        db_bind_int(&addHist, ":rid", rid);
        db_bind_text(&addHist, ":path", zPath);
        db_bind_text(&addHist, ":perm", zPerm);
        db_step(&addHist);
        db_reset(&addHist);

      }else
      if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }







>
|
|
|
|
>
>
>







 







<











<









>













>







 







>







 







>







941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
....
1171
1172
1173
1174
1175
1176
1177

1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188

1189
1190
1191
1192
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
....
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
....
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
  if( gsvn.zComment ){
    blob_appendf(&manifest, "C %F\n", gsvn.zComment);
  }else{
    blob_append(&manifest, "C (no\\scomment)\n", 16);
  }
  blob_appendf(&manifest, "D %s\n", gsvn.zDate);
  nBaseFilter = blob_size(&gsvn.filter);
  if( !gsvn.flatFlag ){
    if( strncmp(gsvn.zBranch, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
      blob_appendf(&gsvn.filter, "%s*", gsvn.zTrunk);
    }else{
      blob_appendf(&gsvn.filter, "%s%s/*", gsvn.zBranches, gsvn.zBranch);
    }
  }else{
    blob_append(&gsvn.filter, "*", 1);
  }
  db_bind_text(&qFiles, ":filter", blob_str(&gsvn.filter));
  nFilter = blob_size(&gsvn.filter)-1;
  while( db_step(&qFiles)==SQLITE_ROW ){
    const char *zFile = db_column_text(&qFiles, 0);
    int rid = db_column_int(&qFiles, 1);
    const char *zPerm = db_column_text(&qFiles, 2);
................................................................................
            if( strncmp(zTemp, gsvn.zBranch, lenBranch)!=0 ){
              fossil_fatal("Commit to multiple branches");
            }
          }else{
            gsvn.zBranch = fossil_malloc(lenBranch+1);
            memcpy(gsvn.zBranch, zTemp, lenBranch);
            gsvn.zBranch[lenBranch] = '\0';

          }
        }else
        if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk)==0 ){
          if( gsvn.zBranch!=0 ){
            if( strncmp(gsvn.zTrunk, gsvn.zBranch, gsvn.lenTrunk-1)!=0 ){
              fossil_fatal("Commit to multiple branches");
            }
          }else{
            gsvn.zBranch = fossil_malloc(gsvn.lenTrunk);
            memcpy(gsvn.zBranch, gsvn.zTrunk, gsvn.lenTrunk-1);
            gsvn.zBranch[gsvn.lenTrunk-1] = '\0';

          }
        }
      }
      if( strncmp(zAction, "delete", 6)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        db_bind_text(&delPath, ":path", zPath);
        db_step(&delPath);
        db_reset(&delPath);
        bHasFiles = 1;
      } /* no 'else' here since 'replace' does both a 'delete' and an 'add' */
      if( strncmp(zAction, "add", 3)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }else if( strncmp(zKind, "dir", 3)==0 ){
          if( zSrcPath ){
            db_bind_int(&cpyPath, ":srcrev", srcRev);
            db_bind_text(&cpyPath, ":path", zPath);
            db_bind_text(&cpyPath, ":srcpath", zSrcPath);
            db_step(&cpyPath);
            db_reset(&cpyPath);
            bHasFiles = 1;
            if( !gsvn.flatFlag ){
              if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){
                zTemp = zPath+gsvn.lenBranches+strlen(gsvn.zBranch);
                if( *zTemp==0 ){
                  gsvn.parent = srcRev;
                }
              }else if( strncmp(zPath, gsvn.zTags, gsvn.lenTags)==0 ){
................................................................................
            rid = content_put(&rec.content);
          }
          db_bind_int(&addHist, ":rid", rid);
          db_bind_text(&addHist, ":path", zPath);
          db_bind_text(&addHist, ":perm", zPerm);
          db_step(&addHist);
          db_reset(&addHist);
          bHasFiles = 1;
        }
      }else
      if( strncmp(zAction, "change", 6)==0 ){
        int rid = 0;
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }
................................................................................
          rid = content_put(&rec.content);
        }
        db_bind_int(&addHist, ":rid", rid);
        db_bind_text(&addHist, ":path", zPath);
        db_bind_text(&addHist, ":perm", zPerm);
        db_step(&addHist);
        db_reset(&addHist);
        bHasFiles = 1;
      }else
      if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }