Fossil SCM

Remove the seldom-used "Tags And Properties" section from the check-in information screen. Move that information off into a new page /ci_tags that includes a timeline showing all relevant timeline items in addition to the basic tag information.

drh 2017-12-06 18:27 trunk
Commit e2d537207ec3b2029e585e0bbd1af8d6a0434e65a23133a15b18b523db3b7bb5
1 file changed +115 -68
+115 -68
--- src/info.c
+++ src/info.c
@@ -247,77 +247,10 @@
247247
}
248248
show_common_info(rid, "uuid:", 1, 1);
249249
}
250250
}
251251
252
-/*
253
-** Show information about all tags on a given check-in.
254
-*/
255
-static void showTags(int rid){
256
- Stmt q;
257
- int cnt = 0;
258
- db_prepare(&q,
259
- "SELECT tag.tagid, tagname, "
260
- " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
261
- " value, datetime(tagxref.mtime,toLocal()), tagtype,"
262
- " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
263
- " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
264
- " WHERE tagxref.rid=%d"
265
- " ORDER BY tagname /*sort*/", rid, rid, rid
266
- );
267
- while( db_step(&q)==SQLITE_ROW ){
268
- const char *zTagname = db_column_text(&q, 1);
269
- const char *zSrcUuid = db_column_text(&q, 2);
270
- const char *zValue = db_column_text(&q, 3);
271
- const char *zDate = db_column_text(&q, 4);
272
- int tagtype = db_column_int(&q, 5);
273
- const char *zOrigUuid = db_column_text(&q, 6);
274
- cnt++;
275
- if( cnt==1 ){
276
- @ <div class="section">Tags And Properties</div>
277
- @ <ul>
278
- }
279
- @ <li>
280
- if( tagtype==0 ){
281
- @ <span class="infoTagCancelled">%h(zTagname)</span> cancelled
282
- }else if( zValue ){
283
- @ <span class="infoTag">%h(zTagname)=%h(zValue)</span>
284
- }else {
285
- @ <span class="infoTag">%h(zTagname)</span>
286
- }
287
- if( tagtype==2 ){
288
- if( zOrigUuid && zOrigUuid[0] ){
289
- @ inherited from
290
- hyperlink_to_uuid(zOrigUuid);
291
- }else{
292
- @ propagates to descendants
293
- }
294
-#if 0
295
- if( zValue && fossil_strcmp(zTagname,"branch")==0 ){
296
- @ &nbsp;&nbsp;
297
- @ %z(href("%R/timeline?r=%T",zValue))branch timeline</a>
298
- }
299
-#endif
300
- }
301
- if( zSrcUuid && zSrcUuid[0] ){
302
- if( tagtype==0 ){
303
- @ by
304
- }else{
305
- @ added by
306
- }
307
- hyperlink_to_uuid(zSrcUuid);
308
- @ on
309
- hyperlink_to_date(zDate,0);
310
- }
311
- @ </li>
312
- }
313
- db_finalize(&q);
314
- if( cnt ){
315
- @ </ul>
316
- }
317
-}
318
-
319252
/*
320253
** Show the context graph (immediate parents and children) for
321254
** check-in rid.
322255
*/
323256
void render_checkin_context(int rid, int parentsOnly){
@@ -557,10 +490,124 @@
557490
if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
558491
diffFlags |= DIFF_STRIP_EOLCR;
559492
}
560493
return diffFlags;
561494
}
495
+
496
+/*
497
+** WEBPAGE: ci_tags
498
+** URL: /ci_tags?name=ARTIFACTID
499
+**
500
+** Show all tags and properties for a given check-in.
501
+**
502
+** This information used to be part of the main /ci page, but it is of
503
+** marginal usefulness. Better to factor it out into a sub-screen.
504
+*/
505
+void ci_tags_page(void){
506
+ const char *zHash;
507
+ int rid;
508
+ Stmt q;
509
+ int cnt = 0;
510
+ Blob sql;
511
+
512
+ login_check_credentials();
513
+ if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
514
+ rid = name_to_rid_www("name");
515
+ if( rid==0 ){
516
+ style_header("Check-in Information Error");
517
+ @ No such object: %h(g.argv[2])
518
+ style_footer();
519
+ return;
520
+ }
521
+ zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
522
+ style_header("Tags and Properties");
523
+ @ <h1>Tags and Properties for Check-In \
524
+ @ %z(href("%R/ci/%!S",zHash))%S(zHash)</a></h1>
525
+ db_prepare(&q,
526
+ "SELECT tag.tagid, tagname, "
527
+ " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
528
+ " value, datetime(tagxref.mtime,toLocal()), tagtype,"
529
+ " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
530
+ " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
531
+ " WHERE tagxref.rid=%d"
532
+ " ORDER BY tagname /*sort*/", rid, rid, rid
533
+ );
534
+ while( db_step(&q)==SQLITE_ROW ){
535
+ const char *zTagname = db_column_text(&q, 1);
536
+ const char *zSrcUuid = db_column_text(&q, 2);
537
+ const char *zValue = db_column_text(&q, 3);
538
+ const char *zDate = db_column_text(&q, 4);
539
+ int tagtype = db_column_int(&q, 5);
540
+ const char *zOrigUuid = db_column_text(&q, 6);
541
+ cnt++;
542
+ if( cnt==1 ){
543
+ @ <ul>
544
+ }
545
+ @ <li>
546
+ if( tagtype==0 ){
547
+ @ <span class="infoTagCancelled">%h(zTagname)</span> cancelled
548
+ }else if( zValue ){
549
+ @ <span class="infoTag">%h(zTagname)=%h(zValue)</span>
550
+ }else {
551
+ @ <span class="infoTag">%h(zTagname)</span>
552
+ }
553
+ if( tagtype==2 ){
554
+ if( zOrigUuid && zOrigUuid[0] ){
555
+ @ inherited from
556
+ hyperlink_to_uuid(zOrigUuid);
557
+ }else{
558
+ @ propagates to descendants
559
+ }
560
+ }
561
+ if( zSrcUuid && zSrcUuid[0] ){
562
+ if( tagtype==0 ){
563
+ @ by
564
+ }else{
565
+ @ added by
566
+ }
567
+ hyperlink_to_uuid(zSrcUuid);
568
+ @ on
569
+ hyperlink_to_date(zDate,0);
570
+ }
571
+ @ </li>
572
+ }
573
+ db_finalize(&q);
574
+ if( cnt ){
575
+ @ </ul>
576
+ }
577
+ @ <div class="section">Context</div>
578
+ db_multi_exec(
579
+ "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
580
+ "DELETE FROM ok;"
581
+ "INSERT INTO ok VALUES(%d);"
582
+ "INSERT OR IGNORE INTO ok "
583
+ " SELECT tagxref.srcid"
584
+ " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
585
+ " WHERE tagxref.rid=%d;"
586
+ "INSERT OR IGNORE INTO ok "
587
+ " SELECT tagxref.origid"
588
+ " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
589
+ " WHERE tagxref.rid=%d;",
590
+ rid, rid, rid
591
+ );
592
+ db_multi_exec(
593
+ "SELECT tag.tagid, tagname, "
594
+ " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
595
+ " value, datetime(tagxref.mtime,toLocal()), tagtype,"
596
+ " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
597
+ " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
598
+ " WHERE tagxref.rid=%d"
599
+ " ORDER BY tagname /*sort*/", rid, rid, rid
600
+ );
601
+ blob_zero(&sql);
602
+ blob_append(&sql, timeline_query_for_www(), -1);
603
+ blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
604
+ db_prepare(&q, "%s", blob_sql_text(&sql));
605
+ www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH, 0, 0, rid, 0);
606
+ db_finalize(&q);
607
+ style_footer();
608
+}
562609
563610
/*
564611
** WEBPAGE: vinfo
565612
** WEBPAGE: ci
566613
** URL: /ci?name=ARTIFACTID
@@ -742,10 +789,11 @@
742789
}
743790
if( g.perm.Hyperlink ){
744791
@ <tr><th>Other&nbsp;Links:</th>
745792
@ <td>
746793
@ %z(href("%R/artifact/%!S",zUuid))manifest</a>
794
+ @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
747795
if( g.perm.Admin ){
748796
@ | %z(href("%R/mlink?ci=%!S",zUuid))mlink table</a>
749797
}
750798
if( g.anon.Write ){
751799
@ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a>
@@ -758,11 +806,10 @@
758806
style_header("Check-in Information");
759807
login_anonymous_available();
760808
}
761809
db_finalize(&q1);
762810
render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
763
- showTags(rid);
764811
@ <div class="section">Context</div>
765812
render_checkin_context(rid, 0);
766813
@ <div class="section">Changes</div>
767814
@ <div class="sectionmenu">
768815
diffFlags = construct_diff_flags(diffType);
769816
--- src/info.c
+++ src/info.c
@@ -247,77 +247,10 @@
247 }
248 show_common_info(rid, "uuid:", 1, 1);
249 }
250 }
251
252 /*
253 ** Show information about all tags on a given check-in.
254 */
255 static void showTags(int rid){
256 Stmt q;
257 int cnt = 0;
258 db_prepare(&q,
259 "SELECT tag.tagid, tagname, "
260 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
261 " value, datetime(tagxref.mtime,toLocal()), tagtype,"
262 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
263 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
264 " WHERE tagxref.rid=%d"
265 " ORDER BY tagname /*sort*/", rid, rid, rid
266 );
267 while( db_step(&q)==SQLITE_ROW ){
268 const char *zTagname = db_column_text(&q, 1);
269 const char *zSrcUuid = db_column_text(&q, 2);
270 const char *zValue = db_column_text(&q, 3);
271 const char *zDate = db_column_text(&q, 4);
272 int tagtype = db_column_int(&q, 5);
273 const char *zOrigUuid = db_column_text(&q, 6);
274 cnt++;
275 if( cnt==1 ){
276 @ <div class="section">Tags And Properties</div>
277 @ <ul>
278 }
279 @ <li>
280 if( tagtype==0 ){
281 @ <span class="infoTagCancelled">%h(zTagname)</span> cancelled
282 }else if( zValue ){
283 @ <span class="infoTag">%h(zTagname)=%h(zValue)</span>
284 }else {
285 @ <span class="infoTag">%h(zTagname)</span>
286 }
287 if( tagtype==2 ){
288 if( zOrigUuid && zOrigUuid[0] ){
289 @ inherited from
290 hyperlink_to_uuid(zOrigUuid);
291 }else{
292 @ propagates to descendants
293 }
294 #if 0
295 if( zValue && fossil_strcmp(zTagname,"branch")==0 ){
296 @ &nbsp;&nbsp;
297 @ %z(href("%R/timeline?r=%T",zValue))branch timeline</a>
298 }
299 #endif
300 }
301 if( zSrcUuid && zSrcUuid[0] ){
302 if( tagtype==0 ){
303 @ by
304 }else{
305 @ added by
306 }
307 hyperlink_to_uuid(zSrcUuid);
308 @ on
309 hyperlink_to_date(zDate,0);
310 }
311 @ </li>
312 }
313 db_finalize(&q);
314 if( cnt ){
315 @ </ul>
316 }
317 }
318
319 /*
320 ** Show the context graph (immediate parents and children) for
321 ** check-in rid.
322 */
323 void render_checkin_context(int rid, int parentsOnly){
@@ -557,10 +490,124 @@
557 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
558 diffFlags |= DIFF_STRIP_EOLCR;
559 }
560 return diffFlags;
561 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
563 /*
564 ** WEBPAGE: vinfo
565 ** WEBPAGE: ci
566 ** URL: /ci?name=ARTIFACTID
@@ -742,10 +789,11 @@
742 }
743 if( g.perm.Hyperlink ){
744 @ <tr><th>Other&nbsp;Links:</th>
745 @ <td>
746 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
 
747 if( g.perm.Admin ){
748 @ | %z(href("%R/mlink?ci=%!S",zUuid))mlink table</a>
749 }
750 if( g.anon.Write ){
751 @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a>
@@ -758,11 +806,10 @@
758 style_header("Check-in Information");
759 login_anonymous_available();
760 }
761 db_finalize(&q1);
762 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
763 showTags(rid);
764 @ <div class="section">Context</div>
765 render_checkin_context(rid, 0);
766 @ <div class="section">Changes</div>
767 @ <div class="sectionmenu">
768 diffFlags = construct_diff_flags(diffType);
769
--- src/info.c
+++ src/info.c
@@ -247,77 +247,10 @@
247 }
248 show_common_info(rid, "uuid:", 1, 1);
249 }
250 }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252 /*
253 ** Show the context graph (immediate parents and children) for
254 ** check-in rid.
255 */
256 void render_checkin_context(int rid, int parentsOnly){
@@ -557,10 +490,124 @@
490 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
491 diffFlags |= DIFF_STRIP_EOLCR;
492 }
493 return diffFlags;
494 }
495
496 /*
497 ** WEBPAGE: ci_tags
498 ** URL: /ci_tags?name=ARTIFACTID
499 **
500 ** Show all tags and properties for a given check-in.
501 **
502 ** This information used to be part of the main /ci page, but it is of
503 ** marginal usefulness. Better to factor it out into a sub-screen.
504 */
505 void ci_tags_page(void){
506 const char *zHash;
507 int rid;
508 Stmt q;
509 int cnt = 0;
510 Blob sql;
511
512 login_check_credentials();
513 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
514 rid = name_to_rid_www("name");
515 if( rid==0 ){
516 style_header("Check-in Information Error");
517 @ No such object: %h(g.argv[2])
518 style_footer();
519 return;
520 }
521 zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
522 style_header("Tags and Properties");
523 @ <h1>Tags and Properties for Check-In \
524 @ %z(href("%R/ci/%!S",zHash))%S(zHash)</a></h1>
525 db_prepare(&q,
526 "SELECT tag.tagid, tagname, "
527 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
528 " value, datetime(tagxref.mtime,toLocal()), tagtype,"
529 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
530 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
531 " WHERE tagxref.rid=%d"
532 " ORDER BY tagname /*sort*/", rid, rid, rid
533 );
534 while( db_step(&q)==SQLITE_ROW ){
535 const char *zTagname = db_column_text(&q, 1);
536 const char *zSrcUuid = db_column_text(&q, 2);
537 const char *zValue = db_column_text(&q, 3);
538 const char *zDate = db_column_text(&q, 4);
539 int tagtype = db_column_int(&q, 5);
540 const char *zOrigUuid = db_column_text(&q, 6);
541 cnt++;
542 if( cnt==1 ){
543 @ <ul>
544 }
545 @ <li>
546 if( tagtype==0 ){
547 @ <span class="infoTagCancelled">%h(zTagname)</span> cancelled
548 }else if( zValue ){
549 @ <span class="infoTag">%h(zTagname)=%h(zValue)</span>
550 }else {
551 @ <span class="infoTag">%h(zTagname)</span>
552 }
553 if( tagtype==2 ){
554 if( zOrigUuid && zOrigUuid[0] ){
555 @ inherited from
556 hyperlink_to_uuid(zOrigUuid);
557 }else{
558 @ propagates to descendants
559 }
560 }
561 if( zSrcUuid && zSrcUuid[0] ){
562 if( tagtype==0 ){
563 @ by
564 }else{
565 @ added by
566 }
567 hyperlink_to_uuid(zSrcUuid);
568 @ on
569 hyperlink_to_date(zDate,0);
570 }
571 @ </li>
572 }
573 db_finalize(&q);
574 if( cnt ){
575 @ </ul>
576 }
577 @ <div class="section">Context</div>
578 db_multi_exec(
579 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
580 "DELETE FROM ok;"
581 "INSERT INTO ok VALUES(%d);"
582 "INSERT OR IGNORE INTO ok "
583 " SELECT tagxref.srcid"
584 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
585 " WHERE tagxref.rid=%d;"
586 "INSERT OR IGNORE INTO ok "
587 " SELECT tagxref.origid"
588 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
589 " WHERE tagxref.rid=%d;",
590 rid, rid, rid
591 );
592 db_multi_exec(
593 "SELECT tag.tagid, tagname, "
594 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
595 " value, datetime(tagxref.mtime,toLocal()), tagtype,"
596 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
597 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
598 " WHERE tagxref.rid=%d"
599 " ORDER BY tagname /*sort*/", rid, rid, rid
600 );
601 blob_zero(&sql);
602 blob_append(&sql, timeline_query_for_www(), -1);
603 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
604 db_prepare(&q, "%s", blob_sql_text(&sql));
605 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH, 0, 0, rid, 0);
606 db_finalize(&q);
607 style_footer();
608 }
609
610 /*
611 ** WEBPAGE: vinfo
612 ** WEBPAGE: ci
613 ** URL: /ci?name=ARTIFACTID
@@ -742,10 +789,11 @@
789 }
790 if( g.perm.Hyperlink ){
791 @ <tr><th>Other&nbsp;Links:</th>
792 @ <td>
793 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
794 @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
795 if( g.perm.Admin ){
796 @ | %z(href("%R/mlink?ci=%!S",zUuid))mlink table</a>
797 }
798 if( g.anon.Write ){
799 @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a>
@@ -758,11 +806,10 @@
806 style_header("Check-in Information");
807 login_anonymous_available();
808 }
809 db_finalize(&q1);
810 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
 
811 @ <div class="section">Context</div>
812 render_checkin_context(rid, 0);
813 @ <div class="section">Changes</div>
814 @ <div class="sectionmenu">
815 diffFlags = construct_diff_flags(diffType);
816

Keyboard Shortcuts

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