Fossil

Check-in [32e94835]
Login

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

Overview
Comment:Reformat long lines
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:32e94835856d1b6cb692229031c3d30f2ad080fe
User & Date: baruch 2015-01-08 10:47:12
Context
2015-01-08
11:14
Fix memory leaks check-in: fa8f12b6 user: baruch tags: svn-import
10:47
Reformat long lines check-in: 32e94835 user: baruch tags: svn-import
10:17
Fix for copy on same branch causing a merge check-in: 06d3aa22 user: baruch tags: svn-import
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/import.c.

896
897
898
899
900
901
902










903
904
905
906
907
908
909
...
936
937
938
939
940
941
942
943

944
945
946
947

948



949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
....
1148
1149
1150
1151
1152
1153
1154


1155
1156
1157

1158
1159
1160
1161
1162
1163
1164
1165
      );
    }
  }else{
    rec->contentFlag = 0;
  }
  return 1;
}











static void svn_finish_revision(){
  Blob manifest;
  static Stmt getChanges;
  static Stmt getFiles;
  static Stmt setRid;
  Blob mcksum;
................................................................................
        const char *zUuid = db_column_text(&getFiles, 1);
        const char *zPerm = db_column_text(&getFiles, 2);
        blob_appendf(&manifest, "F %F %s %s\n", zFile, zUuid, zPerm);
      }
      db_reset(&getFiles);
      if( !bag_find(&gsvn.newBranches, branchId) ){
        parentRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions"
                              " WHERE trev<%d AND tbranch=%d", gsvn.rev, branchId);

      }
      if( parentRid>0 ){
        const char *zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", parentRid);
        if( parentRid==mergeRid || mergeRid==0){

          const char *zParentBranch = db_text(0, "SELECT tname FROM xbranches WHERE tid=(SELECT tbranch FROM xrevisions WHERE trid=%d)", parentRid);



          blob_appendf(&manifest, "P %s\n", zParentUuid);
          blob_appendf(&manifest, "T *branch * %F\n", zBranch);
          blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
          blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
          blob_appendf(&manifest, "T -sym-%F *\n", zParentBranch);
        }else{
          const char *zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mergeRid);
          blob_appendf(&manifest, "P %s %s\n", zParentUuid, zMergeUuid);
          blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
        }
      }else{
        blob_appendf(&manifest, "T *branch * %F\n", zBranch);
        blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
        blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
      }
    }else{
      const char *zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", parentRid);
      blob_appendf(&manifest, "D %s\n", gsvn.zDate);
      blob_appendf(&manifest, "T +sym-%F %s\n", zBranch, zParentUuid);
    }
    if( gsvn.zUser ){
      blob_appendf(&manifest, "U %F\n", gsvn.zUser);
    }else{
      const char *zUserOvrd = find_option("user-override",0,1);
................................................................................
  db_prepare(&addRev,
    "INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)"
  );
  db_prepare(&cpyPath,
    "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)"
    " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm"
    " FROM xfoci"


    " WHERE checkinID=:rid AND filename>:srcpath||'/' AND filename<:srcpath||'0'"
  );
  db_prepare(&revSrc,

    "UPDATE xrevisions SET tparent=:parent WHERE trev=:rev AND tbranch=:branch AND tparent<:parent"
  );
  gsvn.rev = -1;
  bag_init(&gsvn.newBranches);
  while( svn_read_rec(pIn, &rec) ){
    if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */
      /* finish previous revision */
      char *zDate = NULL;







>
>
>
>
>
>
>
>
>
>







 







|
>


|

>
|
>
>
>






|









|







 







>
>
|


>
|







896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
...
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
....
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
      );
    }
  }else{
    rec->contentFlag = 0;
  }
  return 1;
}

/*
** Returns the UUID for the RID, or NULL if not found.
** The returned string is allocated via db_text() and must be
** free()d by the caller.
*/
char * rid_to_uuid(int rid)
{
  return db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}

static void svn_finish_revision(){
  Blob manifest;
  static Stmt getChanges;
  static Stmt getFiles;
  static Stmt setRid;
  Blob mcksum;
................................................................................
        const char *zUuid = db_column_text(&getFiles, 1);
        const char *zPerm = db_column_text(&getFiles, 2);
        blob_appendf(&manifest, "F %F %s %s\n", zFile, zUuid, zPerm);
      }
      db_reset(&getFiles);
      if( !bag_find(&gsvn.newBranches, branchId) ){
        parentRid = db_int(0, "SELECT trid, max(trev) FROM xrevisions"
                              " WHERE trev<%d AND tbranch=%d",
                           gsvn.rev, branchId);
      }
      if( parentRid>0 ){
        const char *zParentUuid = rid_to_uuid(parentRid);
        if( parentRid==mergeRid || mergeRid==0){
          const char *zParentBranch =
            db_text(0, "SELECT tname FROM xbranches WHERE tid="
                       " (SELECT tbranch FROM xrevisions WHERE trid=%d)",
                    parentRid
            );
          blob_appendf(&manifest, "P %s\n", zParentUuid);
          blob_appendf(&manifest, "T *branch * %F\n", zBranch);
          blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
          blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
          blob_appendf(&manifest, "T -sym-%F *\n", zParentBranch);
        }else{
          const char *zMergeUuid = rid_to_uuid(mergeRid);
          blob_appendf(&manifest, "P %s %s\n", zParentUuid, zMergeUuid);
          blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
        }
      }else{
        blob_appendf(&manifest, "T *branch * %F\n", zBranch);
        blob_appendf(&manifest, "T *sym-%F *\n", zBranch);
        blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
      }
    }else{
      const char *zParentUuid = rid_to_uuid(parentRid);
      blob_appendf(&manifest, "D %s\n", gsvn.zDate);
      blob_appendf(&manifest, "T +sym-%F %s\n", zBranch, zParentUuid);
    }
    if( gsvn.zUser ){
      blob_appendf(&manifest, "U %F\n", gsvn.zUser);
    }else{
      const char *zUserOvrd = find_option("user-override",0,1);
................................................................................
  db_prepare(&addRev,
    "INSERT OR IGNORE INTO xrevisions (trev, tbranch) VALUES(:rev, :branch)"
  );
  db_prepare(&cpyPath,
    "INSERT INTO xfiles (tpath, tbranch, tuuid, tperm)"
    " SELECT :path||substr(filename, length(:srcpath)+1), :branch, uuid, perm"
    " FROM xfoci"
    " WHERE checkinID=:rid"
    "   AND filename>:srcpath||'/'"
    "   AND filename<:srcpath||'0'"
  );
  db_prepare(&revSrc,
    "UPDATE xrevisions SET tparent=:parent"
    " WHERE trev=:rev AND tbranch=:branch AND tparent<:parent"
  );
  gsvn.rev = -1;
  bag_init(&gsvn.newBranches);
  while( svn_read_rec(pIn, &rec) ){
    if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */
      /* finish previous revision */
      char *zDate = NULL;