Fossil SCM
support copying files (no folders support yet)
Commit
0edbf144f3675633d7b450c3c2ed4b1abdfe1026
Parent
332788691888bea…
1 file changed
+10
-7
+10
-7
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -868,17 +868,15 @@ | ||
| 868 | 868 | blob_zero(&rec->content); |
| 869 | 869 | zLen = svn_find_header(*rec, "Text-content-length"); |
| 870 | 870 | if( zLen ){ |
| 871 | 871 | nLen = atoi(zLen); |
| 872 | 872 | } |
| 873 | - if( nLen>=0 ){ | |
| 874 | - blob_read_from_channel(&rec->content, pIn, nLen); | |
| 875 | - if( blob_size(&rec->content)!=nLen ){ | |
| 876 | - fossil_fatal("short read: got %d of %d bytes", | |
| 877 | - blob_size(&rec->content), nLen | |
| 878 | - ); | |
| 879 | - } | |
| 873 | + blob_read_from_channel(&rec->content, pIn, nLen); | |
| 874 | + if( blob_size(&rec->content)!=nLen ){ | |
| 875 | + fossil_fatal("short read: got %d of %d bytes", | |
| 876 | + blob_size(&rec->content), nLen | |
| 877 | + ); | |
| 880 | 878 | } |
| 881 | 879 | return 1; |
| 882 | 880 | } |
| 883 | 881 | |
| 884 | 882 | static void svn_create_manifests(){ |
| @@ -1023,10 +1021,15 @@ | ||
| 1023 | 1021 | fossil_fatal("Missing copyfrom-rev"); |
| 1024 | 1022 | } |
| 1025 | 1023 | } |
| 1026 | 1024 | rid = content_put(&rec.content); |
| 1027 | 1025 | if( strncmp(zAction, "add", 3)==0 ){ |
| 1026 | + if( blob_size(&rec.content)>0 && zSrcPath!=0 ){ | |
| 1027 | + rid = db_int(rid, | |
| 1028 | + "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q", | |
| 1029 | + srcRev, zSrcPath); | |
| 1030 | + } | |
| 1028 | 1031 | db_bind_int(&insFile, ":rev", rev); |
| 1029 | 1032 | db_bind_int(&insFile, ":rid", rid); |
| 1030 | 1033 | db_bind_text(&insFile, ":path", zPath); |
| 1031 | 1034 | db_bind_text(&insFile, ":perm", zPerm); |
| 1032 | 1035 | db_step(&insFile); |
| 1033 | 1036 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -868,17 +868,15 @@ | |
| 868 | blob_zero(&rec->content); |
| 869 | zLen = svn_find_header(*rec, "Text-content-length"); |
| 870 | if( zLen ){ |
| 871 | nLen = atoi(zLen); |
| 872 | } |
| 873 | if( nLen>=0 ){ |
| 874 | blob_read_from_channel(&rec->content, pIn, nLen); |
| 875 | if( blob_size(&rec->content)!=nLen ){ |
| 876 | fossil_fatal("short read: got %d of %d bytes", |
| 877 | blob_size(&rec->content), nLen |
| 878 | ); |
| 879 | } |
| 880 | } |
| 881 | return 1; |
| 882 | } |
| 883 | |
| 884 | static void svn_create_manifests(){ |
| @@ -1023,10 +1021,15 @@ | |
| 1023 | fossil_fatal("Missing copyfrom-rev"); |
| 1024 | } |
| 1025 | } |
| 1026 | rid = content_put(&rec.content); |
| 1027 | if( strncmp(zAction, "add", 3)==0 ){ |
| 1028 | db_bind_int(&insFile, ":rev", rev); |
| 1029 | db_bind_int(&insFile, ":rid", rid); |
| 1030 | db_bind_text(&insFile, ":path", zPath); |
| 1031 | db_bind_text(&insFile, ":perm", zPerm); |
| 1032 | db_step(&insFile); |
| 1033 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -868,17 +868,15 @@ | |
| 868 | blob_zero(&rec->content); |
| 869 | zLen = svn_find_header(*rec, "Text-content-length"); |
| 870 | if( zLen ){ |
| 871 | nLen = atoi(zLen); |
| 872 | } |
| 873 | blob_read_from_channel(&rec->content, pIn, nLen); |
| 874 | if( blob_size(&rec->content)!=nLen ){ |
| 875 | fossil_fatal("short read: got %d of %d bytes", |
| 876 | blob_size(&rec->content), nLen |
| 877 | ); |
| 878 | } |
| 879 | return 1; |
| 880 | } |
| 881 | |
| 882 | static void svn_create_manifests(){ |
| @@ -1023,10 +1021,15 @@ | |
| 1021 | fossil_fatal("Missing copyfrom-rev"); |
| 1022 | } |
| 1023 | } |
| 1024 | rid = content_put(&rec.content); |
| 1025 | if( strncmp(zAction, "add", 3)==0 ){ |
| 1026 | if( blob_size(&rec.content)>0 && zSrcPath!=0 ){ |
| 1027 | rid = db_int(rid, |
| 1028 | "SELECT trid FROM xfiles WHERE trev=%d AND tpath=%Q", |
| 1029 | srcRev, zSrcPath); |
| 1030 | } |
| 1031 | db_bind_int(&insFile, ":rev", rev); |
| 1032 | db_bind_int(&insFile, ":rid", rid); |
| 1033 | db_bind_text(&insFile, ":path", zPath); |
| 1034 | db_bind_text(&insFile, ":perm", zPerm); |
| 1035 | db_step(&insFile); |
| 1036 |