Fossil SCM

Avoid the use of rowids in URLs, since they can change on a rebuild. Use SHA1-derived artifact IDs instead.

drh 2010-03-21 21:51 trunk
Commit a4b10f43e2d3b65cd72c04734e27f166b90e956e
+4 -1
--- src/attach.c
+++ src/attach.c
@@ -30,13 +30,16 @@
3030
/*
3131
** WEBPAGE: attachlist
3232
**
3333
** tkt=TICKETUUID
3434
** page=WIKIPAGE
35
-** all
3635
**
3736
** List attachments.
37
+** Either one of tkt= or page= are supplied or neither. If neither
38
+** are given, all attachments are listed. If one is given, only
39
+** attachments for the designated ticket or wiki page are shown.
40
+** TICKETUUID must be complete
3841
*/
3942
void attachlist_page(void){
4043
const char *zPage = P("page");
4144
const char *zTkt = P("tkt");
4245
Blob sql;
4346
--- src/attach.c
+++ src/attach.c
@@ -30,13 +30,16 @@
30 /*
31 ** WEBPAGE: attachlist
32 **
33 ** tkt=TICKETUUID
34 ** page=WIKIPAGE
35 ** all
36 **
37 ** List attachments.
 
 
 
 
38 */
39 void attachlist_page(void){
40 const char *zPage = P("page");
41 const char *zTkt = P("tkt");
42 Blob sql;
43
--- src/attach.c
+++ src/attach.c
@@ -30,13 +30,16 @@
30 /*
31 ** WEBPAGE: attachlist
32 **
33 ** tkt=TICKETUUID
34 ** page=WIKIPAGE
 
35 **
36 ** List attachments.
37 ** Either one of tkt= or page= are supplied or neither. If neither
38 ** are given, all attachments are listed. If one is given, only
39 ** attachments for the designated ticket or wiki page are shown.
40 ** TICKETUUID must be complete
41 */
42 void attachlist_page(void){
43 const char *zPage = P("page");
44 const char *zTkt = P("tkt");
45 Blob sql;
46
+3 -3
--- src/browse.c
+++ src/browse.c
@@ -150,14 +150,14 @@
150150
char zShort[20];
151151
memcpy(zShort, zUuid, 10);
152152
zShort[10] = 0;
153153
@ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
154154
@ %s(blob_str(&dirname))</h2>
155
- zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
155
+ zSubdirLink = mprintf("%s/dir?ci=%S&name=%T", g.zTop, zUuid, zPrefix);
156156
if( zD ){
157
- style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
158
- style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
157
+ style_submenu_element("Top", "Top", "%s/dir?ci=%S", g.zTop, zUuid);
158
+ style_submenu_element("All", "All", "%s/dir?name=%t", g.zTop, zD);
159159
}else{
160160
style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
161161
}
162162
}else{
163163
@ <h2>The union of all files from all check-ins
164164
--- src/browse.c
+++ src/browse.c
@@ -150,14 +150,14 @@
150 char zShort[20];
151 memcpy(zShort, zUuid, 10);
152 zShort[10] = 0;
153 @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
154 @ %s(blob_str(&dirname))</h2>
155 zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
156 if( zD ){
157 style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
158 style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
159 }else{
160 style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
161 }
162 }else{
163 @ <h2>The union of all files from all check-ins
164
--- src/browse.c
+++ src/browse.c
@@ -150,14 +150,14 @@
150 char zShort[20];
151 memcpy(zShort, zUuid, 10);
152 zShort[10] = 0;
153 @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
154 @ %s(blob_str(&dirname))</h2>
155 zSubdirLink = mprintf("%s/dir?ci=%S&name=%T", g.zTop, zUuid, zPrefix);
156 if( zD ){
157 style_submenu_element("Top", "Top", "%s/dir?ci=%S", g.zTop, zUuid);
158 style_submenu_element("All", "All", "%s/dir?name=%t", g.zTop, zD);
159 }else{
160 style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
161 }
162 }else{
163 @ <h2>The union of all files from all check-ins
164
+6 -4
--- src/diff.c
+++ src/diff.c
@@ -729,21 +729,23 @@
729729
/*
730730
** WEBPAGE: annotate
731731
**
732732
** Query parameters:
733733
**
734
-** mid=NUM The manifest ID at which to start the annotation
735
-** fnid=NUM The filename ID.
734
+** checkin=ID The manifest ID at which to start the annotation
735
+** filename=FILENAME The filename.
736736
*/
737737
void annotation_page(void){
738
- int mid = atoi(PD("mid","0"));
739
- int fnid = atoi(PD("fnid","0"));
738
+ int mid;
739
+ int fnid;
740740
int i;
741741
Annotator ann;
742742
743743
login_check_credentials();
744744
if( !g.okRead ){ login_needed(); return; }
745
+ mid = name_to_rid(PD("checkin","0"));
746
+ fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
745747
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
746748
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
747749
fossil_redirect_home();
748750
}
749751
style_header("File Annotation");
750752
--- src/diff.c
+++ src/diff.c
@@ -729,21 +729,23 @@
729 /*
730 ** WEBPAGE: annotate
731 **
732 ** Query parameters:
733 **
734 ** mid=NUM The manifest ID at which to start the annotation
735 ** fnid=NUM The filename ID.
736 */
737 void annotation_page(void){
738 int mid = atoi(PD("mid","0"));
739 int fnid = atoi(PD("fnid","0"));
740 int i;
741 Annotator ann;
742
743 login_check_credentials();
744 if( !g.okRead ){ login_needed(); return; }
 
 
745 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
746 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
747 fossil_redirect_home();
748 }
749 style_header("File Annotation");
750
--- src/diff.c
+++ src/diff.c
@@ -729,21 +729,23 @@
729 /*
730 ** WEBPAGE: annotate
731 **
732 ** Query parameters:
733 **
734 ** checkin=ID The manifest ID at which to start the annotation
735 ** filename=FILENAME The filename.
736 */
737 void annotation_page(void){
738 int mid;
739 int fnid;
740 int i;
741 Annotator ann;
742
743 login_check_credentials();
744 if( !g.okRead ){ login_needed(); return; }
745 mid = name_to_rid(PD("checkin","0"));
746 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
747 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
748 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
749 fossil_redirect_home();
750 }
751 style_header("File Annotation");
752
+6 -6
--- src/finfo.c
+++ src/finfo.c
@@ -117,12 +117,12 @@
117117
" datetime(event.mtime,'localtime'),"
118118
" coalesce(event.ecomment, event.comment),"
119119
" coalesce(event.euser, event.user),"
120120
" mlink.pid,"
121121
" mlink.fid,"
122
- " mlink.mid,"
123
- " mlink.fnid,"
122
+ " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.pid),"
123
+ " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.fid),"
124124
" ci.uuid,"
125125
" event.bgcolor,"
126126
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
127127
" AND tagxref.rid=mlink.mid)"
128128
" FROM mlink, blob b, event, blob ci"
@@ -147,12 +147,12 @@
147147
const char *zDate = db_column_text(&q, 1);
148148
const char *zCom = db_column_text(&q, 2);
149149
const char *zUser = db_column_text(&q, 3);
150150
int fpid = db_column_int(&q, 4);
151151
int frid = db_column_int(&q, 5);
152
- int mid = db_column_int(&q, 6);
153
- int fnid = db_column_int(&q, 7);
152
+ const char *zFpuid = db_column_text(&q, 6);
153
+ const char *zFuid = db_column_text(&q, 7);
154154
const char *zCkin = db_column_text(&q,8);
155155
const char *zBgClr = db_column_text(&q, 9);
156156
const char *zBr = db_column_text(&q, 10);
157157
int gidx;
158158
char zTime[10];
@@ -188,13 +188,13 @@
188188
@ %h(zCom) (user:
189189
hyperlink_to_user(zUser, zDate, "");
190190
@ branch: %h(zBr))
191191
if( g.okHistory ){
192192
if( fpid ){
193
- @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&amp;v2=%d(frid)">[diff]</a>
193
+ @ <a href="%s(g.zTop)/fdiff?v1=%s(zFpuid)&amp;v2=%s(zFuid)">[diff]</a>
194194
}
195
- @ <a href="%s(g.zBaseURL)/annotate?mid=%d(mid)&amp;fnid=%d(fnid)">
195
+ @ <a href="%s(g.zTop)/annotate?checkin=%s(zShortCkin)&amp;filename=%h(zFilename)">
196196
@ [annotate]</a>
197197
@ </td>
198198
}
199199
}
200200
db_finalize(&q);
201201
--- src/finfo.c
+++ src/finfo.c
@@ -117,12 +117,12 @@
117 " datetime(event.mtime,'localtime'),"
118 " coalesce(event.ecomment, event.comment),"
119 " coalesce(event.euser, event.user),"
120 " mlink.pid,"
121 " mlink.fid,"
122 " mlink.mid,"
123 " mlink.fnid,"
124 " ci.uuid,"
125 " event.bgcolor,"
126 " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
127 " AND tagxref.rid=mlink.mid)"
128 " FROM mlink, blob b, event, blob ci"
@@ -147,12 +147,12 @@
147 const char *zDate = db_column_text(&q, 1);
148 const char *zCom = db_column_text(&q, 2);
149 const char *zUser = db_column_text(&q, 3);
150 int fpid = db_column_int(&q, 4);
151 int frid = db_column_int(&q, 5);
152 int mid = db_column_int(&q, 6);
153 int fnid = db_column_int(&q, 7);
154 const char *zCkin = db_column_text(&q,8);
155 const char *zBgClr = db_column_text(&q, 9);
156 const char *zBr = db_column_text(&q, 10);
157 int gidx;
158 char zTime[10];
@@ -188,13 +188,13 @@
188 @ %h(zCom) (user:
189 hyperlink_to_user(zUser, zDate, "");
190 @ branch: %h(zBr))
191 if( g.okHistory ){
192 if( fpid ){
193 @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&amp;v2=%d(frid)">[diff]</a>
194 }
195 @ <a href="%s(g.zBaseURL)/annotate?mid=%d(mid)&amp;fnid=%d(fnid)">
196 @ [annotate]</a>
197 @ </td>
198 }
199 }
200 db_finalize(&q);
201
--- src/finfo.c
+++ src/finfo.c
@@ -117,12 +117,12 @@
117 " datetime(event.mtime,'localtime'),"
118 " coalesce(event.ecomment, event.comment),"
119 " coalesce(event.euser, event.user),"
120 " mlink.pid,"
121 " mlink.fid,"
122 " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.pid),"
123 " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.fid),"
124 " ci.uuid,"
125 " event.bgcolor,"
126 " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
127 " AND tagxref.rid=mlink.mid)"
128 " FROM mlink, blob b, event, blob ci"
@@ -147,12 +147,12 @@
147 const char *zDate = db_column_text(&q, 1);
148 const char *zCom = db_column_text(&q, 2);
149 const char *zUser = db_column_text(&q, 3);
150 int fpid = db_column_int(&q, 4);
151 int frid = db_column_int(&q, 5);
152 const char *zFpuid = db_column_text(&q, 6);
153 const char *zFuid = db_column_text(&q, 7);
154 const char *zCkin = db_column_text(&q,8);
155 const char *zBgClr = db_column_text(&q, 9);
156 const char *zBr = db_column_text(&q, 10);
157 int gidx;
158 char zTime[10];
@@ -188,13 +188,13 @@
188 @ %h(zCom) (user:
189 hyperlink_to_user(zUser, zDate, "");
190 @ branch: %h(zBr))
191 if( g.okHistory ){
192 if( fpid ){
193 @ <a href="%s(g.zTop)/fdiff?v1=%s(zFpuid)&amp;v2=%s(zFuid)">[diff]</a>
194 }
195 @ <a href="%s(g.zTop)/annotate?checkin=%s(zShortCkin)&amp;filename=%h(zFilename)">
196 @ [annotate]</a>
197 @ </td>
198 }
199 }
200 db_finalize(&q);
201
+32 -34
--- src/info.c
+++ src/info.c
@@ -346,38 +346,36 @@
346346
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
347347
}
348348
db_finalize(&q);
349349
}
350350
if( g.okHistory ){
351
- char *zShortUuid = mprintf("%.10s", zUuid);
352351
const char *zProjName = db_get("project-name", "unnamed");
353352
@ <tr><th>Timelines:</th><td>
354
- @ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a>
355
- @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a>
356
- @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a>
353
+ @ <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
354
+ @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
355
+ @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&p=%S(zUuid)">both</a>
357356
db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
358357
" WHERE rid=%d AND tagtype>0 "
359358
" AND tag.tagid=tagxref.tagid "
360359
" AND +tag.tagname GLOB 'sym-*'", rid);
361360
while( db_step(&q)==SQLITE_ROW ){
362361
const char *zTagName = db_column_text(&q, 0);
363
- @ | <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>
362
+ @ | <a href="%s(g.zTop)/timeline?t=%T(zTagName)">%h(zTagName)</a>
364363
}
365364
db_finalize(&q);
366365
@ </td></tr>
367366
@ <tr><th>Other&nbsp;Links:</th>
368367
@ <td>
369
- @ <a href="%s(g.zBaseURL)/dir?ci=%s(zShortUuid)">files</a>
370
- @ | <a href="%s(g.zBaseURL)/zip/%s(zProjName)-%s(zShortUuid).zip?uuid=%s(zUuid)">
368
+ @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
369
+ @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
371370
@ ZIP archive</a>
372
- @ | <a href="%s(g.zBaseURL)/artifact/%d(rid)">manifest</a>
371
+ @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
373372
if( g.okWrite ){
374
- @ | <a href="%s(g.zBaseURL)/ci_edit?r=%d(rid)">edit</a>
373
+ @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
375374
}
376375
@ </td>
377376
@ </tr>
378
- free(zShortUuid);
379377
}
380378
@ </table></p>
381379
}else{
382380
style_header("Check-in Information");
383381
login_anonymous_available();
@@ -498,13 +496,12 @@
498496
@ <tr><th>Original&nbsp;User:</th><td>
499497
hyperlink_to_user(zUser, zDate, "</td></tr>");
500498
if( g.okHistory ){
501499
@ <tr><th>Commands:</th>
502500
@ <td>
503
- /* @ <a href="%s(g.zBaseURL)/wdiff/%d(rid)">diff</a> | */
504501
@ <a href="%s(g.zBaseURL)/whistory?name=%t(zName)">history</a>
505
- @ | <a href="%s(g.zBaseURL)/artifact/%d(rid)">raw-text</a>
502
+ @ | <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">raw-text</a>
506503
@ </td>
507504
@ </tr>
508505
}
509506
@ </table></p>
510507
}else{
@@ -621,10 +618,12 @@
621618
Blob *pDownloadName /* Fill with an appropriate download name */
622619
){
623620
Stmt q;
624621
int cnt = 0;
625622
int nWiki = 0;
623
+ char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
624
+
626625
db_prepare(&q,
627626
"SELECT filename.name, datetime(event.mtime),"
628627
" coalesce(event.ecomment,event.comment),"
629628
" coalesce(event.euser,event.user),"
630629
" b.uuid"
@@ -691,11 +690,11 @@
691690
hyperlink_to_user(zUser,zDate," on");
692691
hyperlink_to_date(zDate,".");
693692
nWiki++;
694693
cnt++;
695694
if( pDownloadName && blob_size(pDownloadName)==0 ){
696
- blob_append(pDownloadName, zPagename, -1);
695
+ blob_appendf(pDownloadName, "%s.wiki", zPagename);
697696
}
698697
}
699698
db_finalize(&q);
700699
if( nWiki==0 ){
701700
db_prepare(&q,
@@ -726,11 +725,11 @@
726725
hyperlink_to_uuid(zUuid);
727726
@ - %w(zCom) by
728727
hyperlink_to_user(zUser,zDate," on");
729728
hyperlink_to_date(zDate, ".");
730729
if( pDownloadName && blob_size(pDownloadName)==0 ){
731
- blob_append(pDownloadName, zUuid, -1);
730
+ blob_appendf(pDownloadName, "%.10s.txt", zUuid);
732731
}
733732
cnt++;
734733
}
735734
db_finalize(&q);
736735
}
@@ -744,11 +743,11 @@
744743
while( db_step(&q)==SQLITE_ROW ){
745744
const char *zTarget = db_column_text(&q, 0);
746745
const char *zFilename = db_column_text(&q, 1);
747746
const char *zDate = db_column_text(&q, 2);
748747
const char *zUser = db_column_text(&q, 3);
749
- const char *zSrc = db_column_text(&q, 4);
748
+ /* const char *zSrc = db_column_text(&q, 4); */
750749
if( cnt>0 ){
751750
@ Also attachment "%h(zFilename)" to
752751
}else{
753752
@ Attachment "%h(zFilename)" to
754753
}
@@ -770,22 +769,21 @@
770769
@ added by
771770
hyperlink_to_user(zUser,zDate," on");
772771
hyperlink_to_date(zDate,".");
773772
cnt++;
774773
if( pDownloadName && blob_size(pDownloadName)==0 ){
775
- blob_append(pDownloadName, zSrc, -1);
774
+ blob_append(pDownloadName, zFilename, -1);
776775
}
777776
}
778777
db_finalize(&q);
779778
if( cnt==0 ){
780
- char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
781779
@ Control artifact.
782780
if( pDownloadName && blob_size(pDownloadName)==0 ){
783
- blob_append(pDownloadName, zUuid, -1);
781
+ blob_appendf(pDownloadName, "%.10s.txt", zUuid);
784782
}
785783
}else if( linkToView && g.okHistory ){
786
- @ <a href="%s(g.zBaseURL)/artifact/%d(rid)">[view]</a>
784
+ @ <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">[view]</a>
787785
}
788786
}
789787
790788
791789
/*
@@ -793,12 +791,12 @@
793791
**
794792
** Two arguments, v1 and v2, are integers. Show the difference between
795793
** the two records.
796794
*/
797795
void diff_page(void){
798
- int v1 = name_to_rid(PD("v1","0"));
799
- int v2 = name_to_rid(PD("v2","0"));
796
+ int v1 = name_to_rid(P("v1"));
797
+ int v2 = name_to_rid(P("v2"));
800798
Blob c1, c2, diff;
801799
802800
login_check_credentials();
803801
if( !g.okRead ){ login_needed(); return; }
804802
style_header("Diff");
@@ -929,11 +927,11 @@
929927
@ <h2>Artifact %s(zUuid):</h2>
930928
@ <blockquote>
931929
blob_zero(&downloadName);
932930
object_description(rid, 0, &downloadName);
933931
style_submenu_element("Download", "Download",
934
- "%s/raw/%T?name=%d", g.zBaseURL, blob_str(&downloadName), rid);
932
+ "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
935933
@ </blockquote>
936934
@ <hr>
937935
content_get(rid, &content);
938936
@ <blockquote><pre>
939937
hexdump(&content);
@@ -976,30 +974,30 @@
976974
@ <h2>Artifact %s(zUuid)</h2>
977975
@ <blockquote>
978976
blob_zero(&downloadName);
979977
object_description(rid, 0, &downloadName);
980978
style_submenu_element("Download", "Download",
981
- "%s/raw/%T?name=%d", g.zTop, blob_str(&downloadName), rid);
979
+ "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
982980
zMime = mimetype_from_name(blob_str(&downloadName));
983981
if( zMime ){
984982
if( strcmp(zMime, "text/html")==0 ){
985983
if( P("txt") ){
986984
style_submenu_element("Html", "Html",
987
- "%s/artifact?name=%d", g.zTop, rid);
985
+ "%s/artifact?name=%s", g.zTop, zUuid);
988986
}else{
989987
renderAsHtml = 1;
990988
style_submenu_element("Text", "Text",
991
- "%s/artifact?name=%d&txt=1", g.zTop, rid);
989
+ "%s/artifact?name=%s&txt=1", g.zTop, zUuid);
992990
}
993991
}else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){
994992
if( P("txt") ){
995993
style_submenu_element("Wiki", "Wiki",
996
- "%s/artifact?name=%d", g.zTop, rid);
994
+ "%s/artifact?name=%s", g.zTop, zUuid);
997995
}else{
998996
renderAsWiki = 1;
999997
style_submenu_element("Text", "Text",
1000
- "%s/artifact?name=%d&txt=1", g.zTop, rid);
998
+ "%s/artifact?name=%s&txt=1", g.zTop, zUuid);
1001999
}
10021000
}
10031001
}
10041002
@ </blockquote>
10051003
@ <hr>
@@ -1015,14 +1013,14 @@
10151013
@ <blockquote>
10161014
if( zMime==0 ){
10171015
@ <pre>
10181016
@ %h(blob_str(&content))
10191017
@ </pre>
1020
- style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid);
1018
+ style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
10211019
}else if( strncmp(zMime, "image/", 6)==0 ){
1022
- @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img>
1023
- style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid);
1020
+ @ <img src="%s(g.zBaseURL)/raw?name=%s(zUuid)&m=%s(zMime)"></img>
1021
+ style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
10241022
}else{
10251023
@ <pre>
10261024
hexdump(&content);
10271025
@ </pre>
10281026
}
@@ -1196,17 +1194,17 @@
11961194
int nColor = sizeof(aColor)/sizeof(aColor[0]);
11971195
int i;
11981196
11991197
login_check_credentials();
12001198
if( !g.okWrite ){ login_needed(); return; }
1201
- rid = atoi(PD("r","0"));
1199
+ rid = name_to_rid(P("r"));
12021200
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
12031201
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
12041202
" FROM event WHERE objid=%d", rid);
12051203
if( zComment==0 ) fossil_redirect_home();
12061204
if( P("cancel") ){
1207
- cgi_redirectf("ci?name=%d", rid);
1205
+ cgi_redirectf("ci?name=%s", zUuid);
12081206
}
12091207
zNewComment = PD("c",zComment);
12101208
zUser = db_text(0, "SELECT coalesce(euser,user)"
12111209
" FROM event WHERE objid=%d", rid);
12121210
if( zUser==0 ) fossil_redirect_home();
@@ -1315,11 +1313,11 @@
13151313
g.markPrivate = content_is_private(rid);
13161314
nrid = content_put(&ctrl, 0, 0);
13171315
manifest_crosslink(nrid, &ctrl);
13181316
db_end_transaction(0);
13191317
}
1320
- cgi_redirectf("ci?name=%d", rid);
1318
+ cgi_redirectf("ci?name=%s", zUuid);
13211319
}
13221320
blob_zero(&comment);
13231321
blob_append(&comment, zNewComment, -1);
13241322
zUuid[10] = 0;
13251323
style_header("Edit Check-in [%s]", zUuid);
@@ -1357,11 +1355,11 @@
13571355
@ </blockquote>
13581356
@ <hr>
13591357
blob_reset(&suffix);
13601358
}
13611359
@ <p>Make changes to attributes of check-in
1362
- @ [<a href="ci?name=%d(rid)">%s(zUuid)</a>]:</p>
1360
+ @ [<a href="ci?name=%s(zUuid)">%s(zUuid)</a>]:</p>
13631361
@ <form action="%s(g.zBaseURL)/ci_edit" method="POST">
13641362
login_insert_csrf_secret();
13651363
@ <input type="hidden" name="r" value="%d(rid)">
13661364
@ <table border="0" cellspacing="10">
13671365
13681366
--- src/info.c
+++ src/info.c
@@ -346,38 +346,36 @@
346 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
347 }
348 db_finalize(&q);
349 }
350 if( g.okHistory ){
351 char *zShortUuid = mprintf("%.10s", zUuid);
352 const char *zProjName = db_get("project-name", "unnamed");
353 @ <tr><th>Timelines:</th><td>
354 @ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a>
355 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a>
356 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a>
357 db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
358 " WHERE rid=%d AND tagtype>0 "
359 " AND tag.tagid=tagxref.tagid "
360 " AND +tag.tagname GLOB 'sym-*'", rid);
361 while( db_step(&q)==SQLITE_ROW ){
362 const char *zTagName = db_column_text(&q, 0);
363 @ | <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>
364 }
365 db_finalize(&q);
366 @ </td></tr>
367 @ <tr><th>Other&nbsp;Links:</th>
368 @ <td>
369 @ <a href="%s(g.zBaseURL)/dir?ci=%s(zShortUuid)">files</a>
370 @ | <a href="%s(g.zBaseURL)/zip/%s(zProjName)-%s(zShortUuid).zip?uuid=%s(zUuid)">
371 @ ZIP archive</a>
372 @ | <a href="%s(g.zBaseURL)/artifact/%d(rid)">manifest</a>
373 if( g.okWrite ){
374 @ | <a href="%s(g.zBaseURL)/ci_edit?r=%d(rid)">edit</a>
375 }
376 @ </td>
377 @ </tr>
378 free(zShortUuid);
379 }
380 @ </table></p>
381 }else{
382 style_header("Check-in Information");
383 login_anonymous_available();
@@ -498,13 +496,12 @@
498 @ <tr><th>Original&nbsp;User:</th><td>
499 hyperlink_to_user(zUser, zDate, "</td></tr>");
500 if( g.okHistory ){
501 @ <tr><th>Commands:</th>
502 @ <td>
503 /* @ <a href="%s(g.zBaseURL)/wdiff/%d(rid)">diff</a> | */
504 @ <a href="%s(g.zBaseURL)/whistory?name=%t(zName)">history</a>
505 @ | <a href="%s(g.zBaseURL)/artifact/%d(rid)">raw-text</a>
506 @ </td>
507 @ </tr>
508 }
509 @ </table></p>
510 }else{
@@ -621,10 +618,12 @@
621 Blob *pDownloadName /* Fill with an appropriate download name */
622 ){
623 Stmt q;
624 int cnt = 0;
625 int nWiki = 0;
 
 
626 db_prepare(&q,
627 "SELECT filename.name, datetime(event.mtime),"
628 " coalesce(event.ecomment,event.comment),"
629 " coalesce(event.euser,event.user),"
630 " b.uuid"
@@ -691,11 +690,11 @@
691 hyperlink_to_user(zUser,zDate," on");
692 hyperlink_to_date(zDate,".");
693 nWiki++;
694 cnt++;
695 if( pDownloadName && blob_size(pDownloadName)==0 ){
696 blob_append(pDownloadName, zPagename, -1);
697 }
698 }
699 db_finalize(&q);
700 if( nWiki==0 ){
701 db_prepare(&q,
@@ -726,11 +725,11 @@
726 hyperlink_to_uuid(zUuid);
727 @ - %w(zCom) by
728 hyperlink_to_user(zUser,zDate," on");
729 hyperlink_to_date(zDate, ".");
730 if( pDownloadName && blob_size(pDownloadName)==0 ){
731 blob_append(pDownloadName, zUuid, -1);
732 }
733 cnt++;
734 }
735 db_finalize(&q);
736 }
@@ -744,11 +743,11 @@
744 while( db_step(&q)==SQLITE_ROW ){
745 const char *zTarget = db_column_text(&q, 0);
746 const char *zFilename = db_column_text(&q, 1);
747 const char *zDate = db_column_text(&q, 2);
748 const char *zUser = db_column_text(&q, 3);
749 const char *zSrc = db_column_text(&q, 4);
750 if( cnt>0 ){
751 @ Also attachment "%h(zFilename)" to
752 }else{
753 @ Attachment "%h(zFilename)" to
754 }
@@ -770,22 +769,21 @@
770 @ added by
771 hyperlink_to_user(zUser,zDate," on");
772 hyperlink_to_date(zDate,".");
773 cnt++;
774 if( pDownloadName && blob_size(pDownloadName)==0 ){
775 blob_append(pDownloadName, zSrc, -1);
776 }
777 }
778 db_finalize(&q);
779 if( cnt==0 ){
780 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
781 @ Control artifact.
782 if( pDownloadName && blob_size(pDownloadName)==0 ){
783 blob_append(pDownloadName, zUuid, -1);
784 }
785 }else if( linkToView && g.okHistory ){
786 @ <a href="%s(g.zBaseURL)/artifact/%d(rid)">[view]</a>
787 }
788 }
789
790
791 /*
@@ -793,12 +791,12 @@
793 **
794 ** Two arguments, v1 and v2, are integers. Show the difference between
795 ** the two records.
796 */
797 void diff_page(void){
798 int v1 = name_to_rid(PD("v1","0"));
799 int v2 = name_to_rid(PD("v2","0"));
800 Blob c1, c2, diff;
801
802 login_check_credentials();
803 if( !g.okRead ){ login_needed(); return; }
804 style_header("Diff");
@@ -929,11 +927,11 @@
929 @ <h2>Artifact %s(zUuid):</h2>
930 @ <blockquote>
931 blob_zero(&downloadName);
932 object_description(rid, 0, &downloadName);
933 style_submenu_element("Download", "Download",
934 "%s/raw/%T?name=%d", g.zBaseURL, blob_str(&downloadName), rid);
935 @ </blockquote>
936 @ <hr>
937 content_get(rid, &content);
938 @ <blockquote><pre>
939 hexdump(&content);
@@ -976,30 +974,30 @@
976 @ <h2>Artifact %s(zUuid)</h2>
977 @ <blockquote>
978 blob_zero(&downloadName);
979 object_description(rid, 0, &downloadName);
980 style_submenu_element("Download", "Download",
981 "%s/raw/%T?name=%d", g.zTop, blob_str(&downloadName), rid);
982 zMime = mimetype_from_name(blob_str(&downloadName));
983 if( zMime ){
984 if( strcmp(zMime, "text/html")==0 ){
985 if( P("txt") ){
986 style_submenu_element("Html", "Html",
987 "%s/artifact?name=%d", g.zTop, rid);
988 }else{
989 renderAsHtml = 1;
990 style_submenu_element("Text", "Text",
991 "%s/artifact?name=%d&txt=1", g.zTop, rid);
992 }
993 }else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){
994 if( P("txt") ){
995 style_submenu_element("Wiki", "Wiki",
996 "%s/artifact?name=%d", g.zTop, rid);
997 }else{
998 renderAsWiki = 1;
999 style_submenu_element("Text", "Text",
1000 "%s/artifact?name=%d&txt=1", g.zTop, rid);
1001 }
1002 }
1003 }
1004 @ </blockquote>
1005 @ <hr>
@@ -1015,14 +1013,14 @@
1015 @ <blockquote>
1016 if( zMime==0 ){
1017 @ <pre>
1018 @ %h(blob_str(&content))
1019 @ </pre>
1020 style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid);
1021 }else if( strncmp(zMime, "image/", 6)==0 ){
1022 @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img>
1023 style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid);
1024 }else{
1025 @ <pre>
1026 hexdump(&content);
1027 @ </pre>
1028 }
@@ -1196,17 +1194,17 @@
1196 int nColor = sizeof(aColor)/sizeof(aColor[0]);
1197 int i;
1198
1199 login_check_credentials();
1200 if( !g.okWrite ){ login_needed(); return; }
1201 rid = atoi(PD("r","0"));
1202 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1203 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1204 " FROM event WHERE objid=%d", rid);
1205 if( zComment==0 ) fossil_redirect_home();
1206 if( P("cancel") ){
1207 cgi_redirectf("ci?name=%d", rid);
1208 }
1209 zNewComment = PD("c",zComment);
1210 zUser = db_text(0, "SELECT coalesce(euser,user)"
1211 " FROM event WHERE objid=%d", rid);
1212 if( zUser==0 ) fossil_redirect_home();
@@ -1315,11 +1313,11 @@
1315 g.markPrivate = content_is_private(rid);
1316 nrid = content_put(&ctrl, 0, 0);
1317 manifest_crosslink(nrid, &ctrl);
1318 db_end_transaction(0);
1319 }
1320 cgi_redirectf("ci?name=%d", rid);
1321 }
1322 blob_zero(&comment);
1323 blob_append(&comment, zNewComment, -1);
1324 zUuid[10] = 0;
1325 style_header("Edit Check-in [%s]", zUuid);
@@ -1357,11 +1355,11 @@
1357 @ </blockquote>
1358 @ <hr>
1359 blob_reset(&suffix);
1360 }
1361 @ <p>Make changes to attributes of check-in
1362 @ [<a href="ci?name=%d(rid)">%s(zUuid)</a>]:</p>
1363 @ <form action="%s(g.zBaseURL)/ci_edit" method="POST">
1364 login_insert_csrf_secret();
1365 @ <input type="hidden" name="r" value="%d(rid)">
1366 @ <table border="0" cellspacing="10">
1367
1368
--- src/info.c
+++ src/info.c
@@ -346,38 +346,36 @@
346 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
347 }
348 db_finalize(&q);
349 }
350 if( g.okHistory ){
 
351 const char *zProjName = db_get("project-name", "unnamed");
352 @ <tr><th>Timelines:</th><td>
353 @ <a href="%s(g.zBaseURL)/timeline?p=%S(zUuid)">ancestors</a>
354 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)">descendants</a>
355 @ | <a href="%s(g.zBaseURL)/timeline?d=%S(zUuid)&p=%S(zUuid)">both</a>
356 db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
357 " WHERE rid=%d AND tagtype>0 "
358 " AND tag.tagid=tagxref.tagid "
359 " AND +tag.tagname GLOB 'sym-*'", rid);
360 while( db_step(&q)==SQLITE_ROW ){
361 const char *zTagName = db_column_text(&q, 0);
362 @ | <a href="%s(g.zTop)/timeline?t=%T(zTagName)">%h(zTagName)</a>
363 }
364 db_finalize(&q);
365 @ </td></tr>
366 @ <tr><th>Other&nbsp;Links:</th>
367 @ <td>
368 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
369 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
370 @ ZIP archive</a>
371 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
372 if( g.okWrite ){
373 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
374 }
375 @ </td>
376 @ </tr>
 
