Fossil: Check-in [8d2e67512d]

Fossil SCM

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

Overview
Comment:Can now import full dump. Still only flat and only format 2. No tracking of file moves yet
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:8d2e67512d585183f3cf3386aa4b7b5efe20ae48
User & Date: baruch 2014-10-22 11:53:26
Original Comment: Can now import full dump. Still only flat and only format 2
Context
2014-10-26
14:16
import branches check-in: c95c183e7b user: baruch tags: svn-import
2014-10-22
11:53
Can now import full dump. Still only flat and only format 2. No tracking of file moves yet check-in: 8d2e67512d user: baruch tags: svn-import
2014-10-21
15:00
support copying files (no folders support yet) check-in: 0edbf144f3 user: baruch tags: svn-import
Changes

Changes to src/import.c.

975
976
977
978
979
980
981
982

983
984
985
986
987
988
989
....
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024







1025















1026
1027
1028
1029


1030
1031
1032
1033
1034
1035
1036

1037
1038

1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053

1054
1055
1056
1057
1058
1059
1060
  );
  db_prepare(&insFile,
      "INSERT INTO xfiles (trev, tpath, trid, tperm) "
      "VALUES(:rev, :path, :rid, :perm)"
  );
  db_prepare(&delFile,
      "DELETE FROM xfiles "
      "WHERE trev=:rev AND (tpath=:path OR tpath GLOB :path || '/*')"

  );
  while( svn_read_rec(pIn, &rec) ){
    if( zTemp = svn_find_header(rec, "Revision-number") ){
      const char *zUser = svn_find_prop(rec, "svn:author");
      const char *zLog = svn_find_prop(rec, "svn:log");
      const char *zDate = svn_find_prop(rec, "svn:date");
      zDate = date_in_standard_format(zDate);
................................................................................
      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 srcRev = -1;
      int rid = 0;
      if( zKind && strncmp(zKind, "dir", 3)==0 ){
        svn_free_rec(&rec);
        continue;
      }
      if( zSrcPath ){
        zTemp = svn_find_header(rec, "Node-copyfrom-rev");
        if( zTemp ){
          srcRev = atoi(zTemp);
        }else{
          fossil_fatal("Missing copyfrom-rev");
        }
      }
      rid = content_put(&rec.content);







      if( strncmp(zAction, "add", 3)==0 ){















        if( blob_size(&rec.content)>0 && zSrcPath!=0 ){
          rid = db_int(rid,
                       "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q",
                       srcRev, zSrcPath);


        }
        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
      if( strncmp(zAction, "change", 6)==0 ){

        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
      if( strncmp(zAction, "delete", 6)==0 ){
        db_bind_int(&delFile, ":rev", rev);
        db_bind_text(&delFile, ":path", zPath);
        db_step(&delFile);
        db_reset(&delFile);
      }else
      if( strncmp(zAction, "replace", 7)==0 ){
      }else{

      }
    }else{
      fossil_fatal("Unknown record type");
    }
    svn_free_rec(&rec);
  }
  svn_create_manifests();







|
>







 







<
<
<
<








|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>
>
|
|
|
|
|
|
|
>


>







|
<
<
<
<
|
<
<
>







975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
....
1006
1007
1008
1009
1010
1011
1012




1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069




1070


1071
1072
1073
1074
1075
1076
1077
1078
  );
  db_prepare(&insFile,
      "INSERT INTO xfiles (trev, tpath, trid, tperm) "
      "VALUES(:rev, :path, :rid, :perm)"
  );
  db_prepare(&delFile,
      "DELETE FROM xfiles "
      "WHERE trev=:rev "
      "  AND (tpath=:path OR (tpath>:path||'/' AND tpath<:path||'0'))"
  );
  while( svn_read_rec(pIn, &rec) ){
    if( zTemp = svn_find_header(rec, "Revision-number") ){
      const char *zUser = svn_find_prop(rec, "svn:author");
      const char *zLog = svn_find_prop(rec, "svn:log");
      const char *zDate = svn_find_prop(rec, "svn:date");
      zDate = date_in_standard_format(zDate);
................................................................................
      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 srcRev = -1;
      int rid = 0;




      if( zSrcPath ){
        zTemp = svn_find_header(rec, "Node-copyfrom-rev");
        if( zTemp ){
          srcRev = atoi(zTemp);
        }else{
          fossil_fatal("Missing copyfrom-rev");
        }
      }
      if( strncmp(zAction, "delete", 6)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        db_bind_int(&delFile, ":rev", rev);
        db_bind_text(&delFile, ":path", zPath);
        db_step(&delFile);
        db_reset(&delFile);
      } /* 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_multi_exec(
              "INSERT INTO xfiles (trev, tpath, trid, tperm) "
              " SELECT %d, %Q||substr(tpath, length(%Q)+1), trid, tperm "
              " FROM xfiles "
              " WHERE trev=%d AND tpath GLOB '%q/*'",
              rev, zPath, zSrcPath, srcRev, zSrcPath
            );
          }
        }else{
          if( blob_size(&rec.content)==0 && zSrcPath ){
            rid = db_int(rid,
                         "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q",
                         srcRev, zSrcPath);
          }else{
            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
      if( strncmp(zAction, "change", 6)==0 ){
        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
      if( strncmp(zAction, "delete", 6)==0){ /* already did this above */




      }else{


        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }
    svn_free_rec(&rec);
  }
  svn_create_manifests();