Fossil SCM
Write incremental file lists for fast-export.
Commit
433a3c9a7826e55d8d36cde3dc8453bd537f117e
Parent
3ade77897fab979…
1 file changed
+32
-9
+32
-9
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -148,10 +148,11 @@ | ||
| 148 | 148 | const char *zBranch = db_column_text(&q, 4); |
| 149 | 149 | char *zBr; |
| 150 | 150 | Manifest *p; |
| 151 | 151 | ManifestFile *pFile; |
| 152 | 152 | const char *zFromType; |
| 153 | + int parent; | |
| 153 | 154 | |
| 154 | 155 | bag_insert(&vers, ckinId); |
| 155 | 156 | if( zBranch==0 ) zBranch = "trunk"; |
| 156 | 157 | zBr = mprintf("%s", zBranch); |
| 157 | 158 | for(i=0; zBr[i]; i++){ |
| @@ -164,25 +165,47 @@ | ||
| 164 | 165 | printf(" %s +0000\n", zSecondsSince1970); |
| 165 | 166 | if( zComment==0 ) zComment = "null comment"; |
| 166 | 167 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 167 | 168 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 168 | 169 | zFromType = "from"; |
| 170 | + parent = 0; | |
| 169 | 171 | for(i=0; i<p->nParent; i++){ |
| 170 | 172 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 171 | 173 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 174 | + if( i==0) parent = pid; | |
| 172 | 175 | printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); |
| 173 | 176 | zFromType = "merge"; |
| 174 | 177 | } |
| 175 | - printf("deleteall\n"); | |
| 176 | - manifest_file_rewind(p); | |
| 177 | - while( (pFile=manifest_file_next(p, 0))!=0 ){ | |
| 178 | - int fid = fast_uuid_to_rid(pFile->zUuid); | |
| 179 | - const char *zPerm = "100644"; | |
| 180 | - if( fid==0 ) continue; | |
| 181 | - if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; | |
| 182 | - if( !bag_find(&blobs, fid) ) continue; | |
| 183 | - printf("M %s :%d %s\n", zPerm, fid, pFile->zName); | |
| 178 | + if( parent==0 ) { | |
| 179 | + printf("deleteall\n"); | |
| 180 | + manifest_file_rewind(p); | |
| 181 | + while( (pFile=manifest_file_next(p, 0))!=0 ){ | |
| 182 | + int fid = fast_uuid_to_rid(pFile->zUuid); | |
| 183 | + const char *zPerm = "100644"; | |
| 184 | + if( fid==0 ) continue; | |
| 185 | + if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; | |
| 186 | + if( !bag_find(&blobs, fid) ) continue; | |
| 187 | + printf("M %s :%d %s\n", zPerm, fid, pFile->zName); | |
| 188 | + } | |
| 189 | + }else{ | |
| 190 | + Stmt q2; | |
| 191 | + db_prepare(&q2, | |
| 192 | + "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink" | |
| 193 | + " JOIN filename ON filename.fnid=mlink.fnid" | |
| 194 | + " WHERE mlink.mid=%d", | |
| 195 | + parent | |
| 196 | + ); | |
| 197 | + while( db_step(&q2)==SQLITE_ROW ){ | |
| 198 | + const char *zName = db_column_text(&q2,0); | |
| 199 | + int zNew = db_column_int(&q2,1); | |
| 200 | + int mPerm = db_column_int(&q2,2); | |
| 201 | + if( zNew==0) | |
| 202 | + printf("D %s\n", zName); | |
| 203 | + else | |
| 204 | + printf("M %s :%d %s\n", mPerm ? "100755" : "100644", zNew, zName); | |
| 205 | + } | |
| 206 | + db_finalize(&q2); | |
| 184 | 207 | } |
| 185 | 208 | manifest_cache_insert(p); |
| 186 | 209 | printf("\n"); |
| 187 | 210 | } |
| 188 | 211 | db_finalize(&q); |
| 189 | 212 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -148,10 +148,11 @@ | |
| 148 | const char *zBranch = db_column_text(&q, 4); |
| 149 | char *zBr; |
| 150 | Manifest *p; |
| 151 | ManifestFile *pFile; |
| 152 | const char *zFromType; |
| 153 | |
| 154 | bag_insert(&vers, ckinId); |
| 155 | if( zBranch==0 ) zBranch = "trunk"; |
| 156 | zBr = mprintf("%s", zBranch); |
| 157 | for(i=0; zBr[i]; i++){ |
| @@ -164,25 +165,47 @@ | |
| 164 | printf(" %s +0000\n", zSecondsSince1970); |
| 165 | if( zComment==0 ) zComment = "null comment"; |
| 166 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 167 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 168 | zFromType = "from"; |
| 169 | for(i=0; i<p->nParent; i++){ |
| 170 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 171 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 172 | printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); |
| 173 | zFromType = "merge"; |
| 174 | } |
| 175 | printf("deleteall\n"); |
| 176 | manifest_file_rewind(p); |
| 177 | while( (pFile=manifest_file_next(p, 0))!=0 ){ |
| 178 | int fid = fast_uuid_to_rid(pFile->zUuid); |
| 179 | const char *zPerm = "100644"; |
| 180 | if( fid==0 ) continue; |
| 181 | if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; |
| 182 | if( !bag_find(&blobs, fid) ) continue; |
| 183 | printf("M %s :%d %s\n", zPerm, fid, pFile->zName); |
| 184 | } |
| 185 | manifest_cache_insert(p); |
| 186 | printf("\n"); |
| 187 | } |
| 188 | db_finalize(&q); |
| 189 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -148,10 +148,11 @@ | |
| 148 | const char *zBranch = db_column_text(&q, 4); |
| 149 | char *zBr; |
| 150 | Manifest *p; |
| 151 | ManifestFile *pFile; |
| 152 | const char *zFromType; |
| 153 | int parent; |
| 154 | |
| 155 | bag_insert(&vers, ckinId); |
| 156 | if( zBranch==0 ) zBranch = "trunk"; |
| 157 | zBr = mprintf("%s", zBranch); |
| 158 | for(i=0; zBr[i]; i++){ |
| @@ -164,25 +165,47 @@ | |
| 165 | printf(" %s +0000\n", zSecondsSince1970); |
| 166 | if( zComment==0 ) zComment = "null comment"; |
| 167 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 168 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 169 | zFromType = "from"; |
| 170 | parent = 0; |
| 171 | for(i=0; i<p->nParent; i++){ |
| 172 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 173 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 174 | if( i==0) parent = pid; |
| 175 | printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); |
| 176 | zFromType = "merge"; |
| 177 | } |
| 178 | if( parent==0 ) { |
| 179 | printf("deleteall\n"); |
| 180 | manifest_file_rewind(p); |
| 181 | while( (pFile=manifest_file_next(p, 0))!=0 ){ |
| 182 | int fid = fast_uuid_to_rid(pFile->zUuid); |
| 183 | const char *zPerm = "100644"; |
| 184 | if( fid==0 ) continue; |
| 185 | if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; |
| 186 | if( !bag_find(&blobs, fid) ) continue; |
| 187 | printf("M %s :%d %s\n", zPerm, fid, pFile->zName); |
| 188 | } |
| 189 | }else{ |
| 190 | Stmt q2; |
| 191 | db_prepare(&q2, |
| 192 | "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink" |
| 193 | " JOIN filename ON filename.fnid=mlink.fnid" |
| 194 | " WHERE mlink.mid=%d", |
| 195 | parent |
| 196 | ); |
| 197 | while( db_step(&q2)==SQLITE_ROW ){ |
| 198 | const char *zName = db_column_text(&q2,0); |
| 199 | int zNew = db_column_int(&q2,1); |
| 200 | int mPerm = db_column_int(&q2,2); |
| 201 | if( zNew==0) |
| 202 | printf("D %s\n", zName); |
| 203 | else |
| 204 | printf("M %s :%d %s\n", mPerm ? "100755" : "100644", zNew, zName); |
| 205 | } |
| 206 | db_finalize(&q2); |
| 207 | } |
| 208 | manifest_cache_insert(p); |
| 209 | printf("\n"); |
| 210 | } |
| 211 | db_finalize(&q); |
| 212 |