377 }
378 @ </table></p>
379 }else{
380 style_header("Check-in Information");
381 login_anonymous_available();
@@ -498,13 +496,12 @@
496 @ <tr><th>Original&nbsp;User:</th><td>
497 hyperlink_to_user(zUser, zDate, "</td></tr>");
498 if( g.okHistory ){
499 @ <tr><th>Commands:</th>
500 @ <td>
 
501 @ <a href="%s(g.zBaseURL)/whistory?name=%t(zName)">history</a>
502 @ | <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">raw-text</a>
503 @ </td>
504 @ </tr>
505 }
506 @ </table></p>
507 }else{
@@ -621,10 +618,12 @@
618 Blob *pDownloadName /* Fill with an appropriate download name */
619 ){
620 Stmt q;
621 int cnt = 0;
622 int nWiki = 0;
623 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
624
625 db_prepare(&q,
626 "SELECT filename.name, datetime(event.mtime),"
627 " coalesce(event.ecomment,event.comment),"
628 " coalesce(event.euser,event.user),"
629 " b.uuid"
@@ -691,11 +690,11 @@
690 hyperlink_to_user(zUser,zDate," on");
691 hyperlink_to_date(zDate,".");
692 nWiki++;
693 cnt++;
694 if( pDownloadName && blob_size(pDownloadName)==0 ){
695 blob_appendf(pDownloadName, "%s.wiki", zPagename);
696 }
697 }
698 db_finalize(&q);
699 if( nWiki==0 ){
700 db_prepare(&q,
@@ -726,11 +725,11 @@
725 hyperlink_to_uuid(zUuid);
726 @ - %w(zCom) by
727 hyperlink_to_user(zUser,zDate," on");
728 hyperlink_to_date(zDate, ".");
729 if( pDownloadName && blob_size(pDownloadName)==0 ){
730 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
731 }
732 cnt++;
733 }
734 db_finalize(&q);
735 }
@@ -744,11 +743,11 @@
743 while( db_step(&q)==SQLITE_ROW ){
744 const char *zTarget = db_column_text(&q, 0);
745 const char *zFilename = db_column_text(&q, 1);
746 const char *zDate = db_column_text(&q, 2);
747 const char *zUser = db_column_text(&q, 3);
748 /* const char *zSrc = db_column_text(&q, 4); */
749 if( cnt>0 ){
750 @ Also attachment "%h(zFilename)" to
751 }else{
752 @ Attachment "%h(zFilename)" to
753 }
@@ -770,22 +769,21 @@
769 @ added by
770 hyperlink_to_user(zUser,zDate," on");
771 hyperlink_to_date(zDate,".");
772 cnt++;
773 if( pDownloadName && blob_size(pDownloadName)==0 ){
774 blob_append(pDownloadName, zFilename, -1);
775 }
776 }
777 db_finalize(&q);
778 if( cnt==0 ){
 
779 @ Control artifact.
780 if( pDownloadName && blob_size(pDownloadName)==0 ){
781 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
782 }
783 }else if( linkToView && g.okHistory ){
784 @ <a href="%s(g.zBaseURL)/artifact/%S(zUuid)">[view]</a>
785 }
786 }
787
788
789 /*
@@ -793,12 +791,12 @@
791 **
792 ** Two arguments, v1 and v2, are integers. Show the difference between
793 ** the two records.
794 */
795 void diff_page(void){
796 int v1 = name_to_rid(P("v1"));
797 int v2 = name_to_rid(P("v2"));
798 Blob c1, c2, diff;
799
800 login_check_credentials();
801 if( !g.okRead ){ login_needed(); return; }
802 style_header("Diff");
@@ -929,11 +927,11 @@
927 @ <h2>Artifact %s(zUuid):</h2>
928 @ <blockquote>
929 blob_zero(&downloadName);
930 object_description(rid, 0, &downloadName);
931 style_submenu_element("Download", "Download",
932 "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
933 @ </blockquote>
934 @ <hr>
935 content_get(rid, &content);
936 @ <blockquote><pre>
937 hexdump(&content);
@@ -976,30 +974,30 @@
974 @ <h2>Artifact %s(zUuid)</h2>
975 @ <blockquote>
976 blob_zero(&downloadName);
977 object_description(rid, 0, &downloadName);
978 style_submenu_element("Download", "Download",
979 "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
980 zMime = mimetype_from_name(blob_str(&downloadName));
981 if( zMime ){
982 if( strcmp(zMime, "text/html")==0 ){
983 if( P("txt") ){
984 style_submenu_element("Html", "Html",
985 "%s/artifact?name=%s", g.zTop, zUuid);
986 }else{
987 renderAsHtml = 1;
988 style_submenu_element("Text", "Text",
989 "%s/artifact?name=%s&txt=1", g.zTop, zUuid);
990 }
991 }else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){
992 if( P("txt") ){
993 style_submenu_element("Wiki", "Wiki",
994 "%s/artifact?name=%s", g.zTop, zUuid);
995 }else{
996 renderAsWiki = 1;
997 style_submenu_element("Text", "Text",
998 "%s/artifact?name=%s&txt=1", g.zTop, zUuid);
999 }
1000 }
1001 }
1002 @ </blockquote>
1003 @ <hr>
@@ -1015,14 +1013,14 @@
1013 @ <blockquote>
1014 if( zMime==0 ){
1015 @ <pre>
1016 @ %h(blob_str(&content))
1017 @ </pre>
1018 style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1019 }else if( strncmp(zMime, "image/", 6)==0 ){
1020 @ <img src="%s(g.zBaseURL)/raw?name=%s(zUuid)&m=%s(zMime)"></img>
1021 style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1022 }else{
1023 @ <pre>
1024 hexdump(&content);
1025 @ </pre>
1026 }
@@ -1196,17 +1194,17 @@
1194 int nColor = sizeof(aColor)/sizeof(aColor[0]);
1195 int i;
1196
1197 login_check_credentials();
1198 if( !g.okWrite ){ login_needed(); return; }
1199 rid = name_to_rid(P("r"));
1200 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1201 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1202 " FROM event WHERE objid=%d", rid);
1203 if( zComment==0 ) fossil_redirect_home();
1204 if( P("cancel") ){
1205 cgi_redirectf("ci?name=%s", zUuid);
1206 }
1207 zNewComment = PD("c",zComment);
1208 zUser = db_text(0, "SELECT coalesce(euser,user)"
1209 " FROM event WHERE objid=%d", rid);
1210 if( zUser==0 ) fossil_redirect_home();
@@ -1315,11 +1313,11 @@
1313 g.markPrivate = content_is_private(rid);
1314 nrid = content_put(&ctrl, 0, 0);
1315 manifest_crosslink(nrid, &ctrl);
1316 db_end_transaction(0);
1317 }
1318 cgi_redirectf("ci?name=%s", zUuid);
1319 }
1320 blob_zero(&comment);
1321 blob_append(&comment, zNewComment, -1);
1322 zUuid[10] = 0;
1323 style_header("Edit Check-in [%s]", zUuid);
@@ -1357,11 +1355,11 @@
1355 @ </blockquote>
1356 @ <hr>
1357 blob_reset(&suffix);
1358 }
1359 @ <p>Make changes to attributes of check-in
1360 @ [<a href="ci?name=%s(zUuid)">%s(zUuid)</a>]:</p>
1361 @ <form action="%s(g.zBaseURL)/ci_edit" method="POST">
1362 login_insert_csrf_secret();
1363 @ <input type="hidden" name="r" value="%d(rid)">
1364 @ <table border="0" cellspacing="10">
1365
1366
+16 -11
--- src/name.c
+++ src/name.c
@@ -280,20 +280,25 @@
280280
*/
281281
int name_to_rid(const char *zName){
282282
int i;
283283
int rid;
284284
Blob name;
285
- for(i=0; zName[i] && isdigit(zName[i]); i++){}
286
- if( zName[i]==0 ){
287
- rid = atoi(zName);
288
- if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
289
- return rid;
290
- }
291
- }
285
+
286
+ if( zName==0 || zName[0]==0 ) return 0;
292287
blob_init(&name, zName, -1);
293
- if( name_to_uuid(&name, 1) ){
294
- fossil_fatal("%s", g.zErrMsg);
288
+ if( name_to_uuid(&name, -1) ){
289
+ blob_reset(&name);
290
+ for(i=0; zName[i] && isdigit(zName[i]); i++){}
291
+ if( zName[i]==0 ){
292
+ rid = atoi(zName);
293
+ if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
294
+ return rid;
295
+ }
296
+ }
297
+ fossil_error(1, "no such artifact: %s", zName);
298
+ return 0;
299
+ }else{
300
+ rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
301
+ blob_reset(&name);
295302
}
296
- rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
297
- blob_reset(&name);
298303
return rid;
299304
}
300305
--- src/name.c
+++ src/name.c
@@ -280,20 +280,25 @@
280 */
281 int name_to_rid(const char *zName){
282 int i;
283 int rid;
284 Blob name;
285 for(i=0; zName[i] && isdigit(zName[i]); i++){}
286 if( zName[i]==0 ){
287 rid = atoi(zName);
288 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
289 return rid;
290 }
291 }
292 blob_init(&name, zName, -1);
293 if( name_to_uuid(&name, 1) ){
294 fossil_fatal("%s", g.zErrMsg);
 
 
 
 
 
 
 
 
 
 
 
 
295 }
296 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
297 blob_reset(&name);
298 return rid;
299 }
300
--- src/name.c
+++ src/name.c
@@ -280,20 +280,25 @@
280 */
281 int name_to_rid(const char *zName){
282 int i;
283 int rid;
284 Blob name;
285
286 if( zName==0 || zName[0]==0 ) return 0;
 
 
 
 
 
287 blob_init(&name, zName, -1);
288 if( name_to_uuid(&name, -1) ){
289 blob_reset(&name);
290 for(i=0; zName[i] && isdigit(zName[i]); i++){}
291 if( zName[i]==0 ){
292 rid = atoi(zName);
293 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
294 return rid;
295 }
296 }
297 fossil_error(1, "no such artifact: %s", zName);
298 return 0;
299 }else{
300 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
301 blob_reset(&name);
302 }
 
 
303 return rid;
304 }
305
--- src/printf.c
+++ src/printf.c
@@ -52,10 +52,11 @@
5252
#define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */
5353
#define etFOSSILIZE 19 /* The fossil header encoding format. */
5454
#define etPATH 20 /* Path type */
5555
#define etWIKISTR 21 /* Wiki text rendered from a char* */
5656
#define etWIKIBLOB 22 /* Wiki text rendered from a Blob* */
57
+#define etSTRINGID 23 /* String with length limit for a UUID prefix */
5758
5859
5960
/*
6061
** An "etByte" is an 8-bit unsigned value.
6162
*/
@@ -101,10 +102,11 @@
101102
{ 'W', 0, 2, etWIKIBLOB, 0, 0 },
102103
{ 'h', 0, 4, etHTMLIZE, 0, 0 },
103104
{ 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */
104105
{ 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */
105106
{ 'F', 0, 4, etFOSSILIZE, 0, 0 },
107
+ { 'S', 0, 4, etSTRINGID, 0, 0 },
106108
{ 'c', 0, 0, etCHARX, 0, 0 },
107109
{ 'o', 8, 0, etRADIX, 0, 2 },
108110
{ 'u', 10, 0, etRADIX, 0, 0 },
109111
{ 'x', 16, 0, etRADIX, 16, 1 },
110112
{ 'X', 16, 0, etRADIX, 0, 4 },
@@ -575,10 +577,14 @@
575577
}
576578
}
577579
bufpt[length]='\0';
578580
break;
579581
}
582
+ case etSTRINGID: {
583
+ precision = 16;
584
+ /* Fall through */
585
+ }
580586
case etSTRING:
581587
case etDYNSTRING: {
582588
int limit = flag_alternateform ? va_arg(ap,int) : -1;
583589
bufpt = va_arg(ap,char*);
584590
if( bufpt==0 ){
585591
--- src/printf.c
+++ src/printf.c
@@ -52,10 +52,11 @@
52 #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */
53 #define etFOSSILIZE 19 /* The fossil header encoding format. */
54 #define etPATH 20 /* Path type */
55 #define etWIKISTR 21 /* Wiki text rendered from a char* */
56 #define etWIKIBLOB 22 /* Wiki text rendered from a Blob* */
 
57
58
59 /*
60 ** An "etByte" is an 8-bit unsigned value.
61 */
@@ -101,10 +102,11 @@
101 { 'W', 0, 2, etWIKIBLOB, 0, 0 },
102 { 'h', 0, 4, etHTMLIZE, 0, 0 },
103 { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */
104 { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */
105 { 'F', 0, 4, etFOSSILIZE, 0, 0 },
 
106 { 'c', 0, 0, etCHARX, 0, 0 },
107 { 'o', 8, 0, etRADIX, 0, 2 },
108 { 'u', 10, 0, etRADIX, 0, 0 },
109 { 'x', 16, 0, etRADIX, 16, 1 },
110 { 'X', 16, 0, etRADIX, 0, 4 },
@@ -575,10 +577,14 @@
575 }
576 }
577 bufpt[length]='\0';
578 break;
579 }
 
 
 
 
580 case etSTRING:
581 case etDYNSTRING: {
582 int limit = flag_alternateform ? va_arg(ap,int) : -1;
583 bufpt = va_arg(ap,char*);
584 if( bufpt==0 ){
585
--- src/printf.c
+++ src/printf.c
@@ -52,10 +52,11 @@
52 #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */
53 #define etFOSSILIZE 19 /* The fossil header encoding format. */
54 #define etPATH 20 /* Path type */
55 #define etWIKISTR 21 /* Wiki text rendered from a char* */
56 #define etWIKIBLOB 22 /* Wiki text rendered from a Blob* */
57 #define etSTRINGID 23 /* String with length limit for a UUID prefix */
58
59
60 /*
61 ** An "etByte" is an 8-bit unsigned value.
62 */
@@ -101,10 +102,11 @@
102 { 'W', 0, 2, etWIKIBLOB, 0, 0 },
103 { 'h', 0, 4, etHTMLIZE, 0, 0 },
104 { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */
105 { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */
106 { 'F', 0, 4, etFOSSILIZE, 0, 0 },
107 { 'S', 0, 4, etSTRINGID, 0, 0 },
108 { 'c', 0, 0, etCHARX, 0, 0 },
109 { 'o', 8, 0, etRADIX, 0, 2 },
110 { 'u', 10, 0, etRADIX, 0, 0 },
111 { 'x', 16, 0, etRADIX, 16, 1 },
112 { 'X', 16, 0, etRADIX, 0, 4 },
@@ -575,10 +577,14 @@
577 }
578 }
579 bufpt[length]='\0';
580 break;
581 }
582 case etSTRINGID: {
583 precision = 16;
584 /* Fall through */
585 }
586 case etSTRING:
587 case etDYNSTRING: {
588 int limit = flag_alternateform ? va_arg(ap,int) : -1;
589 bufpt = va_arg(ap,char*);
590 if( bufpt==0 ){
591
+2 -2
--- src/timeline.c
+++ src/timeline.c
@@ -675,12 +675,12 @@
675675
void page_timeline(void){
676676
Stmt q; /* Query used to generate the timeline */
677677
Blob sql; /* text of SQL used to generate timeline */
678678
Blob desc; /* Description of the timeline */
679679
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
680
- int p_rid = atoi(PD("p","0")); /* artifact p and its parents */
681
- int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */
680
+ int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
681
+ int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
682682
const char *zUser = P("u"); /* All entries by this user if not NULL */
683683
const char *zType = PD("y","all"); /* Type of events. All if NULL */
684684
const char *zAfter = P("a"); /* Events after this time */
685685
const char *zBefore = P("b"); /* Events before this time */
686686
const char *zCirca = P("c"); /* Events near this time */
687687
--- src/timeline.c
+++ src/timeline.c
@@ -675,12 +675,12 @@
675 void page_timeline(void){
676 Stmt q; /* Query used to generate the timeline */
677 Blob sql; /* text of SQL used to generate timeline */
678 Blob desc; /* Description of the timeline */
679 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
680 int p_rid = atoi(PD("p","0")); /* artifact p and its parents */
681 int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */
682 const char *zUser = P("u"); /* All entries by this user if not NULL */
683 const char *zType = PD("y","all"); /* Type of events. All if NULL */
684 const char *zAfter = P("a"); /* Events after this time */
685 const char *zBefore = P("b"); /* Events before this time */
686 const char *zCirca = P("c"); /* Events near this time */
687
--- src/timeline.c
+++ src/timeline.c
@@ -675,12 +675,12 @@
675 void page_timeline(void){
676 Stmt q; /* Query used to generate the timeline */
677 Blob sql; /* text of SQL used to generate timeline */
678 Blob desc; /* Description of the timeline */
679 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
680 int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
681 int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
682 const char *zUser = P("u"); /* All entries by this user if not NULL */
683 const char *zType = PD("y","all"); /* Type of events. All if NULL */
684 const char *zAfter = P("a"); /* Events after this time */
685 const char *zBefore = P("b"); /* Events before this time */
686 const char *zCirca = P("c"); /* Events near this time */
687

Keyboard Shortcuts

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