Fossil

Check-in [5f4e2db9]
Login

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

Overview
Comment:Fix issue with branches having wrong parent. Needs cleanup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:5f4e2db949690d16454592574b19a42a9199bb4c
User & Date: baruch 2014-11-05 09:09:22
Context
2014-11-05
09:12
Merge latest trunk check-in: fef7e1f9 user: baruch tags: svn-import
09:09
Fix issue with branches having wrong parent. Needs cleanup check-in: 5f4e2db9 user: baruch tags: svn-import
2014-11-04
12:29
Fix --filter option check-in: 64c65816 user: baruch tags: svn-import
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/import.c.

717
718
719
720
721
722
723
724

725
726
727
728
729
730
731
732
733
734
735
...
899
900
901
902
903
904
905

906
907
908
909
910
911
912
913
914
915

916
917
918
919
920
921
922
...
926
927
928
929
930
931
932
933
934


935
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
...
968
969
970
971
972
973
974
975
976
977

978
979





980
981
982
983
984
985
986
987
988
989
990
991
992
993
...
996
997
998
999
1000
1001
1002

1003
1004
1005
1006
1007
1008
1009
....
1012
1013
1014
1015
1016
1017
1018






1019
1020
1021
1022
1023
1024
1025
....
1067
1068
1069
1070
1071
1072
1073























1074
1075
1076
1077
1078
1079
1080
....
1081
1082
1083
1084
1085
1086
1087
1088

1089
1090
1091
1092
1093
1094
1095
....
1129
1130
1131
1132
1133
1134
1135

1136
1137
1138
1139
1140
1141
1142

1143
1144
1145
1146
1147
1148
1149
....
1163
1164
1165
1166
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
....
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223

1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
  trim_newline(zLine);
  fossil_fatal("bad fast-import line: [%s]", zLine);
  return;
}

static struct{
  int rev;                    /* SVN revision number */
  int parent;                 /* SVN revision number of parent check-in */

  char *zBranch;              /* Name of a branch for a commit */
  char *zDate;                /* Date/time stamp */
  char *zUser;                /* User name */
  char *zComment;             /* Comment of a commit */
  int flatFlag;               /* True if whole repo is a single file tree */
  const char *zTrunk;         /* Name of trunk folder in repo root */
  int lenTrunk;               /* String length of zTrunk */
  const char *zBranches;      /* Name of branches folder in repo root */
  int lenBranches;            /* String length of zBranches */
  const char *zTags;          /* Name of tags folder in repo root */
  int lenTags;                /* String length of zTags */
................................................................................
}

static void svn_create_manifest(
){
  Blob manifest;
  static Stmt insRev;
  static Stmt qParent;

  static Stmt qFiles;
  static Stmt qTags;
  int nBaseFilter;
  int nFilter;
  int rid;
  const char *zParentBranch = 0;
  Blob mcksum;

  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);
