Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix --filter option |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | svn-import |
Files: | files | file ages | folders |
SHA1: | 64c65816dadaab71c32e118b0a47fd40 |
User & Date: | baruch 2014-11-04 12:29:57 |
Context
2014-11-05
| ||
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 | |
10:36 | Fix --flat option check-in: 57fa3896 user: baruch tags: svn-import | |
Changes
Changes to src/import.c.
907 908 909 910 911 912 913 914 915 916 917 918 919 920 ... 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 .... 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 .... 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 |
static Stmt qTags; int nBaseFilter; int nFilter; int rid; const char *zParentBranch = 0; Blob mcksum; 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"); ................................................................................ blob_zero(&manifest); 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); 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); ................................................................................ blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); } md5sum_blob(&manifest, &mcksum); blob_appendf(&manifest, "Z %b\n", &mcksum); blob_reset(&mcksum); rid = content_put(&manifest); blob_reset(&manifest); db_bind_int(&insRev, ":rev", gsvn.rev); db_bind_text(&insRev, ":branch", gsvn.zBranch); db_bind_int(&insRev, ":rid", rid); db_step(&insRev); } static u64 svn_get_varint(const char **pz){ unsigned int v = 0; do{ v = (v<<7) | ((*pz)[0]&0x7f); }while( (*pz)++[0]&0x80 ); ................................................................................ ** behaviour is to treat 3 folders in the SVN root as special, ** following the common layout of SVN repositories. These are ** (by default) trunk/, branches/ and tags/ ** Options: ** --trunk FOLDER Name of trunk folder ** --branches FOLDER Name of branches folder ** --tags FOLDER Name of tags folder ** --fiter PATH Path to project root in repository ** --flat The whole dump is a single branch ** ** The --incremental option allows an existing repository to be extended ** with new content. ** ** Options: ** --incremental allow importing into an existing repository |
> > > > > > > > > > > > > > > > | < < < < < < < < < < < > | |
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 ... 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 .... 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 .... 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 |
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); } if( db_int(0, "SELECT 1 FROM xhist WHERE trev=%d AND tpath GLOB %Q LIMIT 1", gsvn.rev, blob_str(&gsvn.filter))==0 ){ 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"); ................................................................................ blob_zero(&manifest); 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); nFilter = blob_size(&gsvn.filter)-1; db_bind_text(&qFiles, ":filter", blob_str(&gsvn.filter)); 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); 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); ................................................................................ blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); } md5sum_blob(&manifest, &mcksum); blob_appendf(&manifest, "Z %b\n", &mcksum); 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( (*pz)++[0]&0x80 ); ................................................................................ ** behaviour is to treat 3 folders in the SVN root as special, ** following the common layout of SVN repositories. These are ** (by default) trunk/, branches/ and tags/ ** Options: ** --trunk FOLDER Name of trunk folder ** --branches FOLDER Name of branches folder ** --tags FOLDER Name of tags folder ** --filter PATH Path to project root in repository ** --flat The whole dump is a single branch ** ** The --incremental option allows an existing repository to be extended ** with new content. ** ** Options: ** --incremental allow importing into an existing repository |