Fossil SCM

Add a new link to the check-in "info" page that goes to a timeline showing just the immediate parents and children of a check-in. Ticket [746949c9318554c137f5].

drh 2010-11-25 00:17 UTC trunk
Commit 8c04a873c8a8969796a02454c38a695f20f5ddf3
2 files changed +2 -1 +27 -1
+2 -1
--- src/info.c
+++ src/info.c
@@ -427,11 +427,12 @@
427427
db_finalize(&q);
428428
}
429429
if( g.okHistory ){
430430
const char *zProjName = db_get("project-name", "unnamed");
431431
@ <tr><th>Timelines:</th><td>
432
- @ <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
432
+ @ <a href="%s(g.zBaseURL)/timeline?f=%S(zUuid)">family</a>
433
+ @ | <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
433434
@ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
434435
@ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&amp;p=%S(zUuid)">both</a>
435436
db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
436437
" WHERE rid=%d AND tagtype>0 "
437438
" AND tag.tagid=tagxref.tagid "
438439
--- src/info.c
+++ src/info.c
@@ -427,11 +427,12 @@
427 db_finalize(&q);
428 }
429 if( g.okHistory ){
430 const char *zProjName = db_get("project-name", "unnamed");
431 @ <tr><th>Timelines:</th><td>
432 @ <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
 
433 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
434 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&amp;p=%S(zUuid)">both</a>
435 db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
436 " WHERE rid=%d AND tagtype>0 "
437 " AND tag.tagid=tagxref.tagid "
438
--- src/info.c
+++ src/info.c
@@ -427,11 +427,12 @@
427 db_finalize(&q);
428 }
429 if( g.okHistory ){
430 const char *zProjName = db_get("project-name", "unnamed");
431 @ <tr><th>Timelines:</th><td>
432 @ <a href="%s(g.zBaseURL)/timeline?f=%S(zUuid)">family</a>
433 @ | <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
434 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
435 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&amp;p=%S(zUuid)">both</a>
436 db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
437 " WHERE rid=%d AND tagtype>0 "
438 " AND tag.tagid=tagxref.tagid "
439
+27 -1
--- src/timeline.c
+++ src/timeline.c
@@ -646,10 +646,11 @@
646646
** r=TAGID show check-ins related to tagid
647647
** u=USER only if belonging to this user
648648
** y=TYPE 'ci', 'w', 't', 'e'
649649
** s=TEXT string search (comment and brief)
650650
** ng Suppress the graph if present
651
+** f=RID Show family (immediate parents and children) of RID
651652
**
652653
** p= and d= can appear individually or together. If either p= or d=
653654
** appear, then u=, y=, a=, and b= are ignored.
654655
**
655656
** If a= and b= appear, only a= is used. If neither appear, the most
@@ -661,11 +662,12 @@
661662
Stmt q; /* Query used to generate the timeline */
662663
Blob sql; /* text of SQL used to generate timeline */
663664
Blob desc; /* Description of the timeline */
664665
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
665666
int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
666
- int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
667
+ int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
668
+ int f_rid = name_to_rid(P("f")); /* artifact f and immediate family */
667669
const char *zUser = P("u"); /* All entries by this user if not NULL */
668670
const char *zType = PD("y","all"); /* Type of events. All if NULL */
669671
const char *zAfter = P("a"); /* Events after this time */
670672
const char *zBefore = P("b"); /* Events before this time */
671673
const char *zCirca = P("c"); /* Events near this time */
@@ -751,10 +753,34 @@
751753
blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
752754
g.zBaseURL, zUuid, zUuid);
753755
}else{
754756
blob_appendf(&desc, " of check-in [%.10s]", zUuid);
755757
}
758
+ }else if( f_rid && g.okRead ){
759
+ /* If f= is present, ignore all other parameters other than n= */
760
+ char *zUuid;
761
+ db_multi_exec(
762
+ "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
763
+ "INSERT INTO ok VALUES(%d);"
764
+ "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
765
+ "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
766
+ f_rid, f_rid, f_rid
767
+ );
768
+ blob_appendf(&sql, " AND event.objid IN ok");
769
+ db_multi_exec("%s", blob_str(&sql));
770
+ timeline_add_dividers(
771
+ db_text("1","SELECT datetime(mtime,'localtime') FROM event"
772
+ " WHERE objid=%d", f_rid)
773
+ );
774
+ blob_appendf(&desc, "Parents and children of check-in ");
775
+ zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
776
+ if( g.okHistory ){
777
+ blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
778
+ g.zBaseURL, zUuid, zUuid);
779
+ }else{
780
+ blob_appendf(&desc, "[%.10s]", zUuid);
781
+ }
756782
}else{
757783
int n;
758784
const char *zEType = "timeline item";
759785
char *zDate;
760786
char *zNEntry = mprintf("%d", nEntry);
761787
--- src/timeline.c
+++ src/timeline.c
@@ -646,10 +646,11 @@
646 ** r=TAGID show check-ins related to tagid
647 ** u=USER only if belonging to this user
648 ** y=TYPE 'ci', 'w', 't', 'e'
649 ** s=TEXT string search (comment and brief)
650 ** ng Suppress the graph if present
 
651 **
652 ** p= and d= can appear individually or together. If either p= or d=
653 ** appear, then u=, y=, a=, and b= are ignored.
654 **
655 ** If a= and b= appear, only a= is used. If neither appear, the most
@@ -661,11 +662,12 @@
661 Stmt q; /* Query used to generate the timeline */
662 Blob sql; /* text of SQL used to generate timeline */
663 Blob desc; /* Description of the timeline */
664 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
665 int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
666 int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
 
667 const char *zUser = P("u"); /* All entries by this user if not NULL */
668 const char *zType = PD("y","all"); /* Type of events. All if NULL */
669 const char *zAfter = P("a"); /* Events after this time */
670 const char *zBefore = P("b"); /* Events before this time */
671 const char *zCirca = P("c"); /* Events near this time */
@@ -751,10 +753,34 @@
751 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
752 g.zBaseURL, zUuid, zUuid);
753 }else{
754 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
755 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756 }else{
757 int n;
758 const char *zEType = "timeline item";
759 char *zDate;
760 char *zNEntry = mprintf("%d", nEntry);
761
--- src/timeline.c
+++ src/timeline.c
@@ -646,10 +646,11 @@
646 ** r=TAGID show check-ins related to tagid
647 ** u=USER only if belonging to this user
648 ** y=TYPE 'ci', 'w', 't', 'e'
649 ** s=TEXT string search (comment and brief)
650 ** ng Suppress the graph if present
651 ** f=RID Show family (immediate parents and children) of RID
652 **
653 ** p= and d= can appear individually or together. If either p= or d=
654 ** appear, then u=, y=, a=, and b= are ignored.
655 **
656 ** If a= and b= appear, only a= is used. If neither appear, the most
@@ -661,11 +662,12 @@
662 Stmt q; /* Query used to generate the timeline */
663 Blob sql; /* text of SQL used to generate timeline */
664 Blob desc; /* Description of the timeline */
665 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
666 int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
667 int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
668 int f_rid = name_to_rid(P("f")); /* artifact f and immediate family */
669 const char *zUser = P("u"); /* All entries by this user if not NULL */
670 const char *zType = PD("y","all"); /* Type of events. All if NULL */
671 const char *zAfter = P("a"); /* Events after this time */
672 const char *zBefore = P("b"); /* Events before this time */
673 const char *zCirca = P("c"); /* Events near this time */
@@ -751,10 +753,34 @@
753 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
754 g.zBaseURL, zUuid, zUuid);
755 }else{
756 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
757 }
758 }else if( f_rid && g.okRead ){
759 /* If f= is present, ignore all other parameters other than n= */
760 char *zUuid;
761 db_multi_exec(
762 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
763 "INSERT INTO ok VALUES(%d);"
764 "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
765 "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
766 f_rid, f_rid, f_rid
767 );
768 blob_appendf(&sql, " AND event.objid IN ok");
769 db_multi_exec("%s", blob_str(&sql));
770 timeline_add_dividers(
771 db_text("1","SELECT datetime(mtime,'localtime') FROM event"
772 " WHERE objid=%d", f_rid)
773 );
774 blob_appendf(&desc, "Parents and children of check-in ");
775 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
776 if( g.okHistory ){
777 blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
778 g.zBaseURL, zUuid, zUuid);
779 }else{
780 blob_appendf(&desc, "[%.10s]", zUuid);
781 }
782 }else{
783 int n;
784 const char *zEType = "timeline item";
785 char *zDate;
786 char *zNEntry = mprintf("%d", nEntry);
787

Keyboard Shortcuts

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