................................................................................
  ){
    blob_resize(&gsvn.filter, nBaseFilter);
    return;
  }
  db_static_prepare(&insRev, "REPLACE INTO xrevisions (trev, tbranch, tuuid) "
                             "VALUES(:rev, :branch, "
                             " (SELECT uuid FROM blob WHERE rid=:rid))");
  db_static_prepare(&qParent, "SELECT tuuid, tbranch FROM xrevisions "
                              "WHERE trev=:rev");


  db_static_prepare(&qFiles, "SELECT tpath, trid, tperm FROM xfiles "
                             "WHERE tpath GLOB :filter ORDER BY tpath");
  db_static_prepare(&qTags, "SELECT ttag FROM xtags WHERE trev=:rev");
  if( !gsvn.flatFlag ){
    if( gsvn.parent<0 ){
      gsvn.parent = db_int(-1, "SELECT ifnull(max(trev),-1) FROM xrevisions "
                               "WHERE tbranch=%Q", gsvn.zBranch);
      if( gsvn.parent<0 ){

        gsvn.parent = db_int(-1, "SELECT ifnull(max(trev),-1) FROM xrevisions");
      }

    }
    db_bind_int(&insRev, ":rev", gsvn.rev);
    db_bind_text(&insRev, ":branch", gsvn.zBranch);
    db_bind_int(&insRev, ":rid", 0);
    db_step(&insRev);
    db_reset(&insRev);
  }else{
    static int prevRev = -1;
    gsvn.parent = prevRev;

    prevRev = gsvn.rev;
  }
  blob_zero(&manifest);
  if( gsvn.zComment ){
    blob_appendf(&manifest, "C %F\n", gsvn.zComment);
  }else{
    blob_append(&manifest, "C (no\\scomment)\n", 16);
................................................................................
    const char *zPerm = db_column_text(&qFiles, 2);
    const char *zUuid;
    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
    blob_appendf(&manifest, "F %F %s %s\n", zFile+nFilter, zUuid, zPerm);
    fossil_free(zUuid);
  }
  blob_resize(&gsvn.filter, nBaseFilter);
  if( gsvn.parent>=0 ){
    const char *zParentUuid;
    db_bind_int(&qParent, ":rev", gsvn.parent);

    db_step(&qParent);
    zParentUuid = db_column_text(&qParent, 0);





    blob_appendf(&manifest, "P %s\n", zParentUuid);
    if( !gsvn.flatFlag ){
      zParentBranch = db_column_text(&qParent, 1);
      if( strcmp(gsvn.zBranch, zParentBranch)!=0 ){
        blob_appendf(&manifest, "T *branch * %F\n", gsvn.zBranch);
        blob_appendf(&manifest, "T *sym-%F *\n", gsvn.zBranch);
        zParentBranch = mprintf("%F", zParentBranch);
      }else{
        zParentBranch = 0;
      }
    }
  }else{
    blob_appendf(&manifest, "T *branch * trunk\n");
    blob_appendf(&manifest, "T *sym-trunk *\n");
................................................................................
  while( db_step(&qTags)==SQLITE_ROW ){
    const char *zTag = db_column_text(&qTags, 0);
    blob_appendf(&manifest, "T +sym-%s *\n", zTag);
  }
  blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
  if( zParentBranch ) {
    blob_appendf(&manifest, "T -sym-%s *\n", zParentBranch);

  }
  if( gsvn.zUser ){
    blob_appendf(&manifest, "U %F\n", gsvn.zUser);
  }else{
    const char *zUserOvrd = find_option("user-override",0,1);
    blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : login_name());
  }
................................................................................
  blob_reset(&mcksum);

  rid = content_put(&manifest);
  db_bind_int(&insRev, ":rev", gsvn.rev);
  db_bind_text(&insRev, ":branch", gsvn.zBranch);
  db_bind_int(&insRev, ":rid", rid);
  db_step(&insRev);






  blob_reset(&manifest);
}

static u64 svn_get_varint(const char **pz){
  unsigned int v = 0;
  do{
    v = (v<<7) | ((*pz)[0]&0x7f);
................................................................................
      while( lenCpy-- > 0 ){
        *zOut++ = *zCpy++;
      }
    }
    zDiff += lenData;
  }
}
























