Fossil SCM
For the git-fast-export interchange format, make sure labels for blobs and labels for check-ins do not collide since git cannot deal with that. Ticket [536c3399075d06]
Commit
d45502b066b03052682e723d0e03e0bf12960483
Parent
fc6aea52baa78b1…
1 file changed
+5
-3
+5
-3
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -99,10 +99,11 @@ | ||
| 99 | 99 | ** or wiki or events or attachments, so none of those are exported. |
| 100 | 100 | */ |
| 101 | 101 | void export_cmd(void){ |
| 102 | 102 | Stmt q; |
| 103 | 103 | int i; |
| 104 | + int firstCkin; /* Integer offset to check-in marks */ | |
| 104 | 105 | Bag blobs, vers; |
| 105 | 106 | bag_init(&blobs); |
| 106 | 107 | bag_init(&vers); |
| 107 | 108 | |
| 108 | 109 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| @@ -127,10 +128,11 @@ | ||
| 127 | 128 | } |
| 128 | 129 | db_finalize(&q); |
| 129 | 130 | |
| 130 | 131 | /* Output the commit records. |
| 131 | 132 | */ |
| 133 | + firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1; | |
| 132 | 134 | db_prepare(&q, |
| 133 | 135 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 134 | 136 | " coalesce(user,euser)," |
| 135 | 137 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 136 | 138 | " FROM event" |
| @@ -153,11 +155,11 @@ | ||
| 153 | 155 | if( zBranch==0 ) zBranch = "trunk"; |
| 154 | 156 | zBr = mprintf("%s", zBranch); |
| 155 | 157 | for(i=0; zBr[i]; i++){ |
| 156 | 158 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 157 | 159 | } |
| 158 | - printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId); | |
| 160 | + printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin); | |
| 159 | 161 | free(zBr); |
| 160 | 162 | printf("committer"); |
| 161 | 163 | print_person(zUser); |
| 162 | 164 | printf(" %lld +0000\n", secondsSince1970); |
| 163 | 165 | if( zComment==0 ) zComment = "null comment"; |
| @@ -165,11 +167,11 @@ | ||
| 165 | 167 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 166 | 168 | zFromType = "from"; |
| 167 | 169 | for(i=0; i<p->nParent; i++){ |
| 168 | 170 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 169 | 171 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 170 | - printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])); | |
| 172 | + printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); | |
| 171 | 173 | zFromType = "merge"; |
| 172 | 174 | } |
| 173 | 175 | printf("deleteall\n"); |
| 174 | 176 | manifest_file_rewind(p); |
| 175 | 177 | while( (pFile=manifest_file_next(p, 0))!=0 ){ |
| @@ -198,12 +200,12 @@ | ||
| 198 | 200 | int rid = db_column_int(&q, 1); |
| 199 | 201 | sqlite3_int64 secSince1970 = db_column_int64(&q, 2); |
| 200 | 202 | if( rid==0 || !bag_find(&vers, rid) ) continue; |
| 201 | 203 | zTagname += 4; |
| 202 | 204 | printf("tag %s\n", zTagname); |
| 203 | - printf("from :%d\n", rid); | |
| 205 | + printf("from :%d\n", rid+firstCkin); | |
| 204 | 206 | printf("tagger <tagger> %lld +0000\n", secSince1970); |
| 205 | 207 | printf("data 0\n"); |
| 206 | 208 | } |
| 207 | 209 | db_finalize(&q); |
| 208 | 210 | bag_clear(&vers); |
| 209 | 211 | } |
| 210 | 212 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -99,10 +99,11 @@ | |
| 99 | ** or wiki or events or attachments, so none of those are exported. |
| 100 | */ |
| 101 | void export_cmd(void){ |
| 102 | Stmt q; |
| 103 | int i; |
| 104 | Bag blobs, vers; |
| 105 | bag_init(&blobs); |
| 106 | bag_init(&vers); |
| 107 | |
| 108 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| @@ -127,10 +128,11 @@ | |
| 127 | } |
| 128 | db_finalize(&q); |
| 129 | |
| 130 | /* Output the commit records. |
| 131 | */ |
| 132 | db_prepare(&q, |
| 133 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 134 | " coalesce(user,euser)," |
| 135 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 136 | " FROM event" |
| @@ -153,11 +155,11 @@ | |
| 153 | if( zBranch==0 ) zBranch = "trunk"; |
| 154 | zBr = mprintf("%s", zBranch); |
| 155 | for(i=0; zBr[i]; i++){ |
| 156 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 157 | } |
| 158 | printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId); |
| 159 | free(zBr); |
| 160 | printf("committer"); |
| 161 | print_person(zUser); |
| 162 | printf(" %lld +0000\n", secondsSince1970); |
| 163 | if( zComment==0 ) zComment = "null comment"; |
| @@ -165,11 +167,11 @@ | |
| 165 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 166 | zFromType = "from"; |
| 167 | for(i=0; i<p->nParent; i++){ |
| 168 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 169 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 170 | printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])); |
| 171 | zFromType = "merge"; |
| 172 | } |
| 173 | printf("deleteall\n"); |
| 174 | manifest_file_rewind(p); |
| 175 | while( (pFile=manifest_file_next(p, 0))!=0 ){ |
| @@ -198,12 +200,12 @@ | |
| 198 | int rid = db_column_int(&q, 1); |
| 199 | sqlite3_int64 secSince1970 = db_column_int64(&q, 2); |
| 200 | if( rid==0 || !bag_find(&vers, rid) ) continue; |
| 201 | zTagname += 4; |
| 202 | printf("tag %s\n", zTagname); |
| 203 | printf("from :%d\n", rid); |
| 204 | printf("tagger <tagger> %lld +0000\n", secSince1970); |
| 205 | printf("data 0\n"); |
| 206 | } |
| 207 | db_finalize(&q); |
| 208 | bag_clear(&vers); |
| 209 | } |
| 210 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -99,10 +99,11 @@ | |
| 99 | ** or wiki or events or attachments, so none of those are exported. |
| 100 | */ |
| 101 | void export_cmd(void){ |
| 102 | Stmt q; |
| 103 | int i; |
| 104 | int firstCkin; /* Integer offset to check-in marks */ |
| 105 | Bag blobs, vers; |
| 106 | bag_init(&blobs); |
| 107 | bag_init(&vers); |
| 108 | |
| 109 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| @@ -127,10 +128,11 @@ | |
| 128 | } |
| 129 | db_finalize(&q); |
| 130 | |
| 131 | /* Output the commit records. |
| 132 | */ |
| 133 | firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1; |
| 134 | db_prepare(&q, |
| 135 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 136 | " coalesce(user,euser)," |
| 137 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 138 | " FROM event" |
| @@ -153,11 +155,11 @@ | |
| 155 | if( zBranch==0 ) zBranch = "trunk"; |
| 156 | zBr = mprintf("%s", zBranch); |
| 157 | for(i=0; zBr[i]; i++){ |
| 158 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 159 | } |
| 160 | printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin); |
| 161 | free(zBr); |
| 162 | printf("committer"); |
| 163 | print_person(zUser); |
| 164 | printf(" %lld +0000\n", secondsSince1970); |
| 165 | if( zComment==0 ) zComment = "null comment"; |
| @@ -165,11 +167,11 @@ | |
| 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 ){ |
| @@ -198,12 +200,12 @@ | |
| 200 | int rid = db_column_int(&q, 1); |
| 201 | sqlite3_int64 secSince1970 = db_column_int64(&q, 2); |
| 202 | if( rid==0 || !bag_find(&vers, rid) ) continue; |
| 203 | zTagname += 4; |
| 204 | printf("tag %s\n", zTagname); |
| 205 | printf("from :%d\n", rid+firstCkin); |
| 206 | printf("tagger <tagger> %lld +0000\n", secSince1970); |
| 207 | printf("data 0\n"); |
| 208 | } |
| 209 | db_finalize(&q); |
| 210 | bag_clear(&vers); |
| 211 | } |
| 212 |