Fossil SCM

From the vinfo webpage, provide a hyperlink to download a ZIP archive the version.

drh 2007-08-01 13:32 trunk
Commit 6dab6149b13f9fdb214a279d2b3c47619f3eb7b6
+9
--- src/cgi.c
+++ src/cgi.c
@@ -100,10 +100,19 @@
100100
** Set the reply content type
101101
*/
102102
void cgi_set_content_type(const char *zType){
103103
zContentType = mprintf("%s", zType);
104104
}
105
+
106
+/*
107
+** Set the reply content to the specified BLOB.
108
+*/
109
+void cgi_set_content(Blob *pNewContent){
110
+ blob_reset(&cgiContent);
111
+ cgiContent = *pNewContent;
112
+ blob_zero(pNewContent);
113
+}
105114
106115
/*
107116
** Set the reply status code
108117
*/
109118
void cgi_set_status(int iStat, const char *zStat){
110119
--- src/cgi.c
+++ src/cgi.c
@@ -100,10 +100,19 @@
100 ** Set the reply content type
101 */
102 void cgi_set_content_type(const char *zType){
103 zContentType = mprintf("%s", zType);
104 }
 
 
 
 
 
 
 
 
 
105
106 /*
107 ** Set the reply status code
108 */
109 void cgi_set_status(int iStat, const char *zStat){
110
--- src/cgi.c
+++ src/cgi.c
@@ -100,10 +100,19 @@
100 ** Set the reply content type
101 */
102 void cgi_set_content_type(const char *zType){
103 zContentType = mprintf("%s", zType);
104 }
105
106 /*
107 ** Set the reply content to the specified BLOB.
108 */
109 void cgi_set_content(Blob *pNewContent){
110 blob_reset(&cgiContent);
111 cgiContent = *pNewContent;
112 blob_zero(pNewContent);
113 }
114
115 /*
116 ** Set the reply status code
117 */
118 void cgi_set_status(int iStat, const char *zStat){
119
+3 -1
--- src/info.c
+++ src/info.c
@@ -215,16 +215,18 @@
215215
" WHERE blob.rid=%d"
216216
" AND event.objid=%d",
217217
rid, rid
218218
);
219219
if( db_step(&q)==SQLITE_ROW ){
220
- @ <h2>Version %s(db_column_text(&q,0))</h2>
220
+ const char *zUuid = db_column_text(&q, 0);
221
+ @ <h2>Version %s(zUuid)</h2>
221222
@ <ul>
222223
@ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
223224
@ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
224225
@ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
225226
@ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
227
+ @ <li><a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a></li>
226228
@ </ul>
227229
}
228230
db_finalize(&q);
229231
@ <p><h2>Descendents:</h2>
230232
n = showDescendents(rid, 2);
231233
--- src/info.c
+++ src/info.c
@@ -215,16 +215,18 @@
215 " WHERE blob.rid=%d"
216 " AND event.objid=%d",
217 rid, rid
218 );
219 if( db_step(&q)==SQLITE_ROW ){
220 @ <h2>Version %s(db_column_text(&q,0))</h2>
 
221 @ <ul>
222 @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
223 @ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
224 @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
225 @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
 
226 @ </ul>
227 }
228 db_finalize(&q);
229 @ <p><h2>Descendents:</h2>
230 n = showDescendents(rid, 2);
231
--- src/info.c
+++ src/info.c
@@ -215,16 +215,18 @@
215 " WHERE blob.rid=%d"
216 " AND event.objid=%d",
217 rid, rid
218 );
219 if( db_step(&q)==SQLITE_ROW ){
220 const char *zUuid = db_column_text(&q, 0);
221 @ <h2>Version %s(zUuid)</h2>
222 @ <ul>
223 @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
224 @ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
225 @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
226 @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
227 @ <li><a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a></li>
228 @ </ul>
229 }
230 db_finalize(&q);
231 @ <p><h2>Descendents:</h2>
232 n = showDescendents(rid, 2);
233
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -656,11 +656,11 @@
656656
if( db_changes()>0 ){
657657
go = 1;
658658
}
659659
}
660660
if( pullFlag && !go &&
661
- db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<=0", rid) ){
661
+ db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<0", rid) ){
662662
go = 1;
663663
}
664664
}else if( pullFlag ){
665665
go = 1;
666666
content_put(0, blob_str(&aToken[1]));
667667
--- src/xfer.c
+++ src/xfer.c
@@ -656,11 +656,11 @@
656 if( db_changes()>0 ){
657 go = 1;
658 }
659 }
660 if( pullFlag && !go &&
661 db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<=0", rid) ){
662 go = 1;
663 }
664 }else if( pullFlag ){
665 go = 1;
666 content_put(0, blob_str(&aToken[1]));
667
--- src/xfer.c
+++ src/xfer.c
@@ -656,11 +656,11 @@
656 if( db_changes()>0 ){
657 go = 1;
658 }
659 }
660 if( pullFlag && !go &&
661 db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<0", rid) ){
662 go = 1;
663 }
664 }else if( pullFlag ){
665 go = 1;
666 content_put(0, blob_str(&aToken[1]));
667
+33
--- src/zip.c
+++ src/zip.c
@@ -314,5 +314,38 @@
314314
db_must_be_within_tree();
315315
rid = name_to_rid(g.argv[2]);
316316
zip_of_baseline(rid, &zip);
317317
blob_write_to_file(&zip, g.argv[3]);
318318
}
319
+
320
+/*
321
+** WEBPAGE: zip
322
+**
323
+** Generate a ZIP archive for the baseline specified by g.zExtra
324
+** and return that ZIP archive as the HTTP reply content.
325
+*/
326
+void baseline_zip_page(void){
327
+ int rid;
328
+ char *zName;
329
+ int i;
330
+ Blob zip;
331
+
332
+ login_check_credentials();
333
+ if( !g.okRead || !g.okHistory ){ login_needed(); return; }
334
+ zName = mprintf("%s", g.zExtra);
335
+ i = strlen(zName);
336
+ for(i=strlen(zName)-1; i>5; i--){
337
+ if( zName[i]=='.' ){
338
+ zName[i] = 0;
339
+ break;
340
+ }
341
+ }
342
+ rid = name_to_rid(zName);
343
+ if( rid==0 ){
344
+ @ Not found
345
+ return;
346
+ }
347
+ zip_of_baseline(rid, &zip);
348
+ cgi_set_content(&zip);
349
+ cgi_set_content_type("application/zip");
350
+ cgi_reply();
351
+}
319352
--- src/zip.c
+++ src/zip.c
@@ -314,5 +314,38 @@
314 db_must_be_within_tree();
315 rid = name_to_rid(g.argv[2]);
316 zip_of_baseline(rid, &zip);
317 blob_write_to_file(&zip, g.argv[3]);
318 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
--- src/zip.c
+++ src/zip.c
@@ -314,5 +314,38 @@
314 db_must_be_within_tree();
315 rid = name_to_rid(g.argv[2]);
316 zip_of_baseline(rid, &zip);
317 blob_write_to_file(&zip, g.argv[3]);
318 }
319
320 /*
321 ** WEBPAGE: zip
322 **
323 ** Generate a ZIP archive for the baseline specified by g.zExtra
324 ** and return that ZIP archive as the HTTP reply content.
325 */
326 void baseline_zip_page(void){
327 int rid;
328 char *zName;
329 int i;
330 Blob zip;
331
332 login_check_credentials();
333 if( !g.okRead || !g.okHistory ){ login_needed(); return; }
334 zName = mprintf("%s", g.zExtra);
335 i = strlen(zName);
336 for(i=strlen(zName)-1; i>5; i--){
337 if( zName[i]=='.' ){
338 zName[i] = 0;
339 break;
340 }
341 }
342 rid = name_to_rid(zName);
343 if( rid==0 ){
344 @ Not found
345 return;
346 }
347 zip_of_baseline(rid, &zip);
348 cgi_set_content(&zip);
349 cgi_set_content_type("application/zip");
350 cgi_reply();
351 }
352

Keyboard Shortcuts

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