/*
** Read the svn-dump format from pIn and insert the corresponding
** content into the database.
*/
static void svn_dump_import(FILE *pIn){
  SvnRecord rec;
................................................................................
  int ver;
  const char *zTemp;
  const char *zUuid;
  Stmt addHist;
  Stmt insTag;
  Stmt cpyPath;
  Stmt delPath;
  int bHasFiles;


  /* version */
  if( svn_read_rec(pIn, &rec)
   && (zTemp = svn_find_header(rec, "SVN-fs-dump-format-version")) ){
    ver = atoi(zTemp);
    if( ver!=2 && ver!=3 ){
      fossil_fatal("Unknown svn-dump format version: %d", ver);
................................................................................
      /* finish previous revision */
      if( bHasFiles ){
        svn_create_manifest();
        fossil_free(gsvn.zUser);
        fossil_free(gsvn.zComment);
        fossil_free(gsvn.zDate);
        fossil_free(gsvn.zBranch);

      }
      /* start new revision */
      gsvn.rev = atoi(zTemp);
      gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
      gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
      gsvn.zDate = date_in_standard_format(svn_find_prop(rec, "svn:date"));
      gsvn.parent = -1;

      gsvn.zBranch = 0;
      bHasFiles = 0;
      fossil_print("\rImporting SVN revision: %d", gsvn.rev);
      db_bind_int(&addHist, ":rev", gsvn.rev);
      db_bind_int(&cpyPath, ":rev", gsvn.rev);
      db_bind_int(&delPath, ":rev", gsvn.rev);
    }else
................................................................................
        if( zTemp ){
          srcRev = atoi(zTemp);
        }else{
          fossil_fatal("Missing copyfrom-rev");
        }
      }
      if( !gsvn.flatFlag ){
        if( strncmp(zPath, gsvn.zBranches, gsvn.lenBranches)==0 ){
          int lenBranch;
          zTemp = zPath+gsvn.lenBranches;
          while( *zTemp && *zTemp!='/' ){ zTemp++; }
          lenBranch = zTemp-zPath-gsvn.lenBranches;
          zTemp = zPath+gsvn.lenBranches;
          if( gsvn.zBranch!=0 ){
            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_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 ){
                zTemp = zPath+gsvn.lenTags;
                db_bind_int(&insTag, ":rev", srcRev);
                db_bind_text(&insTag, ":tag", zTemp);
                db_step(&insTag);
                db_reset(&insTag);
              }
            }
          }







|
>
|
|
|
|







 







>










>







 







|
|
>
>




|
|
|
|
>
|

>








|
>







 







|

|
>


>
>
>
>
>


<
|


|







 







>







 







>
>
>
>
>
>







 







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







 







|
>







 







>






|
>







 







|
<
<
<
<
<

|


>

<
<
<
<
<
<
|
<
<
<
<
<
<
<







 







|
|

|
>

|
|







717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
...
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
...
929
930
931
932
933
934
935
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
...
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995

996
997
998
999
1000
1001
1002
1003
1004
1005
1006
....
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
....
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
....
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
....
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
....
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
....
1209
1210
1211
1212
1213
1214
1215
1216





1217
1218
1219
1220
1221
1222






1223







1224
1225
1226
1227
1228
1229
1230
....
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
  trim_newline(zLine);
  fossil_fatal("bad fast-import line: [%s]", zLine);
  return;
}

static struct{
  int rev;                    /* SVN revision number */
  int parentRev;              /* SVN revision number of parent check-in */
  const char *zParentBranch;  /* Name of branch of parent check-in */
  const char *zBranch;        /* Name of a branch for a commit */
  const char *zDate;          /* Date/time stamp */
  const char *zUser;          /* User name */
  const char *zComment;       /* Comment of a commit */
  int flatFlag;               /* True if whole repo is a single file tree */
  const char *zTrunk;         /* Name of trunk folder in repo root */
  int lenTrunk;               /* String length of zTrunk */
  const char *zBranches;      /* Name of branches folder in repo root */
  int lenBranches;            /* String length of zBranches */
  const char *zTags;          /* Name of tags folder in repo root */
  int lenTags;                /* String length of zTags */
................................................................................
}

