Fossil SCM

viric's flavour of fossil, which includes the cherry-picked changes out of trunk: [d0b1b1114] [39e165afb] [dad37196f] [f309130a8]. This outdates the branch annotate_links ([f14798e0e3]), which has some extra changes, some hard to port. This lets the browser pick the right program to open them straight.

viriketo 2015-02-09 11:00 trunk
Commit b31afcc2cab1dc43bddaacc8b0bb223f8237ee87
+3
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182182
{ "mpga", 4, "audio/mpeg" },
183183
{ "ms", 2, "application/x-troff-ms" },
184184
{ "msh", 3, "model/mesh" },
185185
{ "nc", 2, "application/x-netcdf" },
186186
{ "oda", 3, "application/oda" },
187
+ { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188
+ { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189
+ { "odt", 3, "application/vnd.oasis.opendocument.text" },
187190
{ "ogg", 3, "application/ogg" },
188191
{ "ogm", 3, "application/ogg" },
189192
{ "pbm", 3, "image/x-portable-bitmap" },
190193
{ "pdb", 3, "chemical/x-pdb" },
191194
{ "pdf", 3, "application/pdf" },
192195
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
 
 
 
187 { "ogg", 3, "application/ogg" },
188 { "ogm", 3, "application/ogg" },
189 { "pbm", 3, "image/x-portable-bitmap" },
190 { "pdb", 3, "chemical/x-pdb" },
191 { "pdf", 3, "application/pdf" },
192
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
187 { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188 { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189 { "odt", 3, "application/vnd.oasis.opendocument.text" },
190 { "ogg", 3, "application/ogg" },
191 { "ogm", 3, "application/ogg" },
192 { "pbm", 3, "image/x-portable-bitmap" },
193 { "pdb", 3, "chemical/x-pdb" },
194 { "pdf", 3, "application/pdf" },
195
+3
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182182
{ "mpga", 4, "audio/mpeg" },
183183
{ "ms", 2, "application/x-troff-ms" },
184184
{ "msh", 3, "model/mesh" },
185185
{ "nc", 2, "application/x-netcdf" },
186186
{ "oda", 3, "application/oda" },
187
+ { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188
+ { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189
+ { "odt", 3, "application/vnd.oasis.opendocument.text" },
187190
{ "ogg", 3, "application/ogg" },
188191
{ "ogm", 3, "application/ogg" },
189192
{ "pbm", 3, "image/x-portable-bitmap" },
190193
{ "pdb", 3, "chemical/x-pdb" },
191194
{ "pdf", 3, "application/pdf" },
192195
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
 
 
 
187 { "ogg", 3, "application/ogg" },
188 { "ogm", 3, "application/ogg" },
189 { "pbm", 3, "image/x-portable-bitmap" },
190 { "pdb", 3, "chemical/x-pdb" },
191 { "pdf", 3, "application/pdf" },
192
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
187 { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188 { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189 { "odt", 3, "application/vnd.oasis.opendocument.text" },
190 { "ogg", 3, "application/ogg" },
191 { "ogm", 3, "application/ogg" },
192 { "pbm", 3, "image/x-portable-bitmap" },
193 { "pdb", 3, "chemical/x-pdb" },
194 { "pdf", 3, "application/pdf" },
195
+3
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182182
{ "mpga", 4, "audio/mpeg" },
183183
{ "ms", 2, "application/x-troff-ms" },
184184
{ "msh", 3, "model/mesh" },
185185
{ "nc", 2, "application/x-netcdf" },
186186
{ "oda", 3, "application/oda" },
187
+ { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188
+ { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189
+ { "odt", 3, "application/vnd.oasis.opendocument.text" },
187190
{ "ogg", 3, "application/ogg" },
188191
{ "ogm", 3, "application/ogg" },
189192
{ "pbm", 3, "image/x-portable-bitmap" },
190193
{ "pdb", 3, "chemical/x-pdb" },
191194
{ "pdf", 3, "application/pdf" },
192195
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
 
 
 
187 { "ogg", 3, "application/ogg" },
188 { "ogm", 3, "application/ogg" },
189 { "pbm", 3, "image/x-portable-bitmap" },
190 { "pdb", 3, "chemical/x-pdb" },
191 { "pdf", 3, "application/pdf" },
192
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
187 { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188 { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189 { "odt", 3, "application/vnd.oasis.opendocument.text" },
190 { "ogg", 3, "application/ogg" },
191 { "ogm", 3, "application/ogg" },
192 { "pbm", 3, "image/x-portable-bitmap" },
193 { "pdb", 3, "chemical/x-pdb" },
194 { "pdf", 3, "application/pdf" },
195
+3
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182182
{ "mpga", 4, "audio/mpeg" },
183183
{ "ms", 2, "application/x-troff-ms" },
184184
{ "msh", 3, "model/mesh" },
185185
{ "nc", 2, "application/x-netcdf" },
186186
{ "oda", 3, "application/oda" },
187
+ { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188
+ { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189
+ { "odt", 3, "application/vnd.oasis.opendocument.text" },
187190
{ "ogg", 3, "application/ogg" },
188191
{ "ogm", 3, "application/ogg" },
189192
{ "pbm", 3, "image/x-portable-bitmap" },
190193
{ "pdb", 3, "chemical/x-pdb" },
191194
{ "pdf", 3, "application/pdf" },
192195
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
 
 
 
187 { "ogg", 3, "application/ogg" },
188 { "ogm", 3, "application/ogg" },
189 { "pbm", 3, "image/x-portable-bitmap" },
190 { "pdb", 3, "chemical/x-pdb" },
191 { "pdf", 3, "application/pdf" },
192
--- src/doc.c
+++ src/doc.c
@@ -182,10 +182,13 @@
182 { "mpga", 4, "audio/mpeg" },
183 { "ms", 2, "application/x-troff-ms" },
184 { "msh", 3, "model/mesh" },
185 { "nc", 2, "application/x-netcdf" },
186 { "oda", 3, "application/oda" },
187 { "odp", 3, "application/vnd.oasis.opendocument.presentation" },
188 { "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
189 { "odt", 3, "application/vnd.oasis.opendocument.text" },
190 { "ogg", 3, "application/ogg" },
191 { "ogm", 3, "application/ogg" },
192 { "pbm", 3, "image/x-portable-bitmap" },
193 { "pdb", 3, "chemical/x-pdb" },
194 { "pdf", 3, "application/pdf" },
195
+8 -1
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674674
@ <td>
675675
@ %z(href("%R/tree?ci=%S",zUuid))files</a>
676676
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677677
@ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678678
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679
+ @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680
+ @ changes over parent branch</a>
679681
if( g.perm.Write ){
680682
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681683
}
682684
@ </td>
683685
@ </tr>
@@ -907,29 +909,34 @@
907909
static void checkin_description(int rid){
908910
Stmt q;
909911
db_prepare(&q,
910912
"SELECT datetime(mtime), coalesce(euser,user),"
911913
" coalesce(ecomment,comment), uuid,"
914
+ " coalesce((SELECT value FROM tagxref"
915
+ " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
912916
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913917
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914918
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915919
" FROM event, blob"
916920
" WHERE event.objid=%d AND type='ci'"
917921
" AND blob.rid=%d",
918
- rid, rid
922
+ TAG_BRANCH, rid, rid
919923
);
920924
while( db_step(&q)==SQLITE_ROW ){
921925
const char *zDate = db_column_text(&q, 0);
922926
const char *zUser = db_column_text(&q, 1);
923927
const char *zUuid = db_column_text(&q, 3);
928
+ const char *zBranch = db_column_text(&q, 4);
924929
const char *zTagList = db_column_text(&q, 4);
925930
Blob comment;
926931
int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927932
if( db_get_boolean("timeline-block-markup", 0)==0 ){
928933
wikiFlags |= WIKI_NOBLOCK;
929934
}
930935
hyperlink_to_uuid(zUuid);
936
+ @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937
+ @ %s(zBranch)</a> -
931938
blob_zero(&comment);
932939
db_column_blob(&q, 2, &comment);
933940
wiki_convert(&comment, 0, wikiFlags);
934941
blob_reset(&comment);
935942
@ (user:
936943
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
 
 
679 if( g.perm.Write ){
680 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681 }
682 @ </td>
683 @ </tr>
@@ -907,29 +909,34 @@
907 static void checkin_description(int rid){
908 Stmt q;
909 db_prepare(&q,
910 "SELECT datetime(mtime), coalesce(euser,user),"
911 " coalesce(ecomment,comment), uuid,"
 
 
912 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915 " FROM event, blob"
916 " WHERE event.objid=%d AND type='ci'"
917 " AND blob.rid=%d",
918 rid, rid
919 );
920 while( db_step(&q)==SQLITE_ROW ){
921 const char *zDate = db_column_text(&q, 0);
922 const char *zUser = db_column_text(&q, 1);
923 const char *zUuid = db_column_text(&q, 3);
 
924 const char *zTagList = db_column_text(&q, 4);
925 Blob comment;
926 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927 if( db_get_boolean("timeline-block-markup", 0)==0 ){
928 wikiFlags |= WIKI_NOBLOCK;
929 }
930 hyperlink_to_uuid(zUuid);
 
 
931 blob_zero(&comment);
932 db_column_blob(&q, 2, &comment);
933 wiki_convert(&comment, 0, wikiFlags);
934 blob_reset(&comment);
935 @ (user:
936
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679 @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680 @ changes over parent branch</a>
681 if( g.perm.Write ){
682 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
683 }
684 @ </td>
685 @ </tr>
@@ -907,29 +909,34 @@
909 static void checkin_description(int rid){
910 Stmt q;
911 db_prepare(&q,
912 "SELECT datetime(mtime), coalesce(euser,user),"
913 " coalesce(ecomment,comment), uuid,"
914 " coalesce((SELECT value FROM tagxref"
915 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
916 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
917 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
918 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
919 " FROM event, blob"
920 " WHERE event.objid=%d AND type='ci'"
921 " AND blob.rid=%d",
922 TAG_BRANCH, rid, rid
923 );
924 while( db_step(&q)==SQLITE_ROW ){
925 const char *zDate = db_column_text(&q, 0);
926 const char *zUser = db_column_text(&q, 1);
927 const char *zUuid = db_column_text(&q, 3);
928 const char *zBranch = db_column_text(&q, 4);
929 const char *zTagList = db_column_text(&q, 4);
930 Blob comment;
931 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
932 if( db_get_boolean("timeline-block-markup", 0)==0 ){
933 wikiFlags |= WIKI_NOBLOCK;
934 }
935 hyperlink_to_uuid(zUuid);
936 @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937 @ %s(zBranch)</a> -
938 blob_zero(&comment);
939 db_column_blob(&q, 2, &comment);
940 wiki_convert(&comment, 0, wikiFlags);
941 blob_reset(&comment);
942 @ (user:
943
+8 -1
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674674
@ <td>
675675
@ %z(href("%R/tree?ci=%S",zUuid))files</a>
676676
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677677
@ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678678
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679
+ @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680
+ @ changes over parent branch</a>
679681
if( g.perm.Write ){
680682
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681683
}
682684
@ </td>
683685
@ </tr>
@@ -907,29 +909,34 @@
907909
static void checkin_description(int rid){
908910
Stmt q;
909911
db_prepare(&q,
910912
"SELECT datetime(mtime), coalesce(euser,user),"
911913
" coalesce(ecomment,comment), uuid,"
914
+ " coalesce((SELECT value FROM tagxref"
915
+ " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
912916
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913917
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914918
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915919
" FROM event, blob"
916920
" WHERE event.objid=%d AND type='ci'"
917921
" AND blob.rid=%d",
918
- rid, rid
922
+ TAG_BRANCH, rid, rid
919923
);
920924
while( db_step(&q)==SQLITE_ROW ){
921925
const char *zDate = db_column_text(&q, 0);
922926
const char *zUser = db_column_text(&q, 1);
923927
const char *zUuid = db_column_text(&q, 3);
928
+ const char *zBranch = db_column_text(&q, 4);
924929
const char *zTagList = db_column_text(&q, 4);
925930
Blob comment;
926931
int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927932
if( db_get_boolean("timeline-block-markup", 0)==0 ){
928933
wikiFlags |= WIKI_NOBLOCK;
929934
}
930935
hyperlink_to_uuid(zUuid);
936
+ @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937
+ @ %s(zBranch)</a> -
931938
blob_zero(&comment);
932939
db_column_blob(&q, 2, &comment);
933940
wiki_convert(&comment, 0, wikiFlags);
934941
blob_reset(&comment);
935942
@ (user:
936943
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
 
 
679 if( g.perm.Write ){
680 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681 }
682 @ </td>
683 @ </tr>
@@ -907,29 +909,34 @@
907 static void checkin_description(int rid){
908 Stmt q;
909 db_prepare(&q,
910 "SELECT datetime(mtime), coalesce(euser,user),"
911 " coalesce(ecomment,comment), uuid,"
 
 
912 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915 " FROM event, blob"
916 " WHERE event.objid=%d AND type='ci'"
917 " AND blob.rid=%d",
918 rid, rid
919 );
920 while( db_step(&q)==SQLITE_ROW ){
921 const char *zDate = db_column_text(&q, 0);
922 const char *zUser = db_column_text(&q, 1);
923 const char *zUuid = db_column_text(&q, 3);
 
924 const char *zTagList = db_column_text(&q, 4);
925 Blob comment;
926 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927 if( db_get_boolean("timeline-block-markup", 0)==0 ){
928 wikiFlags |= WIKI_NOBLOCK;
929 }
930 hyperlink_to_uuid(zUuid);
 
 
931 blob_zero(&comment);
932 db_column_blob(&q, 2, &comment);
933 wiki_convert(&comment, 0, wikiFlags);
934 blob_reset(&comment);
935 @ (user:
936
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679 @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680 @ changes over parent branch</a>
681 if( g.perm.Write ){
682 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
683 }
684 @ </td>
685 @ </tr>
@@ -907,29 +909,34 @@
909 static void checkin_description(int rid){
910 Stmt q;
911 db_prepare(&q,
912 "SELECT datetime(mtime), coalesce(euser,user),"
913 " coalesce(ecomment,comment), uuid,"
914 " coalesce((SELECT value FROM tagxref"
915 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
916 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
917 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
918 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
919 " FROM event, blob"
920 " WHERE event.objid=%d AND type='ci'"
921 " AND blob.rid=%d",
922 TAG_BRANCH, rid, rid
923 );
924 while( db_step(&q)==SQLITE_ROW ){
925 const char *zDate = db_column_text(&q, 0);
926 const char *zUser = db_column_text(&q, 1);
927 const char *zUuid = db_column_text(&q, 3);
928 const char *zBranch = db_column_text(&q, 4);
929 const char *zTagList = db_column_text(&q, 4);
930 Blob comment;
931 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
932 if( db_get_boolean("timeline-block-markup", 0)==0 ){
933 wikiFlags |= WIKI_NOBLOCK;
934 }
935 hyperlink_to_uuid(zUuid);
936 @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937 @ %s(zBranch)</a> -
938 blob_zero(&comment);
939 db_column_blob(&q, 2, &comment);
940 wiki_convert(&comment, 0, wikiFlags);
941 blob_reset(&comment);
942 @ (user:
943
+8 -1
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674674
@ <td>
675675
@ %z(href("%R/tree?ci=%S",zUuid))files</a>
676676
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677677
@ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678678
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679
+ @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680
+ @ changes over parent branch</a>
679681
if( g.perm.Write ){
680682
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681683
}
682684
@ </td>
683685
@ </tr>
@@ -907,29 +909,34 @@
907909
static void checkin_description(int rid){
908910
Stmt q;
909911
db_prepare(&q,
910912
"SELECT datetime(mtime), coalesce(euser,user),"
911913
" coalesce(ecomment,comment), uuid,"
914
+ " coalesce((SELECT value FROM tagxref"
915
+ " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
912916
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913917
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914918
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915919
" FROM event, blob"
916920
" WHERE event.objid=%d AND type='ci'"
917921
" AND blob.rid=%d",
918
- rid, rid
922
+ TAG_BRANCH, rid, rid
919923
);
920924
while( db_step(&q)==SQLITE_ROW ){
921925
const char *zDate = db_column_text(&q, 0);
922926
const char *zUser = db_column_text(&q, 1);
923927
const char *zUuid = db_column_text(&q, 3);
928
+ const char *zBranch = db_column_text(&q, 4);
924929
const char *zTagList = db_column_text(&q, 4);
925930
Blob comment;
926931
int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927932
if( db_get_boolean("timeline-block-markup", 0)==0 ){
928933
wikiFlags |= WIKI_NOBLOCK;
929934
}
930935
hyperlink_to_uuid(zUuid);
936
+ @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937
+ @ %s(zBranch)</a> -
931938
blob_zero(&comment);
932939
db_column_blob(&q, 2, &comment);
933940
wiki_convert(&comment, 0, wikiFlags);
934941
blob_reset(&comment);
935942
@ (user:
936943
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
 
 
679 if( g.perm.Write ){
680 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681 }
682 @ </td>
683 @ </tr>
@@ -907,29 +909,34 @@
907 static void checkin_description(int rid){
908 Stmt q;
909 db_prepare(&q,
910 "SELECT datetime(mtime), coalesce(euser,user),"
911 " coalesce(ecomment,comment), uuid,"
 
 
912 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915 " FROM event, blob"
916 " WHERE event.objid=%d AND type='ci'"
917 " AND blob.rid=%d",
918 rid, rid
919 );
920 while( db_step(&q)==SQLITE_ROW ){
921 const char *zDate = db_column_text(&q, 0);
922 const char *zUser = db_column_text(&q, 1);
923 const char *zUuid = db_column_text(&q, 3);
 
924 const char *zTagList = db_column_text(&q, 4);
925 Blob comment;
926 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927 if( db_get_boolean("timeline-block-markup", 0)==0 ){
928 wikiFlags |= WIKI_NOBLOCK;
929 }
930 hyperlink_to_uuid(zUuid);
 
 
931 blob_zero(&comment);
932 db_column_blob(&q, 2, &comment);
933 wiki_convert(&comment, 0, wikiFlags);
934 blob_reset(&comment);
935 @ (user:
936
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679 @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680 @ changes over parent branch</a>
681 if( g.perm.Write ){
682 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
683 }
684 @ </td>
685 @ </tr>
@@ -907,29 +909,34 @@
909 static void checkin_description(int rid){
910 Stmt q;
911 db_prepare(&q,
912 "SELECT datetime(mtime), coalesce(euser,user),"
913 " coalesce(ecomment,comment), uuid,"
914 " coalesce((SELECT value FROM tagxref"
915 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
916 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
917 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
918 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
919 " FROM event, blob"
920 " WHERE event.objid=%d AND type='ci'"
921 " AND blob.rid=%d",
922 TAG_BRANCH, rid, rid
923 );
924 while( db_step(&q)==SQLITE_ROW ){
925 const char *zDate = db_column_text(&q, 0);
926 const char *zUser = db_column_text(&q, 1);
927 const char *zUuid = db_column_text(&q, 3);
928 const char *zBranch = db_column_text(&q, 4);
929 const char *zTagList = db_column_text(&q, 4);
930 Blob comment;
931 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
932 if( db_get_boolean("timeline-block-markup", 0)==0 ){
933 wikiFlags |= WIKI_NOBLOCK;
934 }
935 hyperlink_to_uuid(zUuid);
936 @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937 @ %s(zBranch)</a> -
938 blob_zero(&comment);
939 db_column_blob(&q, 2, &comment);
940 wiki_convert(&comment, 0, wikiFlags);
941 blob_reset(&comment);
942 @ (user:
943
+8 -1
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674674
@ <td>
675675
@ %z(href("%R/tree?ci=%S",zUuid))files</a>
676676
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677677
@ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678678
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679
+ @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680
+ @ changes over parent branch</a>
679681
if( g.perm.Write ){
680682
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681683
}
682684
@ </td>
683685
@ </tr>
@@ -907,29 +909,34 @@
907909
static void checkin_description(int rid){
908910
Stmt q;
909911
db_prepare(&q,
910912
"SELECT datetime(mtime), coalesce(euser,user),"
911913
" coalesce(ecomment,comment), uuid,"
914
+ " coalesce((SELECT value FROM tagxref"
915
+ " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
912916
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913917
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914918
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915919
" FROM event, blob"
916920
" WHERE event.objid=%d AND type='ci'"
917921
" AND blob.rid=%d",
918
- rid, rid
922
+ TAG_BRANCH, rid, rid
919923
);
920924
while( db_step(&q)==SQLITE_ROW ){
921925
const char *zDate = db_column_text(&q, 0);
922926
const char *zUser = db_column_text(&q, 1);
923927
const char *zUuid = db_column_text(&q, 3);
928
+ const char *zBranch = db_column_text(&q, 4);
924929
const char *zTagList = db_column_text(&q, 4);
925930
Blob comment;
926931
int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927932
if( db_get_boolean("timeline-block-markup", 0)==0 ){
928933
wikiFlags |= WIKI_NOBLOCK;
929934
}
930935
hyperlink_to_uuid(zUuid);
936
+ @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937
+ @ %s(zBranch)</a> -
931938
blob_zero(&comment);
932939
db_column_blob(&q, 2, &comment);
933940
wiki_convert(&comment, 0, wikiFlags);
934941
blob_reset(&comment);
935942
@ (user:
936943
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
 
 
679 if( g.perm.Write ){
680 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681 }
682 @ </td>
683 @ </tr>
@@ -907,29 +909,34 @@
907 static void checkin_description(int rid){
908 Stmt q;
909 db_prepare(&q,
910 "SELECT datetime(mtime), coalesce(euser,user),"
911 " coalesce(ecomment,comment), uuid,"
 
 
912 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915 " FROM event, blob"
916 " WHERE event.objid=%d AND type='ci'"
917 " AND blob.rid=%d",
918 rid, rid
919 );
920 while( db_step(&q)==SQLITE_ROW ){
921 const char *zDate = db_column_text(&q, 0);
922 const char *zUser = db_column_text(&q, 1);
923 const char *zUuid = db_column_text(&q, 3);
 
924 const char *zTagList = db_column_text(&q, 4);
925 Blob comment;
926 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927 if( db_get_boolean("timeline-block-markup", 0)==0 ){
928 wikiFlags |= WIKI_NOBLOCK;
929 }
930 hyperlink_to_uuid(zUuid);
 
 
931 blob_zero(&comment);
932 db_column_blob(&q, 2, &comment);
933 wiki_convert(&comment, 0, wikiFlags);
934 blob_reset(&comment);
935 @ (user:
936
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679 @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680 @ changes over parent branch</a>
681 if( g.perm.Write ){
682 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
683 }
684 @ </td>
685 @ </tr>
@@ -907,29 +909,34 @@
909 static void checkin_description(int rid){
910 Stmt q;
911 db_prepare(&q,
912 "SELECT datetime(mtime), coalesce(euser,user),"
913 " coalesce(ecomment,comment), uuid,"
914 " coalesce((SELECT value FROM tagxref"
915 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
916 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
917 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
918 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
919 " FROM event, blob"
920 " WHERE event.objid=%d AND type='ci'"
921 " AND blob.rid=%d",
922 TAG_BRANCH, rid, rid
923 );
924 while( db_step(&q)==SQLITE_ROW ){
925 const char *zDate = db_column_text(&q, 0);
926 const char *zUser = db_column_text(&q, 1);
927 const char *zUuid = db_column_text(&q, 3);
928 const char *zBranch = db_column_text(&q, 4);
929 const char *zTagList = db_column_text(&q, 4);
930 Blob comment;
931 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
932 if( db_get_boolean("timeline-block-markup", 0)==0 ){
933 wikiFlags |= WIKI_NOBLOCK;
934 }
935 hyperlink_to_uuid(zUuid);
936 @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937 @ %s(zBranch)</a> -
938 blob_zero(&comment);
939 db_column_blob(&q, 2, &comment);
940 wiki_convert(&comment, 0, wikiFlags);
941 blob_reset(&comment);
942 @ (user:
943
+8 -1
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674674
@ <td>
675675
@ %z(href("%R/tree?ci=%S",zUuid))files</a>
676676
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677677
@ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678678
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679
+ @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680
+ @ changes over parent branch</a>
679681
if( g.perm.Write ){
680682
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681683
}
682684
@ </td>
683685
@ </tr>
@@ -907,29 +909,34 @@
907909
static void checkin_description(int rid){
908910
Stmt q;
909911
db_prepare(&q,
910912
"SELECT datetime(mtime), coalesce(euser,user),"
911913
" coalesce(ecomment,comment), uuid,"
914
+ " coalesce((SELECT value FROM tagxref"
915
+ " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
912916
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913917
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914918
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915919
" FROM event, blob"
916920
" WHERE event.objid=%d AND type='ci'"
917921
" AND blob.rid=%d",
918
- rid, rid
922
+ TAG_BRANCH, rid, rid
919923
);
920924
while( db_step(&q)==SQLITE_ROW ){
921925
const char *zDate = db_column_text(&q, 0);
922926
const char *zUser = db_column_text(&q, 1);
923927
const char *zUuid = db_column_text(&q, 3);
928
+ const char *zBranch = db_column_text(&q, 4);
924929
const char *zTagList = db_column_text(&q, 4);
925930
Blob comment;
926931
int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927932
if( db_get_boolean("timeline-block-markup", 0)==0 ){
928933
wikiFlags |= WIKI_NOBLOCK;
929934
}
930935
hyperlink_to_uuid(zUuid);
936
+ @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937
+ @ %s(zBranch)</a> -
931938
blob_zero(&comment);
932939
db_column_blob(&q, 2, &comment);
933940
wiki_convert(&comment, 0, wikiFlags);
934941
blob_reset(&comment);
935942
@ (user:
936943
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
 
 
679 if( g.perm.Write ){
680 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
681 }
682 @ </td>
683 @ </tr>
@@ -907,29 +909,34 @@
907 static void checkin_description(int rid){
908 Stmt q;
909 db_prepare(&q,
910 "SELECT datetime(mtime), coalesce(euser,user),"
911 " coalesce(ecomment,comment), uuid,"
 
 
912 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
913 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
914 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
915 " FROM event, blob"
916 " WHERE event.objid=%d AND type='ci'"
917 " AND blob.rid=%d",
918 rid, rid
919 );
920 while( db_step(&q)==SQLITE_ROW ){
921 const char *zDate = db_column_text(&q, 0);
922 const char *zUser = db_column_text(&q, 1);
923 const char *zUuid = db_column_text(&q, 3);
 
924 const char *zTagList = db_column_text(&q, 4);
925 Blob comment;
926 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
927 if( db_get_boolean("timeline-block-markup", 0)==0 ){
928 wikiFlags |= WIKI_NOBLOCK;
929 }
930 hyperlink_to_uuid(zUuid);
 
 
931 blob_zero(&comment);
932 db_column_blob(&q, 2, &comment);
933 wiki_convert(&comment, 0, wikiFlags);
934 blob_reset(&comment);
935 @ (user:
936
--- src/info.c
+++ src/info.c
@@ -674,10 +674,12 @@
674 @ <td>
675 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
676 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
677 @ | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
678 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
679 @ | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
680 @ changes over parent branch</a>
681 if( g.perm.Write ){
682 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
683 }
684 @ </td>
685 @ </tr>
@@ -907,29 +909,34 @@
909 static void checkin_description(int rid){
910 Stmt q;
911 db_prepare(&q,
912 "SELECT datetime(mtime), coalesce(euser,user),"
913 " coalesce(ecomment,comment), uuid,"
914 " coalesce((SELECT value FROM tagxref"
915 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
916 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
917 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
918 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
919 " FROM event, blob"
920 " WHERE event.objid=%d AND type='ci'"
921 " AND blob.rid=%d",
922 TAG_BRANCH, rid, rid
923 );
924 while( db_step(&q)==SQLITE_ROW ){
925 const char *zDate = db_column_text(&q, 0);
926 const char *zUser = db_column_text(&q, 1);
927 const char *zUuid = db_column_text(&q, 3);
928 const char *zBranch = db_column_text(&q, 4);
929 const char *zTagList = db_column_text(&q, 4);
930 Blob comment;
931 int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
932 if( db_get_boolean("timeline-block-markup", 0)==0 ){
933 wikiFlags |= WIKI_NOBLOCK;
934 }
935 hyperlink_to_uuid(zUuid);
936 @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
937 @ %s(zBranch)</a> -
938 blob_zero(&comment);
939 db_column_blob(&q, 2, &comment);
940 wiki_convert(&comment, 0, wikiFlags);
941 blob_reset(&comment);
942 @ (user:
943
+107
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181181
" WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182182
" ORDER BY mtime DESC LIMIT 1",
183183
&zTag[4], zType);
184184
return rid;
185185
}
186
+
187
+ /* "parent:", as for parent branch. It returns the checkin of
188
+ the last checkin of the parent branch that has been merged in. */
189
+ if( memcmp(zTag, "pbranch:", 8)==0 ){
190
+ int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191
+ if (branchRid == 0) return 0;
192
+ rid = get_parent_branch_rid(branchRid);
193
+ return rid;
194
+ }
186195
187196
/* "tag:" + symbolic-name */
188197
if( memcmp(zTag, "tag:", 4)==0 ){
189198
rid = db_int(0,
190199
"SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
10581067
*/
10591068
void test_phatoms_cmd(void){
10601069
db_find_and_open_repository(0,0);
10611070
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
10621071
}
1072
+
1073
+
1074
+
1075
+/*
1076
+** It returns the checkin of the last checkin of the parent branch that has
1077
+** been merged in.
1078
+*/
1079
+int get_parent_branch_rid(int ridRequested){
1080
+ Stmt s;
1081
+ const char *branchName; /* Name of the branch requested at rid */
1082
+ const char *parentBranchName; /* Name of the parent branch */
1083
+ int rid;
1084
+
1085
+ /* Get the name of the current branch */
1086
+ branchName = db_text(0,
1087
+ "SELECT value FROM tagxref"
1088
+ " WHERE tagid=%d"
1089
+ " AND tagxref.tagtype>0"
1090
+ " AND rid=%d",
1091
+ TAG_BRANCH, ridRequested);
1092
+
1093
+ if ( !branchName )
1094
+ return 0;
1095
+
1096
+ /* Find the name of the branch this was forked from */
1097
+ db_prepare(&s,
1098
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099
+ " WHERE cid=:rid"
1100
+ " AND isprim=1"
1101
+ " AND tagxref.tagid=%d"
1102
+ " AND tagxref.tagtype>0"
1103
+ " AND tagxref.rid=pid",
1104
+ TAG_BRANCH);
1105
+
1106
+ rid = ridRequested;
1107
+ while( rid > 0 ) {
1108
+ db_bind_int(&s, ":rid", rid);
1109
+ if ( db_step(&s) == SQLITE_ROW ) {
1110
+ rid = db_column_int(&s, 0);
1111
+ parentBranchName = db_column_text(&s, 1);
1112
+ if ( !parentBranchName ) {
1113
+ rid = 0;
1114
+ break;
1115
+ }
1116
+
1117
+ if ( fossil_strcmp(parentBranchName, branchName) ) {
1118
+ parentBranchName = fossil_strdup(parentBranchName);
1119
+ break;
1120
+ }
1121
+ }else{
1122
+ rid = 0;
1123
+ break;
1124
+ }
1125
+ db_reset(&s);
1126
+ }
1127
+ db_finalize(&s);
1128
+
1129
+ if (rid == 0)
1130
+ return 0;
1131
+
1132
+ /* Find the last checkin coming from the parent branch */
1133
+ db_prepare(&s,
1134
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135
+ " WHERE cid=:rid"
1136
+ " AND tagxref.tagid=%d"
1137
+ " AND tagxref.tagtype>0"
1138
+ " AND tagxref.rid=pid ORDER BY isprim ASC",
1139
+ TAG_BRANCH);
1140
+
1141
+ rid = ridRequested;
1142
+ while( rid > 0 ) {
1143
+ db_bind_int(&s, ":rid", rid);
1144
+ int found = 0;
1145
+ while ( db_step(&s) == SQLITE_ROW ) {
1146
+ const char *branchNamePid; /* Branch name of the pid */
1147
+
1148
+ ++found;
1149
+ rid = db_column_int(&s, 0);
1150
+ branchNamePid = db_column_text(&s, 1);
1151
+ if ( !branchNamePid ) {
1152
+ break;
1153
+ }
1154
+ if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155
+ /* Found the last merge from the parent branch */
1156
+ db_finalize(&s);
1157
+ return rid;
1158
+ }
1159
+ }
1160
+
1161
+ if (found == 0) {
1162
+ break;
1163
+ }
1164
+ db_reset(&s);
1165
+ }
1166
+ db_finalize(&s);
1167
+
1168
+ return 0;
1169
+}
10631170
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
 
 
 
 
 
 
 
 
 
186
187 /* "tag:" + symbolic-name */
188 if( memcmp(zTag, "tag:", 4)==0 ){
189 rid = db_int(0,
190 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1058 */
1059 void test_phatoms_cmd(void){
1060 db_find_and_open_repository(0,0);
1061 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1062 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
186
187 /* "parent:", as for parent branch. It returns the checkin of
188 the last checkin of the parent branch that has been merged in. */
189 if( memcmp(zTag, "pbranch:", 8)==0 ){
190 int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191 if (branchRid == 0) return 0;
192 rid = get_parent_branch_rid(branchRid);
193 return rid;
194 }
195
196 /* "tag:" + symbolic-name */
197 if( memcmp(zTag, "tag:", 4)==0 ){
198 rid = db_int(0,
199 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1067 */
1068 void test_phatoms_cmd(void){
1069 db_find_and_open_repository(0,0);
1070 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1071 }
1072
1073
1074
1075 /*
1076 ** It returns the checkin of the last checkin of the parent branch that has
1077 ** been merged in.
1078 */
1079 int get_parent_branch_rid(int ridRequested){
1080 Stmt s;
1081 const char *branchName; /* Name of the branch requested at rid */
1082 const char *parentBranchName; /* Name of the parent branch */
1083 int rid;
1084
1085 /* Get the name of the current branch */
1086 branchName = db_text(0,
1087 "SELECT value FROM tagxref"
1088 " WHERE tagid=%d"
1089 " AND tagxref.tagtype>0"
1090 " AND rid=%d",
1091 TAG_BRANCH, ridRequested);
1092
1093 if ( !branchName )
1094 return 0;
1095
1096 /* Find the name of the branch this was forked from */
1097 db_prepare(&s,
1098 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099 " WHERE cid=:rid"
1100 " AND isprim=1"
1101 " AND tagxref.tagid=%d"
1102 " AND tagxref.tagtype>0"
1103 " AND tagxref.rid=pid",
1104 TAG_BRANCH);
1105
1106 rid = ridRequested;
1107 while( rid > 0 ) {
1108 db_bind_int(&s, ":rid", rid);
1109 if ( db_step(&s) == SQLITE_ROW ) {
1110 rid = db_column_int(&s, 0);
1111 parentBranchName = db_column_text(&s, 1);
1112 if ( !parentBranchName ) {
1113 rid = 0;
1114 break;
1115 }
1116
1117 if ( fossil_strcmp(parentBranchName, branchName) ) {
1118 parentBranchName = fossil_strdup(parentBranchName);
1119 break;
1120 }
1121 }else{
1122 rid = 0;
1123 break;
1124 }
1125 db_reset(&s);
1126 }
1127 db_finalize(&s);
1128
1129 if (rid == 0)
1130 return 0;
1131
1132 /* Find the last checkin coming from the parent branch */
1133 db_prepare(&s,
1134 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135 " WHERE cid=:rid"
1136 " AND tagxref.tagid=%d"
1137 " AND tagxref.tagtype>0"
1138 " AND tagxref.rid=pid ORDER BY isprim ASC",
1139 TAG_BRANCH);
1140
1141 rid = ridRequested;
1142 while( rid > 0 ) {
1143 db_bind_int(&s, ":rid", rid);
1144 int found = 0;
1145 while ( db_step(&s) == SQLITE_ROW ) {
1146 const char *branchNamePid; /* Branch name of the pid */
1147
1148 ++found;
1149 rid = db_column_int(&s, 0);
1150 branchNamePid = db_column_text(&s, 1);
1151 if ( !branchNamePid ) {
1152 break;
1153 }
1154 if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155 /* Found the last merge from the parent branch */
1156 db_finalize(&s);
1157 return rid;
1158 }
1159 }
1160
1161 if (found == 0) {
1162 break;
1163 }
1164 db_reset(&s);
1165 }
1166 db_finalize(&s);
1167
1168 return 0;
1169 }
1170
+107
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181181
" WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182182
" ORDER BY mtime DESC LIMIT 1",
183183
&zTag[4], zType);
184184
return rid;
185185
}
186
+
187
+ /* "parent:", as for parent branch. It returns the checkin of
188
+ the last checkin of the parent branch that has been merged in. */
189
+ if( memcmp(zTag, "pbranch:", 8)==0 ){
190
+ int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191
+ if (branchRid == 0) return 0;
192
+ rid = get_parent_branch_rid(branchRid);
193
+ return rid;
194
+ }
186195
187196
/* "tag:" + symbolic-name */
188197
if( memcmp(zTag, "tag:", 4)==0 ){
189198
rid = db_int(0,
190199
"SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
10581067
*/
10591068
void test_phatoms_cmd(void){
10601069
db_find_and_open_repository(0,0);
10611070
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
10621071
}
1072
+
1073
+
1074
+
1075
+/*
1076
+** It returns the checkin of the last checkin of the parent branch that has
1077
+** been merged in.
1078
+*/
1079
+int get_parent_branch_rid(int ridRequested){
1080
+ Stmt s;
1081
+ const char *branchName; /* Name of the branch requested at rid */
1082
+ const char *parentBranchName; /* Name of the parent branch */
1083
+ int rid;
1084
+
1085
+ /* Get the name of the current branch */
1086
+ branchName = db_text(0,
1087
+ "SELECT value FROM tagxref"
1088
+ " WHERE tagid=%d"
1089
+ " AND tagxref.tagtype>0"
1090
+ " AND rid=%d",
1091
+ TAG_BRANCH, ridRequested);
1092
+
1093
+ if ( !branchName )
1094
+ return 0;
1095
+
1096
+ /* Find the name of the branch this was forked from */
1097
+ db_prepare(&s,
1098
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099
+ " WHERE cid=:rid"
1100
+ " AND isprim=1"
1101
+ " AND tagxref.tagid=%d"
1102
+ " AND tagxref.tagtype>0"
1103
+ " AND tagxref.rid=pid",
1104
+ TAG_BRANCH);
1105
+
1106
+ rid = ridRequested;
1107
+ while( rid > 0 ) {
1108
+ db_bind_int(&s, ":rid", rid);
1109
+ if ( db_step(&s) == SQLITE_ROW ) {
1110
+ rid = db_column_int(&s, 0);
1111
+ parentBranchName = db_column_text(&s, 1);
1112
+ if ( !parentBranchName ) {
1113
+ rid = 0;
1114
+ break;
1115
+ }
1116
+
1117
+ if ( fossil_strcmp(parentBranchName, branchName) ) {
1118
+ parentBranchName = fossil_strdup(parentBranchName);
1119
+ break;
1120
+ }
1121
+ }else{
1122
+ rid = 0;
1123
+ break;
1124
+ }
1125
+ db_reset(&s);
1126
+ }
1127
+ db_finalize(&s);
1128
+
1129
+ if (rid == 0)
1130
+ return 0;
1131
+
1132
+ /* Find the last checkin coming from the parent branch */
1133
+ db_prepare(&s,
1134
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135
+ " WHERE cid=:rid"
1136
+ " AND tagxref.tagid=%d"
1137
+ " AND tagxref.tagtype>0"
1138
+ " AND tagxref.rid=pid ORDER BY isprim ASC",
1139
+ TAG_BRANCH);
1140
+
1141
+ rid = ridRequested;
1142
+ while( rid > 0 ) {
1143
+ db_bind_int(&s, ":rid", rid);
1144
+ int found = 0;
1145
+ while ( db_step(&s) == SQLITE_ROW ) {
1146
+ const char *branchNamePid; /* Branch name of the pid */
1147
+
1148
+ ++found;
1149
+ rid = db_column_int(&s, 0);
1150
+ branchNamePid = db_column_text(&s, 1);
1151
+ if ( !branchNamePid ) {
1152
+ break;
1153
+ }
1154
+ if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155
+ /* Found the last merge from the parent branch */
1156
+ db_finalize(&s);
1157
+ return rid;
1158
+ }
1159
+ }
1160
+
1161
+ if (found == 0) {
1162
+ break;
1163
+ }
1164
+ db_reset(&s);
1165
+ }
1166
+ db_finalize(&s);
1167
+
1168
+ return 0;
1169
+}
10631170
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
 
 
 
 
 
 
 
 
 
186
187 /* "tag:" + symbolic-name */
188 if( memcmp(zTag, "tag:", 4)==0 ){
189 rid = db_int(0,
190 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1058 */
1059 void test_phatoms_cmd(void){
1060 db_find_and_open_repository(0,0);
1061 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1062 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
186
187 /* "parent:", as for parent branch. It returns the checkin of
188 the last checkin of the parent branch that has been merged in. */
189 if( memcmp(zTag, "pbranch:", 8)==0 ){
190 int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191 if (branchRid == 0) return 0;
192 rid = get_parent_branch_rid(branchRid);
193 return rid;
194 }
195
196 /* "tag:" + symbolic-name */
197 if( memcmp(zTag, "tag:", 4)==0 ){
198 rid = db_int(0,
199 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1067 */
1068 void test_phatoms_cmd(void){
1069 db_find_and_open_repository(0,0);
1070 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1071 }
1072
1073
1074
1075 /*
1076 ** It returns the checkin of the last checkin of the parent branch that has
1077 ** been merged in.
1078 */
1079 int get_parent_branch_rid(int ridRequested){
1080 Stmt s;
1081 const char *branchName; /* Name of the branch requested at rid */
1082 const char *parentBranchName; /* Name of the parent branch */
1083 int rid;
1084
1085 /* Get the name of the current branch */
1086 branchName = db_text(0,
1087 "SELECT value FROM tagxref"
1088 " WHERE tagid=%d"
1089 " AND tagxref.tagtype>0"
1090 " AND rid=%d",
1091 TAG_BRANCH, ridRequested);
1092
1093 if ( !branchName )
1094 return 0;
1095
1096 /* Find the name of the branch this was forked from */
1097 db_prepare(&s,
1098 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099 " WHERE cid=:rid"
1100 " AND isprim=1"
1101 " AND tagxref.tagid=%d"
1102 " AND tagxref.tagtype>0"
1103 " AND tagxref.rid=pid",
1104 TAG_BRANCH);
1105
1106 rid = ridRequested;
1107 while( rid > 0 ) {
1108 db_bind_int(&s, ":rid", rid);
1109 if ( db_step(&s) == SQLITE_ROW ) {
1110 rid = db_column_int(&s, 0);
1111 parentBranchName = db_column_text(&s, 1);
1112 if ( !parentBranchName ) {
1113 rid = 0;
1114 break;
1115 }
1116
1117 if ( fossil_strcmp(parentBranchName, branchName) ) {
1118 parentBranchName = fossil_strdup(parentBranchName);
1119 break;
1120 }
1121 }else{
1122 rid = 0;
1123 break;
1124 }
1125 db_reset(&s);
1126 }
1127 db_finalize(&s);
1128
1129 if (rid == 0)
1130 return 0;
1131
1132 /* Find the last checkin coming from the parent branch */
1133 db_prepare(&s,
1134 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135 " WHERE cid=:rid"
1136 " AND tagxref.tagid=%d"
1137 " AND tagxref.tagtype>0"
1138 " AND tagxref.rid=pid ORDER BY isprim ASC",
1139 TAG_BRANCH);
1140
1141 rid = ridRequested;
1142 while( rid > 0 ) {
1143 db_bind_int(&s, ":rid", rid);
1144 int found = 0;
1145 while ( db_step(&s) == SQLITE_ROW ) {
1146 const char *branchNamePid; /* Branch name of the pid */
1147
1148 ++found;
1149 rid = db_column_int(&s, 0);
1150 branchNamePid = db_column_text(&s, 1);
1151 if ( !branchNamePid ) {
1152 break;
1153 }
1154 if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155 /* Found the last merge from the parent branch */
1156 db_finalize(&s);
1157 return rid;
1158 }
1159 }
1160
1161 if (found == 0) {
1162 break;
1163 }
1164 db_reset(&s);
1165 }
1166 db_finalize(&s);
1167
1168 return 0;
1169 }
1170
+107
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181181
" WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182182
" ORDER BY mtime DESC LIMIT 1",
183183
&zTag[4], zType);
184184
return rid;
185185
}
186
+
187
+ /* "parent:", as for parent branch. It returns the checkin of
188
+ the last checkin of the parent branch that has been merged in. */
189
+ if( memcmp(zTag, "pbranch:", 8)==0 ){
190
+ int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191
+ if (branchRid == 0) return 0;
192
+ rid = get_parent_branch_rid(branchRid);
193
+ return rid;
194
+ }
186195
187196
/* "tag:" + symbolic-name */
188197
if( memcmp(zTag, "tag:", 4)==0 ){
189198
rid = db_int(0,
190199
"SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
10581067
*/
10591068
void test_phatoms_cmd(void){
10601069
db_find_and_open_repository(0,0);
10611070
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
10621071
}
1072
+
1073
+
1074
+
1075
+/*
1076
+** It returns the checkin of the last checkin of the parent branch that has
1077
+** been merged in.
1078
+*/
1079
+int get_parent_branch_rid(int ridRequested){
1080
+ Stmt s;
1081
+ const char *branchName; /* Name of the branch requested at rid */
1082
+ const char *parentBranchName; /* Name of the parent branch */
1083
+ int rid;
1084
+
1085
+ /* Get the name of the current branch */
1086
+ branchName = db_text(0,
1087
+ "SELECT value FROM tagxref"
1088
+ " WHERE tagid=%d"
1089
+ " AND tagxref.tagtype>0"
1090
+ " AND rid=%d",
1091
+ TAG_BRANCH, ridRequested);
1092
+
1093
+ if ( !branchName )
1094
+ return 0;
1095
+
1096
+ /* Find the name of the branch this was forked from */
1097
+ db_prepare(&s,
1098
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099
+ " WHERE cid=:rid"
1100
+ " AND isprim=1"
1101
+ " AND tagxref.tagid=%d"
1102
+ " AND tagxref.tagtype>0"
1103
+ " AND tagxref.rid=pid",
1104
+ TAG_BRANCH);
1105
+
1106
+ rid = ridRequested;
1107
+ while( rid > 0 ) {
1108
+ db_bind_int(&s, ":rid", rid);
1109
+ if ( db_step(&s) == SQLITE_ROW ) {
1110
+ rid = db_column_int(&s, 0);
1111
+ parentBranchName = db_column_text(&s, 1);
1112
+ if ( !parentBranchName ) {
1113
+ rid = 0;
1114
+ break;
1115
+ }
1116
+
1117
+ if ( fossil_strcmp(parentBranchName, branchName) ) {
1118
+ parentBranchName = fossil_strdup(parentBranchName);
1119
+ break;
1120
+ }
1121
+ }else{
1122
+ rid = 0;
1123
+ break;
1124
+ }
1125
+ db_reset(&s);
1126
+ }
1127
+ db_finalize(&s);
1128
+
1129
+ if (rid == 0)
1130
+ return 0;
1131
+
1132
+ /* Find the last checkin coming from the parent branch */
1133
+ db_prepare(&s,
1134
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135
+ " WHERE cid=:rid"
1136
+ " AND tagxref.tagid=%d"
1137
+ " AND tagxref.tagtype>0"
1138
+ " AND tagxref.rid=pid ORDER BY isprim ASC",
1139
+ TAG_BRANCH);
1140
+
1141
+ rid = ridRequested;
1142
+ while( rid > 0 ) {
1143
+ db_bind_int(&s, ":rid", rid);
1144
+ int found = 0;
1145
+ while ( db_step(&s) == SQLITE_ROW ) {
1146
+ const char *branchNamePid; /* Branch name of the pid */
1147
+
1148
+ ++found;
1149
+ rid = db_column_int(&s, 0);
1150
+ branchNamePid = db_column_text(&s, 1);
1151
+ if ( !branchNamePid ) {
1152
+ break;
1153
+ }
1154
+ if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155
+ /* Found the last merge from the parent branch */
1156
+ db_finalize(&s);
1157
+ return rid;
1158
+ }
1159
+ }
1160
+
1161
+ if (found == 0) {
1162
+ break;
1163
+ }
1164
+ db_reset(&s);
1165
+ }
1166
+ db_finalize(&s);
1167
+
1168
+ return 0;
1169
+}
10631170
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
 
 
 
 
 
 
 
 
 
186
187 /* "tag:" + symbolic-name */
188 if( memcmp(zTag, "tag:", 4)==0 ){
189 rid = db_int(0,
190 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1058 */
1059 void test_phatoms_cmd(void){
1060 db_find_and_open_repository(0,0);
1061 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1062 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
186
187 /* "parent:", as for parent branch. It returns the checkin of
188 the last checkin of the parent branch that has been merged in. */
189 if( memcmp(zTag, "pbranch:", 8)==0 ){
190 int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191 if (branchRid == 0) return 0;
192 rid = get_parent_branch_rid(branchRid);
193 return rid;
194 }
195
196 /* "tag:" + symbolic-name */
197 if( memcmp(zTag, "tag:", 4)==0 ){
198 rid = db_int(0,
199 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1067 */
1068 void test_phatoms_cmd(void){
1069 db_find_and_open_repository(0,0);
1070 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1071 }
1072
1073
1074
1075 /*
1076 ** It returns the checkin of the last checkin of the parent branch that has
1077 ** been merged in.
1078 */
1079 int get_parent_branch_rid(int ridRequested){
1080 Stmt s;
1081 const char *branchName; /* Name of the branch requested at rid */
1082 const char *parentBranchName; /* Name of the parent branch */
1083 int rid;
1084
1085 /* Get the name of the current branch */
1086 branchName = db_text(0,
1087 "SELECT value FROM tagxref"
1088 " WHERE tagid=%d"
1089 " AND tagxref.tagtype>0"
1090 " AND rid=%d",
1091 TAG_BRANCH, ridRequested);
1092
1093 if ( !branchName )
1094 return 0;
1095
1096 /* Find the name of the branch this was forked from */
1097 db_prepare(&s,
1098 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099 " WHERE cid=:rid"
1100 " AND isprim=1"
1101 " AND tagxref.tagid=%d"
1102 " AND tagxref.tagtype>0"
1103 " AND tagxref.rid=pid",
1104 TAG_BRANCH);
1105
1106 rid = ridRequested;
1107 while( rid > 0 ) {
1108 db_bind_int(&s, ":rid", rid);
1109 if ( db_step(&s) == SQLITE_ROW ) {
1110 rid = db_column_int(&s, 0);
1111 parentBranchName = db_column_text(&s, 1);
1112 if ( !parentBranchName ) {
1113 rid = 0;
1114 break;
1115 }
1116
1117 if ( fossil_strcmp(parentBranchName, branchName) ) {
1118 parentBranchName = fossil_strdup(parentBranchName);
1119 break;
1120 }
1121 }else{
1122 rid = 0;
1123 break;
1124 }
1125 db_reset(&s);
1126 }
1127 db_finalize(&s);
1128
1129 if (rid == 0)
1130 return 0;
1131
1132 /* Find the last checkin coming from the parent branch */
1133 db_prepare(&s,
1134 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135 " WHERE cid=:rid"
1136 " AND tagxref.tagid=%d"
1137 " AND tagxref.tagtype>0"
1138 " AND tagxref.rid=pid ORDER BY isprim ASC",
1139 TAG_BRANCH);
1140
1141 rid = ridRequested;
1142 while( rid > 0 ) {
1143 db_bind_int(&s, ":rid", rid);
1144 int found = 0;
1145 while ( db_step(&s) == SQLITE_ROW ) {
1146 const char *branchNamePid; /* Branch name of the pid */
1147
1148 ++found;
1149 rid = db_column_int(&s, 0);
1150 branchNamePid = db_column_text(&s, 1);
1151 if ( !branchNamePid ) {
1152 break;
1153 }
1154 if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155 /* Found the last merge from the parent branch */
1156 db_finalize(&s);
1157 return rid;
1158 }
1159 }
1160
1161 if (found == 0) {
1162 break;
1163 }
1164 db_reset(&s);
1165 }
1166 db_finalize(&s);
1167
1168 return 0;
1169 }
1170
+107
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181181
" WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182182
" ORDER BY mtime DESC LIMIT 1",
183183
&zTag[4], zType);
184184
return rid;
185185
}
186
+
187
+ /* "parent:", as for parent branch. It returns the checkin of
188
+ the last checkin of the parent branch that has been merged in. */
189
+ if( memcmp(zTag, "pbranch:", 8)==0 ){
190
+ int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191
+ if (branchRid == 0) return 0;
192
+ rid = get_parent_branch_rid(branchRid);
193
+ return rid;
194
+ }
186195
187196
/* "tag:" + symbolic-name */
188197
if( memcmp(zTag, "tag:", 4)==0 ){
189198
rid = db_int(0,
190199
"SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
10581067
*/
10591068
void test_phatoms_cmd(void){
10601069
db_find_and_open_repository(0,0);
10611070
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
10621071
}
1072
+
1073
+
1074
+
1075
+/*
1076
+** It returns the checkin of the last checkin of the parent branch that has
1077
+** been merged in.
1078
+*/
1079
+int get_parent_branch_rid(int ridRequested){
1080
+ Stmt s;
1081
+ const char *branchName; /* Name of the branch requested at rid */
1082
+ const char *parentBranchName; /* Name of the parent branch */
1083
+ int rid;
1084
+
1085
+ /* Get the name of the current branch */
1086
+ branchName = db_text(0,
1087
+ "SELECT value FROM tagxref"
1088
+ " WHERE tagid=%d"
1089
+ " AND tagxref.tagtype>0"
1090
+ " AND rid=%d",
1091
+ TAG_BRANCH, ridRequested);
1092
+
1093
+ if ( !branchName )
1094
+ return 0;
1095
+
1096
+ /* Find the name of the branch this was forked from */
1097
+ db_prepare(&s,
1098
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099
+ " WHERE cid=:rid"
1100
+ " AND isprim=1"
1101
+ " AND tagxref.tagid=%d"
1102
+ " AND tagxref.tagtype>0"
1103
+ " AND tagxref.rid=pid",
1104
+ TAG_BRANCH);
1105
+
1106
+ rid = ridRequested;
1107
+ while( rid > 0 ) {
1108
+ db_bind_int(&s, ":rid", rid);
1109
+ if ( db_step(&s) == SQLITE_ROW ) {
1110
+ rid = db_column_int(&s, 0);
1111
+ parentBranchName = db_column_text(&s, 1);
1112
+ if ( !parentBranchName ) {
1113
+ rid = 0;
1114
+ break;
1115
+ }
1116
+
1117
+ if ( fossil_strcmp(parentBranchName, branchName) ) {
1118
+ parentBranchName = fossil_strdup(parentBranchName);
1119
+ break;
1120
+ }
1121
+ }else{
1122
+ rid = 0;
1123
+ break;
1124
+ }
1125
+ db_reset(&s);
1126
+ }
1127
+ db_finalize(&s);
1128
+
1129
+ if (rid == 0)
1130
+ return 0;
1131
+
1132
+ /* Find the last checkin coming from the parent branch */
1133
+ db_prepare(&s,
1134
+ "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135
+ " WHERE cid=:rid"
1136
+ " AND tagxref.tagid=%d"
1137
+ " AND tagxref.tagtype>0"
1138
+ " AND tagxref.rid=pid ORDER BY isprim ASC",
1139
+ TAG_BRANCH);
1140
+
1141
+ rid = ridRequested;
1142
+ while( rid > 0 ) {
1143
+ db_bind_int(&s, ":rid", rid);
1144
+ int found = 0;
1145
+ while ( db_step(&s) == SQLITE_ROW ) {
1146
+ const char *branchNamePid; /* Branch name of the pid */
1147
+
1148
+ ++found;
1149
+ rid = db_column_int(&s, 0);
1150
+ branchNamePid = db_column_text(&s, 1);
1151
+ if ( !branchNamePid ) {
1152
+ break;
1153
+ }
1154
+ if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155
+ /* Found the last merge from the parent branch */
1156
+ db_finalize(&s);
1157
+ return rid;
1158
+ }
1159
+ }
1160
+
1161
+ if (found == 0) {
1162
+ break;
1163
+ }
1164
+ db_reset(&s);
1165
+ }
1166
+ db_finalize(&s);
1167
+
1168
+ return 0;
1169
+}
10631170
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
 
 
 
 
 
 
 
 
 
186
187 /* "tag:" + symbolic-name */
188 if( memcmp(zTag, "tag:", 4)==0 ){
189 rid = db_int(0,
190 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1058 */
1059 void test_phatoms_cmd(void){
1060 db_find_and_open_repository(0,0);
1061 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1062 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
--- src/name.c
+++ src/name.c
@@ -181,10 +181,19 @@
181 " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
182 " ORDER BY mtime DESC LIMIT 1",
183 &zTag[4], zType);
184 return rid;
185 }
186
187 /* "parent:", as for parent branch. It returns the checkin of
188 the last checkin of the parent branch that has been merged in. */
189 if( memcmp(zTag, "pbranch:", 8)==0 ){
190 int branchRid = symbolic_name_to_rid(&zTag[8], zType);
191 if (branchRid == 0) return 0;
192 rid = get_parent_branch_rid(branchRid);
193 return rid;
194 }
195
196 /* "tag:" + symbolic-name */
197 if( memcmp(zTag, "tag:", 4)==0 ){
198 rid = db_int(0,
199 "SELECT event.objid, max(event.mtime)"
@@ -1058,5 +1067,103 @@
1067 */
1068 void test_phatoms_cmd(void){
1069 db_find_and_open_repository(0,0);
1070 describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
1071 }
1072
1073
1074
1075 /*
1076 ** It returns the checkin of the last checkin of the parent branch that has
1077 ** been merged in.
1078 */
1079 int get_parent_branch_rid(int ridRequested){
1080 Stmt s;
1081 const char *branchName; /* Name of the branch requested at rid */
1082 const char *parentBranchName; /* Name of the parent branch */
1083 int rid;
1084
1085 /* Get the name of the current branch */
1086 branchName = db_text(0,
1087 "SELECT value FROM tagxref"
1088 " WHERE tagid=%d"
1089 " AND tagxref.tagtype>0"
1090 " AND rid=%d",
1091 TAG_BRANCH, ridRequested);
1092
1093 if ( !branchName )
1094 return 0;
1095
1096 /* Find the name of the branch this was forked from */
1097 db_prepare(&s,
1098 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1099 " WHERE cid=:rid"
1100 " AND isprim=1"
1101 " AND tagxref.tagid=%d"
1102 " AND tagxref.tagtype>0"
1103 " AND tagxref.rid=pid",
1104 TAG_BRANCH);
1105
1106 rid = ridRequested;
1107 while( rid > 0 ) {
1108 db_bind_int(&s, ":rid", rid);
1109 if ( db_step(&s) == SQLITE_ROW ) {
1110 rid = db_column_int(&s, 0);
1111 parentBranchName = db_column_text(&s, 1);
1112 if ( !parentBranchName ) {
1113 rid = 0;
1114 break;
1115 }
1116
1117 if ( fossil_strcmp(parentBranchName, branchName) ) {
1118 parentBranchName = fossil_strdup(parentBranchName);
1119 break;
1120 }
1121 }else{
1122 rid = 0;
1123 break;
1124 }
1125 db_reset(&s);
1126 }
1127 db_finalize(&s);
1128
1129 if (rid == 0)
1130 return 0;
1131
1132 /* Find the last checkin coming from the parent branch */
1133 db_prepare(&s,
1134 "SELECT pid, tagxref.value FROM plink JOIN tagxref"
1135 " WHERE cid=:rid"
1136 " AND tagxref.tagid=%d"
1137 " AND tagxref.tagtype>0"
1138 " AND tagxref.rid=pid ORDER BY isprim ASC",
1139 TAG_BRANCH);
1140
1141 rid = ridRequested;
1142 while( rid > 0 ) {
1143 db_bind_int(&s, ":rid", rid);
1144 int found = 0;
1145 while ( db_step(&s) == SQLITE_ROW ) {
1146 const char *branchNamePid; /* Branch name of the pid */
1147
1148 ++found;
1149 rid = db_column_int(&s, 0);
1150 branchNamePid = db_column_text(&s, 1);
1151 if ( !branchNamePid ) {
1152 break;
1153 }
1154 if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
1155 /* Found the last merge from the parent branch */
1156 db_finalize(&s);
1157 return rid;
1158 }
1159 }
1160
1161 if (found == 0) {
1162 break;
1163 }
1164 db_reset(&s);
1165 }
1166 db_finalize(&s);
1167
1168 return 0;
1169 }
1170
+23 -27
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102102
*/
103103
char *hash_color(const char *z){
104104
int i; /* Loop counter */
105105
unsigned int h = 0; /* Hash on the branch name */
106106
int r, g, b; /* Values for red, green, and blue */
107
- int h1, h2, h3, h4; /* Elements of the hash value */
108
- int mx, mn; /* Components of HSV */
109107
static char zColor[10]; /* The resulting color */
110
- static int ix[2] = {0,0}; /* Color chooser parameters */
111
-
112
- if( ix[0]==0 ){
113
- if( db_get_boolean("white-foreground", 0) ){
114
- ix[0] = 140;
115
- ix[1] = 40;
116
- }else{
117
- ix[0] = 216;
118
- ix[1] = 16;
119
- }
120
- }
121
- for(i=0; z[i]; i++ ){
108
+ static int whitefg = -1;
109
+ int cpc = 4; /* colours per component */
110
+ int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111
+ int cmin = cfactor - 1; /* Factor so the max component is 127
112
+ and the min is different than the bg */
113
+
114
+ if(whitefg = -1)
115
+ whitefg = db_get_boolean("white-foreground", 0);
116
+
117
+ /* Calculate the hash based on the branch name */
118
+ for(i=0; z[i]; i++){
122119
h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123120
}
124
- h1 = h % 6; h /= 6;
125
- h3 = h % 30; h /= 30;
126
- h4 = h % 40; h /= 40;
127
- mx = ix[0] - h3;
128
- mn = mx - h4 - ix[1];
129
- h2 = (h%(mx - mn)) + mn;
130
- switch( h1 ){
131
- case 0: r = mx; g = h2, b = mn; break;
132
- case 1: r = h2; g = mx, b = mn; break;
133
- case 2: r = mn; g = mx, b = h2; break;
134
- case 3: r = mn; g = h2, b = mx; break;
135
- case 4: r = h2; g = mn, b = mx; break;
136
- default: r = mx; g = mn, b = h2; break;
121
+
122
+ /* 'cpc' different random values per component, between 'cmin' and 127 */
123
+ r = cmin + (h % cpc) * cfactor; h /= cpc;
124
+ g = cmin + (h % cpc) * cfactor; h /= cpc;
125
+ b = cmin + (h % cpc) * cfactor; h /= cpc;
126
+
127
+ /* In case of blackfg, get the inverse effect */
128
+ if(!whitefg)
129
+ {
130
+ r = 255 - r;
131
+ g = 255 - g;
132
+ b = 255 - b;
137133
}
138134
sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139135
return zColor;
140136
}
141137
142138
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
107 int h1, h2, h3, h4; /* Elements of the hash value */
108 int mx, mn; /* Components of HSV */
109 static char zColor[10]; /* The resulting color */
110 static int ix[2] = {0,0}; /* Color chooser parameters */
111
112 if( ix[0]==0 ){
113 if( db_get_boolean("white-foreground", 0) ){
114 ix[0] = 140;
115 ix[1] = 40;
116 }else{
117 ix[0] = 216;
118 ix[1] = 16;
119 }
120 }
121 for(i=0; z[i]; i++ ){
122 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123 }
124 h1 = h % 6; h /= 6;
125 h3 = h % 30; h /= 30;
126 h4 = h % 40; h /= 40;
127 mx = ix[0] - h3;
128 mn = mx - h4 - ix[1];
129 h2 = (h%(mx - mn)) + mn;
130 switch( h1 ){
131 case 0: r = mx; g = h2, b = mn; break;
132 case 1: r = h2; g = mx, b = mn; break;
133 case 2: r = mn; g = mx, b = h2; break;
134 case 3: r = mn; g = h2, b = mx; break;
135 case 4: r = h2; g = mn, b = mx; break;
136 default: r = mx; g = mn, b = h2; break;
137 }
138 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139 return zColor;
140 }
141
142
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
 
 
107 static char zColor[10]; /* The resulting color */
108 static int whitefg = -1;
109 int cpc = 4; /* colours per component */
110 int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111 int cmin = cfactor - 1; /* Factor so the max component is 127
112 and the min is different than the bg */
113
114 if(whitefg = -1)
115 whitefg = db_get_boolean("white-foreground", 0);
116
117 /* Calculate the hash based on the branch name */
118 for(i=0; z[i]; i++){
 
119 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
120 }
121
122 /* 'cpc' different random values per component, between 'cmin' and 127 */
123 r = cmin + (h % cpc) * cfactor; h /= cpc;
124 g = cmin + (h % cpc) * cfactor; h /= cpc;
125 b = cmin + (h % cpc) * cfactor; h /= cpc;
126
127 /* In case of blackfg, get the inverse effect */
128 if(!whitefg)
129 {
130 r = 255 - r;
131 g = 255 - g;
132 b = 255 - b;
 
133 }
134 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
135 return zColor;
136 }
137
138
+23 -27
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102102
*/
103103
char *hash_color(const char *z){
104104
int i; /* Loop counter */
105105
unsigned int h = 0; /* Hash on the branch name */
106106
int r, g, b; /* Values for red, green, and blue */
107
- int h1, h2, h3, h4; /* Elements of the hash value */
108
- int mx, mn; /* Components of HSV */
109107
static char zColor[10]; /* The resulting color */
110
- static int ix[2] = {0,0}; /* Color chooser parameters */
111
-
112
- if( ix[0]==0 ){
113
- if( db_get_boolean("white-foreground", 0) ){
114
- ix[0] = 140;
115
- ix[1] = 40;
116
- }else{
117
- ix[0] = 216;
118
- ix[1] = 16;
119
- }
120
- }
121
- for(i=0; z[i]; i++ ){
108
+ static int whitefg = -1;
109
+ int cpc = 4; /* colours per component */
110
+ int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111
+ int cmin = cfactor - 1; /* Factor so the max component is 127
112
+ and the min is different than the bg */
113
+
114
+ if(whitefg = -1)
115
+ whitefg = db_get_boolean("white-foreground", 0);
116
+
117
+ /* Calculate the hash based on the branch name */
118
+ for(i=0; z[i]; i++){
122119
h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123120
}
124
- h1 = h % 6; h /= 6;
125
- h3 = h % 30; h /= 30;
126
- h4 = h % 40; h /= 40;
127
- mx = ix[0] - h3;
128
- mn = mx - h4 - ix[1];
129
- h2 = (h%(mx - mn)) + mn;
130
- switch( h1 ){
131
- case 0: r = mx; g = h2, b = mn; break;
132
- case 1: r = h2; g = mx, b = mn; break;
133
- case 2: r = mn; g = mx, b = h2; break;
134
- case 3: r = mn; g = h2, b = mx; break;
135
- case 4: r = h2; g = mn, b = mx; break;
136
- default: r = mx; g = mn, b = h2; break;
121
+
122
+ /* 'cpc' different random values per component, between 'cmin' and 127 */
123
+ r = cmin + (h % cpc) * cfactor; h /= cpc;
124
+ g = cmin + (h % cpc) * cfactor; h /= cpc;
125
+ b = cmin + (h % cpc) * cfactor; h /= cpc;
126
+
127
+ /* In case of blackfg, get the inverse effect */
128
+ if(!whitefg)
129
+ {
130
+ r = 255 - r;
131
+ g = 255 - g;
132
+ b = 255 - b;
137133
}
138134
sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139135
return zColor;
140136
}
141137
142138
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
107 int h1, h2, h3, h4; /* Elements of the hash value */
108 int mx, mn; /* Components of HSV */
109 static char zColor[10]; /* The resulting color */
110 static int ix[2] = {0,0}; /* Color chooser parameters */
111
112 if( ix[0]==0 ){
113 if( db_get_boolean("white-foreground", 0) ){
114 ix[0] = 140;
115 ix[1] = 40;
116 }else{
117 ix[0] = 216;
118 ix[1] = 16;
119 }
120 }
121 for(i=0; z[i]; i++ ){
122 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123 }
124 h1 = h % 6; h /= 6;
125 h3 = h % 30; h /= 30;
126 h4 = h % 40; h /= 40;
127 mx = ix[0] - h3;
128 mn = mx - h4 - ix[1];
129 h2 = (h%(mx - mn)) + mn;
130 switch( h1 ){
131 case 0: r = mx; g = h2, b = mn; break;
132 case 1: r = h2; g = mx, b = mn; break;
133 case 2: r = mn; g = mx, b = h2; break;
134 case 3: r = mn; g = h2, b = mx; break;
135 case 4: r = h2; g = mn, b = mx; break;
136 default: r = mx; g = mn, b = h2; break;
137 }
138 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139 return zColor;
140 }
141
142
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
 
 
107 static char zColor[10]; /* The resulting color */
108 static int whitefg = -1;
109 int cpc = 4; /* colours per component */
110 int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111 int cmin = cfactor - 1; /* Factor so the max component is 127
112 and the min is different than the bg */
113
114 if(whitefg = -1)
115 whitefg = db_get_boolean("white-foreground", 0);
116
117 /* Calculate the hash based on the branch name */
118 for(i=0; z[i]; i++){
 
119 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
120 }
121
122 /* 'cpc' different random values per component, between 'cmin' and 127 */
123 r = cmin + (h % cpc) * cfactor; h /= cpc;
124 g = cmin + (h % cpc) * cfactor; h /= cpc;
125 b = cmin + (h % cpc) * cfactor; h /= cpc;
126
127 /* In case of blackfg, get the inverse effect */
128 if(!whitefg)
129 {
130 r = 255 - r;
131 g = 255 - g;
132 b = 255 - b;
 
133 }
134 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
135 return zColor;
136 }
137
138
+23 -27
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102102
*/
103103
char *hash_color(const char *z){
104104
int i; /* Loop counter */
105105
unsigned int h = 0; /* Hash on the branch name */
106106
int r, g, b; /* Values for red, green, and blue */
107
- int h1, h2, h3, h4; /* Elements of the hash value */
108
- int mx, mn; /* Components of HSV */
109107
static char zColor[10]; /* The resulting color */
110
- static int ix[2] = {0,0}; /* Color chooser parameters */
111
-
112
- if( ix[0]==0 ){
113
- if( db_get_boolean("white-foreground", 0) ){
114
- ix[0] = 140;
115
- ix[1] = 40;
116
- }else{
117
- ix[0] = 216;
118
- ix[1] = 16;
119
- }
120
- }
121
- for(i=0; z[i]; i++ ){
108
+ static int whitefg = -1;
109
+ int cpc = 4; /* colours per component */
110
+ int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111
+ int cmin = cfactor - 1; /* Factor so the max component is 127
112
+ and the min is different than the bg */
113
+
114
+ if(whitefg = -1)
115
+ whitefg = db_get_boolean("white-foreground", 0);
116
+
117
+ /* Calculate the hash based on the branch name */
118
+ for(i=0; z[i]; i++){
122119
h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123120
}
124
- h1 = h % 6; h /= 6;
125
- h3 = h % 30; h /= 30;
126
- h4 = h % 40; h /= 40;
127
- mx = ix[0] - h3;
128
- mn = mx - h4 - ix[1];
129
- h2 = (h%(mx - mn)) + mn;
130
- switch( h1 ){
131
- case 0: r = mx; g = h2, b = mn; break;
132
- case 1: r = h2; g = mx, b = mn; break;
133
- case 2: r = mn; g = mx, b = h2; break;
134
- case 3: r = mn; g = h2, b = mx; break;
135
- case 4: r = h2; g = mn, b = mx; break;
136
- default: r = mx; g = mn, b = h2; break;
121
+
122
+ /* 'cpc' different random values per component, between 'cmin' and 127 */
123
+ r = cmin + (h % cpc) * cfactor; h /= cpc;
124
+ g = cmin + (h % cpc) * cfactor; h /= cpc;
125
+ b = cmin + (h % cpc) * cfactor; h /= cpc;
126
+
127
+ /* In case of blackfg, get the inverse effect */
128
+ if(!whitefg)
129
+ {
130
+ r = 255 - r;
131
+ g = 255 - g;
132
+ b = 255 - b;
137133
}
138134
sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139135
return zColor;
140136
}
141137
142138
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
107 int h1, h2, h3, h4; /* Elements of the hash value */
108 int mx, mn; /* Components of HSV */
109 static char zColor[10]; /* The resulting color */
110 static int ix[2] = {0,0}; /* Color chooser parameters */
111
112 if( ix[0]==0 ){
113 if( db_get_boolean("white-foreground", 0) ){
114 ix[0] = 140;
115 ix[1] = 40;
116 }else{
117 ix[0] = 216;
118 ix[1] = 16;
119 }
120 }
121 for(i=0; z[i]; i++ ){
122 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123 }
124 h1 = h % 6; h /= 6;
125 h3 = h % 30; h /= 30;
126 h4 = h % 40; h /= 40;
127 mx = ix[0] - h3;
128 mn = mx - h4 - ix[1];
129 h2 = (h%(mx - mn)) + mn;
130 switch( h1 ){
131 case 0: r = mx; g = h2, b = mn; break;
132 case 1: r = h2; g = mx, b = mn; break;
133 case 2: r = mn; g = mx, b = h2; break;
134 case 3: r = mn; g = h2, b = mx; break;
135 case 4: r = h2; g = mn, b = mx; break;
136 default: r = mx; g = mn, b = h2; break;
137 }
138 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139 return zColor;
140 }
141
142
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
 
 
107 static char zColor[10]; /* The resulting color */
108 static int whitefg = -1;
109 int cpc = 4; /* colours per component */
110 int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111 int cmin = cfactor - 1; /* Factor so the max component is 127
112 and the min is different than the bg */
113
114 if(whitefg = -1)
115 whitefg = db_get_boolean("white-foreground", 0);
116
117 /* Calculate the hash based on the branch name */
118 for(i=0; z[i]; i++){
 
119 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
120 }
121
122 /* 'cpc' different random values per component, between 'cmin' and 127 */
123 r = cmin + (h % cpc) * cfactor; h /= cpc;
124 g = cmin + (h % cpc) * cfactor; h /= cpc;
125 b = cmin + (h % cpc) * cfactor; h /= cpc;
126
127 /* In case of blackfg, get the inverse effect */
128 if(!whitefg)
129 {
130 r = 255 - r;
131 g = 255 - g;
132 b = 255 - b;
 
133 }
134 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
135 return zColor;
136 }
137
138
+23 -27
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102102
*/
103103
char *hash_color(const char *z){
104104
int i; /* Loop counter */
105105
unsigned int h = 0; /* Hash on the branch name */
106106
int r, g, b; /* Values for red, green, and blue */
107
- int h1, h2, h3, h4; /* Elements of the hash value */
108
- int mx, mn; /* Components of HSV */
109107
static char zColor[10]; /* The resulting color */
110
- static int ix[2] = {0,0}; /* Color chooser parameters */
111
-
112
- if( ix[0]==0 ){
113
- if( db_get_boolean("white-foreground", 0) ){
114
- ix[0] = 140;
115
- ix[1] = 40;
116
- }else{
117
- ix[0] = 216;
118
- ix[1] = 16;
119
- }
120
- }
121
- for(i=0; z[i]; i++ ){
108
+ static int whitefg = -1;
109
+ int cpc = 4; /* colours per component */
110
+ int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111
+ int cmin = cfactor - 1; /* Factor so the max component is 127
112
+ and the min is different than the bg */
113
+
114
+ if(whitefg = -1)
115
+ whitefg = db_get_boolean("white-foreground", 0);
116
+
117
+ /* Calculate the hash based on the branch name */
118
+ for(i=0; z[i]; i++){
122119
h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123120
}
124
- h1 = h % 6; h /= 6;
125
- h3 = h % 30; h /= 30;
126
- h4 = h % 40; h /= 40;
127
- mx = ix[0] - h3;
128
- mn = mx - h4 - ix[1];
129
- h2 = (h%(mx - mn)) + mn;
130
- switch( h1 ){
131
- case 0: r = mx; g = h2, b = mn; break;
132
- case 1: r = h2; g = mx, b = mn; break;
133
- case 2: r = mn; g = mx, b = h2; break;
134
- case 3: r = mn; g = h2, b = mx; break;
135
- case 4: r = h2; g = mn, b = mx; break;
136
- default: r = mx; g = mn, b = h2; break;
121
+
122
+ /* 'cpc' different random values per component, between 'cmin' and 127 */
123
+ r = cmin + (h % cpc) * cfactor; h /= cpc;
124
+ g = cmin + (h % cpc) * cfactor; h /= cpc;
125
+ b = cmin + (h % cpc) * cfactor; h /= cpc;
126
+
127
+ /* In case of blackfg, get the inverse effect */
128
+ if(!whitefg)
129
+ {
130
+ r = 255 - r;
131
+ g = 255 - g;
132
+ b = 255 - b;
137133
}
138134
sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139135
return zColor;
140136
}
141137
142138
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
107 int h1, h2, h3, h4; /* Elements of the hash value */
108 int mx, mn; /* Components of HSV */
109 static char zColor[10]; /* The resulting color */
110 static int ix[2] = {0,0}; /* Color chooser parameters */
111
112 if( ix[0]==0 ){
113 if( db_get_boolean("white-foreground", 0) ){
114 ix[0] = 140;
115 ix[1] = 40;
116 }else{
117 ix[0] = 216;
118 ix[1] = 16;
119 }
120 }
121 for(i=0; z[i]; i++ ){
122 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
123 }
124 h1 = h % 6; h /= 6;
125 h3 = h % 30; h /= 30;
126 h4 = h % 40; h /= 40;
127 mx = ix[0] - h3;
128 mn = mx - h4 - ix[1];
129 h2 = (h%(mx - mn)) + mn;
130 switch( h1 ){
131 case 0: r = mx; g = h2, b = mn; break;
132 case 1: r = h2; g = mx, b = mn; break;
133 case 2: r = mn; g = mx, b = h2; break;
134 case 3: r = mn; g = h2, b = mx; break;
135 case 4: r = h2; g = mn, b = mx; break;
136 default: r = mx; g = mn, b = h2; break;
137 }
138 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
139 return zColor;
140 }
141
142
--- src/timeline.c
+++ src/timeline.c
@@ -102,40 +102,36 @@
102 */
103 char *hash_color(const char *z){
104 int i; /* Loop counter */
105 unsigned int h = 0; /* Hash on the branch name */
106 int r, g, b; /* Values for red, green, and blue */
 
 
107 static char zColor[10]; /* The resulting color */
108 static int whitefg = -1;
109 int cpc = 4; /* colours per component */
110 int cfactor = 128/cpc; /* Factor so n*cpc < 128 */
111 int cmin = cfactor - 1; /* Factor so the max component is 127
112 and the min is different than the bg */
113
114 if(whitefg = -1)
115 whitefg = db_get_boolean("white-foreground", 0);
116
117 /* Calculate the hash based on the branch name */
118 for(i=0; z[i]; i++){
 
119 h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
120 }
121
122 /* 'cpc' different random values per component, between 'cmin' and 127 */
123 r = cmin + (h % cpc) * cfactor; h /= cpc;
124 g = cmin + (h % cpc) * cfactor; h /= cpc;
125 b = cmin + (h % cpc) * cfactor; h /= cpc;
126
127 /* In case of blackfg, get the inverse effect */
128 if(!whitefg)
129 {
130 r = 255 - r;
131 g = 255 - g;
132 b = 255 - b;
 
133 }
134 sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
135 return zColor;
136 }
137
138

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button