Fossil SCM

When the "showid" query parameter is given on /timeline or /finfo, show the delta-source artifact ID in addition to the artifact ID.

drh 2017-09-19 01:48 trunk
Commit 29935c6e3e9b36441b2213b0ed8137f8989ef59f3330ff8ad7436fa5236f0c3a
+7 -7
--- src/content.c
+++ src/content.c
@@ -117,11 +117,11 @@
117117
118118
/*
119119
** Return the srcid associated with rid. Or return 0 if rid is
120120
** original content and not a delta.
121121
*/
122
-static int findSrcid(int rid){
122
+int delta_source_rid(int rid){
123123
static Stmt q;
124124
int srcid;
125125
db_static_prepare(&q, "SELECT srcid FROM delta WHERE rid=:rid");
126126
db_bind_int(&q, ":rid", rid);
127127
if( db_step(&q)==SQLITE_ROW ){
@@ -165,11 +165,11 @@
165165
}
166166
if( content_size(rid, -1)<0 ){
167167
bag_insert(&contentCache.missing, rid);
168168
return 0;
169169
}
170
- srcid = findSrcid(rid);
170
+ srcid = delta_source_rid(rid);
171171
if( srcid==0 ){
172172
bag_insert(&contentCache.available, rid);
173173
return 1;
174174
}
175175
rid = srcid;
@@ -250,11 +250,11 @@
250250
return 1;
251251
}
252252
}
253253
}
254254
255
- nextRid = findSrcid(rid);
255
+ nextRid = delta_source_rid(rid);
256256
if( nextRid==0 ){
257257
rc = content_of_blob(rid, pBlob);
258258
}else{
259259
int n = 1;
260260
int nAlloc = 10;
@@ -265,11 +265,11 @@
265265
a = fossil_malloc( sizeof(a[0])*nAlloc );
266266
a[0] = rid;
267267
a[1] = nextRid;
268268
n = 1;
269269
while( !bag_find(&contentCache.inCache, nextRid)
270
- && (nextRid = findSrcid(nextRid))>0 ){
270
+ && (nextRid = delta_source_rid(nextRid))>0 ){
271271
n++;
272272
if( n>=nAlloc ){
273273
if( n>db_int(0, "SELECT max(rid) FROM blob") ){
274274
fossil_panic("infinite loop in DELTA table");
275275
}
@@ -715,11 +715,11 @@
715715
/*
716716
** Make sure the content at rid is the original content and is not a
717717
** delta.
718718
*/
719719
void content_undelta(int rid){
720
- if( findSrcid(rid)>0 ){
720
+ if( delta_source_rid(rid)>0 ){
721721
Blob x;
722722
if( content_get(rid, &x) ){
723723
Stmt s;
724724
db_prepare(&s, "UPDATE blob SET content=:c, size=%d WHERE rid=%d",
725725
blob_size(&x), rid);
@@ -809,11 +809,11 @@
809809
int i; /* Loop variable for aSrc[] */
810810
811811
/* If rid is already a child (a delta) of some other artifact, return
812812
** immediately if the force flags is false
813813
*/
814
- if( !force && findSrcid(rid)>0 ) return 0;
814
+ if( !force && delta_source_rid(rid)>0 ) return 0;
815815
816816
/* Get the complete content of the object to be delta-ed. If the size
817817
** is less than 50 bytes, then there really is no point in trying to do
818818
** a delta, so return immediately
819819
*/
@@ -833,11 +833,11 @@
833833
834834
/* Compute all ancestors of srcid and make sure rid is not one of them.
835835
** If rid is an ancestor of srcid, then making rid a decendent of srcid
836836
** would create a delta loop. */
837837
s = srcid;
838
- while( (s = findSrcid(s))>0 ){
838
+ while( (s = delta_source_rid(s))>0 ){
839839
if( s==rid ){
840840
content_undelta(srcid);
841841
break;
842842
}
843843
}
844844
--- src/content.c
+++ src/content.c
@@ -117,11 +117,11 @@
117
118 /*
119 ** Return the srcid associated with rid. Or return 0 if rid is
120 ** original content and not a delta.
121 */
122 static int findSrcid(int rid){
123 static Stmt q;
124 int srcid;
125 db_static_prepare(&q, "SELECT srcid FROM delta WHERE rid=:rid");
126 db_bind_int(&q, ":rid", rid);
127 if( db_step(&q)==SQLITE_ROW ){
@@ -165,11 +165,11 @@
165 }
166 if( content_size(rid, -1)<0 ){
167 bag_insert(&contentCache.missing, rid);
168 return 0;
169 }
170 srcid = findSrcid(rid);
171 if( srcid==0 ){
172 bag_insert(&contentCache.available, rid);
173 return 1;
174 }
175 rid = srcid;
@@ -250,11 +250,11 @@
250 return 1;
251 }
252 }
253 }
254
255 nextRid = findSrcid(rid);
256 if( nextRid==0 ){
257 rc = content_of_blob(rid, pBlob);
258 }else{
259 int n = 1;
260 int nAlloc = 10;
@@ -265,11 +265,11 @@
265 a = fossil_malloc( sizeof(a[0])*nAlloc );
266 a[0] = rid;
267 a[1] = nextRid;
268 n = 1;
269 while( !bag_find(&contentCache.inCache, nextRid)
270 && (nextRid = findSrcid(nextRid))>0 ){
271 n++;
272 if( n>=nAlloc ){
273 if( n>db_int(0, "SELECT max(rid) FROM blob") ){
274 fossil_panic("infinite loop in DELTA table");
275 }
@@ -715,11 +715,11 @@
715 /*
716 ** Make sure the content at rid is the original content and is not a
717 ** delta.
718 */
719 void content_undelta(int rid){
720 if( findSrcid(rid)>0 ){
721 Blob x;
722 if( content_get(rid, &x) ){
723 Stmt s;
724 db_prepare(&s, "UPDATE blob SET content=:c, size=%d WHERE rid=%d",
725 blob_size(&x), rid);
@@ -809,11 +809,11 @@
809 int i; /* Loop variable for aSrc[] */
810
811 /* If rid is already a child (a delta) of some other artifact, return
812 ** immediately if the force flags is false
813 */
814 if( !force && findSrcid(rid)>0 ) return 0;
815
816 /* Get the complete content of the object to be delta-ed. If the size
817 ** is less than 50 bytes, then there really is no point in trying to do
818 ** a delta, so return immediately
819 */
@@ -833,11 +833,11 @@
833
834 /* Compute all ancestors of srcid and make sure rid is not one of them.
835 ** If rid is an ancestor of srcid, then making rid a decendent of srcid
836 ** would create a delta loop. */
837 s = srcid;
838 while( (s = findSrcid(s))>0 ){
839 if( s==rid ){
840 content_undelta(srcid);
841 break;
842 }
843 }
844
--- src/content.c
+++ src/content.c
@@ -117,11 +117,11 @@
117
118 /*
119 ** Return the srcid associated with rid. Or return 0 if rid is
120 ** original content and not a delta.
121 */
122 int delta_source_rid(int rid){
123 static Stmt q;
124 int srcid;
125 db_static_prepare(&q, "SELECT srcid FROM delta WHERE rid=:rid");
126 db_bind_int(&q, ":rid", rid);
127 if( db_step(&q)==SQLITE_ROW ){
@@ -165,11 +165,11 @@
165 }
166 if( content_size(rid, -1)<0 ){
167 bag_insert(&contentCache.missing, rid);
168 return 0;
169 }
170 srcid = delta_source_rid(rid);
171 if( srcid==0 ){
172 bag_insert(&contentCache.available, rid);
173 return 1;
174 }
175 rid = srcid;
@@ -250,11 +250,11 @@
250 return 1;
251 }
252 }
253 }
254
255 nextRid = delta_source_rid(rid);
256 if( nextRid==0 ){
257 rc = content_of_blob(rid, pBlob);
258 }else{
259 int n = 1;
260 int nAlloc = 10;
@@ -265,11 +265,11 @@
265 a = fossil_malloc( sizeof(a[0])*nAlloc );
266 a[0] = rid;
267 a[1] = nextRid;
268 n = 1;
269 while( !bag_find(&contentCache.inCache, nextRid)
270 && (nextRid = delta_source_rid(nextRid))>0 ){
271 n++;
272 if( n>=nAlloc ){
273 if( n>db_int(0, "SELECT max(rid) FROM blob") ){
274 fossil_panic("infinite loop in DELTA table");
275 }
@@ -715,11 +715,11 @@
715 /*
716 ** Make sure the content at rid is the original content and is not a
717 ** delta.
718 */
719 void content_undelta(int rid){
720 if( delta_source_rid(rid)>0 ){
721 Blob x;
722 if( content_get(rid, &x) ){
723 Stmt s;
724 db_prepare(&s, "UPDATE blob SET content=:c, size=%d WHERE rid=%d",
725 blob_size(&x), rid);
@@ -809,11 +809,11 @@
809 int i; /* Loop variable for aSrc[] */
810
811 /* If rid is already a child (a delta) of some other artifact, return
812 ** immediately if the force flags is false
813 */
814 if( !force && delta_source_rid(rid)>0 ) return 0;
815
816 /* Get the complete content of the object to be delta-ed. If the size
817 ** is less than 50 bytes, then there really is no point in trying to do
818 ** a delta, so return immediately
819 */
@@ -833,11 +833,11 @@
833
834 /* Compute all ancestors of srcid and make sure rid is not one of them.
835 ** If rid is an ancestor of srcid, then making rid a decendent of srcid
836 ** would create a delta loop. */
837 s = srcid;
838 while( (s = delta_source_rid(s))>0 ){
839 if( s==rid ){
840 content_undelta(srcid);
841 break;
842 }
843 }
844
+6 -1
--- src/finfo.c
+++ src/finfo.c
@@ -493,11 +493,16 @@
493493
@ <b>Renamed</b> from
494494
@ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
495495
}
496496
@ %z(href("%R/artifact/%!S",zUuid))[%S(zUuid)]</a>
497497
if( fShowId ){
498
- @ (%d(frid))
498
+ int srcId = delta_source_rid(frid);
499
+ if( srcId>0 ){
500
+ @ (%d(frid)&larr;%d(srcId))
501
+ }else{
502
+ @ (%d(frid))
503
+ }
499504
}
500505
@ part of check-in
501506
}else{
502507
char *zNewName;
503508
zNewName = db_text(0,
504509
--- src/finfo.c
+++ src/finfo.c
@@ -493,11 +493,16 @@
493 @ <b>Renamed</b> from
494 @ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
495 }
496 @ %z(href("%R/artifact/%!S",zUuid))[%S(zUuid)]</a>
497 if( fShowId ){
498 @ (%d(frid))
 
 
 
 
 
499 }
500 @ part of check-in
501 }else{
502 char *zNewName;
503 zNewName = db_text(0,
504
--- src/finfo.c
+++ src/finfo.c
@@ -493,11 +493,16 @@
493 @ <b>Renamed</b> from
494 @ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
495 }
496 @ %z(href("%R/artifact/%!S",zUuid))[%S(zUuid)]</a>
497 if( fShowId ){
498 int srcId = delta_source_rid(frid);
499 if( srcId>0 ){
500 @ (%d(frid)&larr;%d(srcId))
501 }else{
502 @ (%d(frid))
503 }
504 }
505 @ part of check-in
506 }else{
507 char *zNewName;
508 zNewName = db_text(0,
509
+6 -1
--- src/timeline.c
+++ src/timeline.c
@@ -447,11 +447,16 @@
447447
hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
448448
}else if( (tmFlags & TIMELINE_ARTID)!=0 ){
449449
hyperlink_to_uuid(zUuid);
450450
}
451451
if( tmFlags & TIMELINE_SHOWRID ){
452
- @ (%d(rid))
452
+ int srcId = delta_source_rid(rid);
453
+ if( srcId ){
454
+ @ (%d(rid)&larr;%d(srcId))
455
+ }else{
456
+ @ (%d(rid))
457
+ }
453458
}
454459
db_column_blob(pQuery, commentColumn, &comment);
455460
if( zType[0]!='c' ){
456461
/* Comments for anything other than a check-in are generated by
457462
** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
458463
--- src/timeline.c
+++ src/timeline.c
@@ -447,11 +447,16 @@
447 hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
448 }else if( (tmFlags & TIMELINE_ARTID)!=0 ){
449 hyperlink_to_uuid(zUuid);
450 }
451 if( tmFlags & TIMELINE_SHOWRID ){
452 @ (%d(rid))
 
 
 
 
 
453 }
454 db_column_blob(pQuery, commentColumn, &comment);
455 if( zType[0]!='c' ){
456 /* Comments for anything other than a check-in are generated by
457 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
458
--- src/timeline.c
+++ src/timeline.c
@@ -447,11 +447,16 @@
447 hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
448 }else if( (tmFlags & TIMELINE_ARTID)!=0 ){
449 hyperlink_to_uuid(zUuid);
450 }
451 if( tmFlags & TIMELINE_SHOWRID ){
452 int srcId = delta_source_rid(rid);
453 if( srcId ){
454 @ (%d(rid)&larr;%d(srcId))
455 }else{
456 @ (%d(rid))
457 }
458 }
459 db_column_blob(pQuery, commentColumn, &comment);
460 if( zType[0]!='c' ){
461 /* Comments for anything other than a check-in are generated by
462 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
463

Keyboard Shortcuts

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