static void svn_create_manifest(
){
  Blob manifest;
  static Stmt insRev;
  static Stmt qParent;
  static Stmt qParent2;
  static Stmt qFiles;
  static Stmt qTags;
  int nBaseFilter;
  int nFilter;
  int rid;
  const char *zParentBranch = 0;
  Blob mcksum;

  nBaseFilter = blob_size(&gsvn.filter);
  if( !gsvn.flatFlag ){
    if( gsvn.zBranch==0 ){ return; }
    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);
................................................................................
  ){
    blob_resize(&gsvn.filter, nBaseFilter);
    return;
  }
  db_static_prepare(&insRev, "REPLACE INTO xrevisions (trev, tbranch, tuuid) "
                             "VALUES(:rev, :branch, "
                             " (SELECT uuid FROM blob WHERE rid=:rid))");
  db_static_prepare(&qParent, "SELECT tuuid, max(trev) FROM xrevisions "
                              "WHERE trev<=:rev AND tbranch=:branch");
  db_static_prepare(&qParent2, "SELECT tuuid, min(trev) "
                               "FROM xrevisions WHERE tbranch=:branch");
  db_static_prepare(&qFiles, "SELECT tpath, trid, tperm FROM xfiles "
                             "WHERE tpath GLOB :filter ORDER BY tpath");
  db_static_prepare(&qTags, "SELECT ttag FROM xtags WHERE trev=:rev");
  if( !gsvn.flatFlag ){
    if( gsvn.parentRev<0 ){
      gsvn.parentRev = db_int(-1, "SELECT ifnull(max(trev),-1) FROM xrevisions "
                                  "WHERE tbranch=%Q", gsvn.zBranch);
      if( gsvn.parentRev<0 ){
        gsvn.parentRev =
            db_int(-1, "SELECT ifnull(max(trev),-1) FROM xrevisions");
      }
      gsvn.zParentBranch = gsvn.zBranch;
    }
    db_bind_int(&insRev, ":rev", gsvn.rev);
    db_bind_text(&insRev, ":branch", gsvn.zBranch);
    db_bind_int(&insRev, ":rid", 0);
    db_step(&insRev);
    db_reset(&insRev);
  }else{
    static int prevRev = -1;
    gsvn.parentRev = prevRev;
    gsvn.zParentBranch = gsvn.zBranch = "";
    prevRev = gsvn.rev;
  }
  blob_zero(&manifest);
  if( gsvn.zComment ){
    blob_appendf(&manifest, "C %F\n", gsvn.zComment);
  }else{
    blob_append(&manifest, "C (no\\scomment)\n", 16);
................................................................................
    const char *zPerm = db_column_text(&qFiles, 2);
    const char *zUuid;
    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
    blob_appendf(&manifest, "F %F %s %s\n", zFile+nFilter, zUuid, zPerm);
    fossil_free(zUuid);
  }
  blob_resize(&gsvn.filter, nBaseFilter);
  if( gsvn.parentRev>=0 ){
    const char *zParentUuid;
    db_bind_int(&qParent, ":rev", gsvn.parentRev);
    db_bind_text(&qParent, ":branch", gsvn.zParentBranch);
    db_step(&qParent);
    zParentUuid = db_column_text(&qParent, 0);
    if( zParentUuid==0 ){
      db_bind_text(&qParent2, ":branch", gsvn.zParentBranch);
      db_step(&qParent2);
      zParentUuid = db_column_text(&qParent2, 0);
    }
    blob_appendf(&manifest, "P %s\n", zParentUuid);
    if( !gsvn.flatFlag ){

      if( strcmp(gsvn.zBranch, gsvn.zParentBranch)!=0 ){
        blob_appendf(&manifest, "T *branch * %F\n", gsvn.zBranch);
        blob_appendf(&manifest, "T *sym-%F *\n", gsvn.zBranch);
        zParentBranch = mprintf("%F", gsvn.zParentBranch);
      }else{
        zParentBranch = 0;
      }
    }
  }else{
    blob_appendf(&manifest, "T *branch * trunk\n");
    blob_appendf(&manifest, "T *sym-trunk *\n");
................................................................................
  while( db_step(&qTags)==SQLITE_ROW ){
    const char *zTag = db_column_text(&qTags, 0);
    blob_appendf(&manifest, "T +sym-%s *\n", zTag);
  }
  blob_appendf(&manifest, "T +sym-svn-rev-%d *\n", gsvn.rev);
  if( zParentBranch ) {
    blob_appendf(&manifest, "T -sym-%s *\n", zParentBranch);
    fossil_free(zParentBranch);
  }
  if( gsvn.zUser ){
    blob_appendf(&manifest, "U %F\n", gsvn.zUser);
  }else{
    const char *zUserOvrd = find_option("user-override",0,1);
    blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : login_name());
  }
................................................................................
  blob_reset(&mcksum);

  rid = content_put(&manifest);
  db_bind_int(&insRev, ":rev", gsvn.rev);
  db_bind_text(&insRev, ":branch", gsvn.zBranch);
  db_bind_int(&insRev, ":rid", rid);
  db_step(&insRev);
  if( gsvn.zParentBranch == gsvn.zBranch ){
    gsvn.zParentBranch = 0;
  }
  if( gsvn.flatFlag ){
    gsvn.zBranch = 0;
  }
  blob_reset(&manifest);
}

static u64 svn_get_varint(const char **pz){
  unsigned int v = 0;
  do{
    v = (v<<7) | ((*pz)[0]&0x7f);
................................................................................
      while( lenCpy-- > 0 ){
        *zOut++ = *zCpy++;
      }
    }
    zDiff += lenData;
  }
}

static char *svn_extract_branch(const char *zPath){
  int nFilter = blob_size(&gsvn.filter);
  char *zBranch = 0;
  if( strncmp(zPath, blob_str(&gsvn.filter), nFilter)==0 ){
    if( strncmp(zPath+nFilter, gsvn.zBranches, gsvn.lenBranches)==0 ){
      int lenBranch;
      const char *zTemp = zPath+nFilter+gsvn.lenBranches;
      while( *zTemp && *zTemp!='/' ){ zTemp++; }
      lenBranch = zTemp-(zPath+nFilter+gsvn.lenBranches);
      zTemp = zPath+nFilter+gsvn.lenBranches;
      zBranch = fossil_malloc(lenBranch+1);
      memcpy(zBranch, zTemp, lenBranch);
      zBranch[lenBranch] = '\0';
    }else
    if( strncmp(zPath+nFilter, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
      zBranch = fossil_malloc(gsvn.lenTrunk);
      memcpy(zBranch, gsvn.zTrunk, gsvn.lenTrunk-1);
      zBranch[gsvn.lenTrunk-1] = '\0';
    }
  }
  return zBranch;
}

/*
** Read the svn-dump format from pIn and insert the corresponding
** content into the database.
*/
static void svn_dump_import(FILE *pIn){
  SvnRecord rec;
................................................................................
  int ver;
  const char *zTemp;
  const char *zUuid;
  Stmt addHist;
  Stmt insTag;
  Stmt cpyPath;
  Stmt delPath;
  int bHasFiles = 0;
  int nFilter = blob_size(&gsvn.filter);

  /* version */
  if( svn_read_rec(pIn, &rec)
   && (zTemp = svn_find_header(rec, "SVN-fs-dump-format-version")) ){
    ver = atoi(zTemp);
    if( ver!=2 && ver!=3 ){
      fossil_fatal("Unknown svn-dump format version: %d", ver);
................................................................................
      /* finish previous revision */
      if( bHasFiles ){
        svn_create_manifest();
        fossil_free(gsvn.zUser);
        fossil_free(gsvn.zComment);
        fossil_free(gsvn.zDate);
        fossil_free(gsvn.zBranch);
        fossil_free(gsvn.zParentBranch);
      }
      /* start new revision */
      gsvn.rev = atoi(zTemp);
      gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
      gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
      gsvn.zDate = date_in_standard_format(svn_find_prop(rec, "svn:date"));
      gsvn.parentRev = -1;
      gsvn.zParentBranch = 0;
      gsvn.zBranch = 0;
      bHasFiles = 0;
      fossil_print("\rImporting SVN revision: %d", gsvn.rev);
      db_bind_int(&addHist, ":rev", gsvn.rev);
      db_bind_int(&cpyPath, ":rev", gsvn.rev);
      db_bind_int(&delPath, ":rev", gsvn.rev);
    }else
................................................................................
        if( zTemp ){
          srcRev = atoi(zTemp);
        }else{
          fossil_fatal("Missing copyfrom-rev");
        }
      }
      if( !gsvn.flatFlag ){
        if( (zTemp=svn_extract_branch(zPath))!=0 ){





          if( gsvn.zBranch!=0 ){
            if( strcmp(zTemp, gsvn.zBranch)!=0 ){
              fossil_fatal("Commit to multiple branches");
            }
            fossil_free(zTemp);
          }else{






            gsvn.zBranch = zTemp;







          }
        }
      }
      if( strncmp(zAction, "delete", 6)==0
       || strncmp(zAction, "replace", 7)==0 )
      {
        db_bind_text(&delPath, ":path", zPath);
................................................................................
            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+nFilter, gsvn.zBranches, gsvn.lenBranches)==0 ){
                zTemp = zPath+nFilter+gsvn.lenBranches+strlen(gsvn.zBranch);
                if( *zTemp==0 ){
                  gsvn.parentRev = srcRev;
                  gsvn.zParentBranch = svn_extract_branch(zSrcPath);
                }
              }else if( strncmp(zPath+nFilter, gsvn.zTags, gsvn.lenTags)==0 ){
                zTemp = zPath+nFilter+gsvn.lenTags;
                db_bind_int(&insTag, ":rev", srcRev);
                db_bind_text(&insTag, ":tag", zTemp);
                db_step(&insTag);
                db_reset(&insTag);
              }
            }
          }