Fossil SCM

Improved tracing capability for debugging purposes.

drh 2015-01-25 21:21 trunk
Commit af3d3b6936494d40dd4fbaf5804d23e377570a3c
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1756,11 +1756,11 @@
17561756
fd = dup(connection);
17571757
if( fd!=0 ) nErr++;
17581758
close(1);
17591759
fd = dup(connection);
17601760
if( fd!=1 ) nErr++;
1761
- if( !g.fHttpTrace && !g.fSqlTrace ){
1761
+ if( !g.fAnyTrace ){
17621762
close(2);
17631763
fd = dup(connection);
17641764
if( fd!=2 ) nErr++;
17651765
}
17661766
close(connection);
17671767
--- src/cgi.c
+++ src/cgi.c
@@ -1756,11 +1756,11 @@
1756 fd = dup(connection);
1757 if( fd!=0 ) nErr++;
1758 close(1);
1759 fd = dup(connection);
1760 if( fd!=1 ) nErr++;
1761 if( !g.fHttpTrace && !g.fSqlTrace ){
1762 close(2);
1763 fd = dup(connection);
1764 if( fd!=2 ) nErr++;
1765 }
1766 close(connection);
1767
--- src/cgi.c
+++ src/cgi.c
@@ -1756,11 +1756,11 @@
1756 fd = dup(connection);
1757 if( fd!=0 ) nErr++;
1758 close(1);
1759 fd = dup(connection);
1760 if( fd!=1 ) nErr++;
1761 if( !g.fAnyTrace ){
1762 close(2);
1763 fd = dup(connection);
1764 if( fd!=2 ) nErr++;
1765 }
1766 close(connection);
1767
+19 -7
--- src/finfo.c
+++ src/finfo.c
@@ -294,19 +294,21 @@
294294
char zPrevDate[20];
295295
const char *zA;
296296
const char *zB;
297297
int n;
298298
int baseCheckin;
299
+ int fnid;
299300
300301
Blob title;
301302
Blob sql;
302303
HQuery url;
303304
GraphContext *pGraph;
304305
int brBg = P("brbg")!=0;
305306
int uBg = P("ubg")!=0;
306307
int firstChngOnly = atoi(PD("fco","1"))!=0;
307308
int fDebug = atoi(PD("debug","0"));
309
+ int fShowId = P("showid")!=0;
308310
309311
login_check_credentials();
310312
if( !g.perm.Read ){ login_needed(); return; }
311313
style_header("File History");
312314
login_anonymous_available();
@@ -317,10 +319,16 @@
317319
if( baseCheckin ) firstChngOnly = 1;
318320
if( !firstChngOnly ) url_add_parameter(&url, "fco", "0");
319321
320322
zPrevDate[0] = 0;
321323
zFilename = PD("name","");
324
+ fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
325
+ if( fnid==0 ){
326
+ @ No such file: %h(zFilename)
327
+ style_footer();
328
+ return;
329
+ }
322330
url_add_parameter(&url, "name", zFilename);
323331
blob_zero(&sql);
324332
blob_append_sql(&sql,
325333
"SELECT"
326334
" datetime(event.mtime%s)," /* Date of change */
@@ -337,26 +345,22 @@
337345
" mlink.mid," /* check-in ID */
338346
" mlink.pfnid", /* Previous filename */
339347
timeline_utc(), TAG_BRANCH
340348
);
341349
if( firstChngOnly ){
342
-#if 0
343
- blob_append_sql(&sql, ", min(event.mtime)");
344
-#else
345350
blob_append_sql(&sql,
346351
", min(CASE (SELECT value FROM tagxref"
347352
" WHERE tagtype>0 AND tagid=%d"
348353
" AND tagxref.rid=mlink.mid)"
349354
" WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)",
350355
TAG_BRANCH);
351
-#endif
352356
}
353357
blob_append_sql(&sql,
354358
" FROM mlink, event"
355
- " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q)"
359
+ " WHERE mlink.fnid=%d"
356360
" AND event.objid=mlink.mid",
357
- zFilename
361
+ fnid
358362
);
359363
if( baseCheckin ){
360364
compute_direct_ancestors(baseCheckin, 10000000);
361365
blob_append_sql(&sql," AND mlink.mid IN (SELECT rid FROM ancestor)");
362366
}
@@ -401,10 +405,11 @@
401405
fossil_free(zUuid);
402406
}else{
403407
blob_appendf(&title, "History of files named ");
404408
hyperlinked_path(zFilename, &title, 0, "tree", "");
405409
}
410
+ if( fShowId ) blob_appendf(&title, " (%d)", fnid);
406411
@ <h2>%b(&title)</h2>
407412
blob_reset(&title);
408413
pGraph = graph_init();
409414
@ <div id="canvas" style="position:relative;width:1px;height:1px;"
410415
@ onclick="clickOnGraph(event)"></div>
@@ -455,11 +460,15 @@
455460
char *zPrevName = db_text(0, "SELECT name FROM filename WHERE fnid=%d",
456461
pfnid);
457462
@ <b>Renamed</b> from
458463
@ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
459464
}
460
- @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)]</a> part of check-in
465
+ @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)]</a>
466
+ if( fShowId ){
467
+ @ (%d(frid))
468
+ }
469
+ @ part of check-in
461470
}else{
462471
char *zNewName;
463472
zNewName = db_text(0,
464473
"SELECT name FROM filename WHERE fnid = "
465474
" (SELECT fnid FROM mlink"
@@ -473,10 +482,13 @@
473482
}else{
474483
@ <b>Deleted</b> by check-in
475484
}
476485
}
477486
hyperlink_to_uuid(zCkin);
487
+ if( fShowId ){
488
+ @ (%d(fmid))
489
+ }
478490
@ %W(zCom) (user:
479491
hyperlink_to_user(zUser, zDate, "");
480492
@ branch: %h(zBr))
481493
if( g.perm.Hyperlink && zUuid ){
482494
const char *z = zFilename;
483495
--- src/finfo.c
+++ src/finfo.c
@@ -294,19 +294,21 @@
294 char zPrevDate[20];
295 const char *zA;
296 const char *zB;
297 int n;
298 int baseCheckin;
 
299
300 Blob title;
301 Blob sql;
302 HQuery url;
303 GraphContext *pGraph;
304 int brBg = P("brbg")!=0;
305 int uBg = P("ubg")!=0;
306 int firstChngOnly = atoi(PD("fco","1"))!=0;
307 int fDebug = atoi(PD("debug","0"));
 
308
309 login_check_credentials();
310 if( !g.perm.Read ){ login_needed(); return; }
311 style_header("File History");
312 login_anonymous_available();
@@ -317,10 +319,16 @@
317 if( baseCheckin ) firstChngOnly = 1;
318 if( !firstChngOnly ) url_add_parameter(&url, "fco", "0");
319
320 zPrevDate[0] = 0;
321 zFilename = PD("name","");
 
 
 
 
 
 
322 url_add_parameter(&url, "name", zFilename);
323 blob_zero(&sql);
324 blob_append_sql(&sql,
325 "SELECT"
326 " datetime(event.mtime%s)," /* Date of change */
@@ -337,26 +345,22 @@
337 " mlink.mid," /* check-in ID */
338 " mlink.pfnid", /* Previous filename */
339 timeline_utc(), TAG_BRANCH
340 );
341 if( firstChngOnly ){
342 #if 0
343 blob_append_sql(&sql, ", min(event.mtime)");
344 #else
345 blob_append_sql(&sql,
346 ", min(CASE (SELECT value FROM tagxref"
347 " WHERE tagtype>0 AND tagid=%d"
348 " AND tagxref.rid=mlink.mid)"
349 " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)",
350 TAG_BRANCH);
351 #endif
352 }
353 blob_append_sql(&sql,
354 " FROM mlink, event"
355 " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q)"
356 " AND event.objid=mlink.mid",
357 zFilename
358 );
359 if( baseCheckin ){
360 compute_direct_ancestors(baseCheckin, 10000000);
361 blob_append_sql(&sql," AND mlink.mid IN (SELECT rid FROM ancestor)");
362 }
@@ -401,10 +405,11 @@
401 fossil_free(zUuid);
402 }else{
403 blob_appendf(&title, "History of files named ");
404 hyperlinked_path(zFilename, &title, 0, "tree", "");
405 }
 
406 @ <h2>%b(&title)</h2>
407 blob_reset(&title);
408 pGraph = graph_init();
409 @ <div id="canvas" style="position:relative;width:1px;height:1px;"
410 @ onclick="clickOnGraph(event)"></div>
@@ -455,11 +460,15 @@
455 char *zPrevName = db_text(0, "SELECT name FROM filename WHERE fnid=%d",
456 pfnid);
457 @ <b>Renamed</b> from
458 @ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
459 }
460 @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)]</a> part of check-in
 
 
 
 
461 }else{
462 char *zNewName;
463 zNewName = db_text(0,
464 "SELECT name FROM filename WHERE fnid = "
465 " (SELECT fnid FROM mlink"
@@ -473,10 +482,13 @@
473 }else{
474 @ <b>Deleted</b> by check-in
475 }
476 }
477 hyperlink_to_uuid(zCkin);
 
 
 
478 @ %W(zCom) (user:
479 hyperlink_to_user(zUser, zDate, "");
480 @ branch: %h(zBr))
481 if( g.perm.Hyperlink && zUuid ){
482 const char *z = zFilename;
483
--- src/finfo.c
+++ src/finfo.c
@@ -294,19 +294,21 @@
294 char zPrevDate[20];
295 const char *zA;
296 const char *zB;
297 int n;
298 int baseCheckin;
299 int fnid;
300
301 Blob title;
302 Blob sql;
303 HQuery url;
304 GraphContext *pGraph;
305 int brBg = P("brbg")!=0;
306 int uBg = P("ubg")!=0;
307 int firstChngOnly = atoi(PD("fco","1"))!=0;
308 int fDebug = atoi(PD("debug","0"));
309 int fShowId = P("showid")!=0;
310
311 login_check_credentials();
312 if( !g.perm.Read ){ login_needed(); return; }
313 style_header("File History");
314 login_anonymous_available();
@@ -317,10 +319,16 @@
319 if( baseCheckin ) firstChngOnly = 1;
320 if( !firstChngOnly ) url_add_parameter(&url, "fco", "0");
321
322 zPrevDate[0] = 0;
323 zFilename = PD("name","");
324 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
325 if( fnid==0 ){
326 @ No such file: %h(zFilename)
327 style_footer();
328 return;
329 }
330 url_add_parameter(&url, "name", zFilename);
331 blob_zero(&sql);
332 blob_append_sql(&sql,
333 "SELECT"
334 " datetime(event.mtime%s)," /* Date of change */
@@ -337,26 +345,22 @@
345 " mlink.mid," /* check-in ID */
346 " mlink.pfnid", /* Previous filename */
347 timeline_utc(), TAG_BRANCH
348 );
349 if( firstChngOnly ){
 
 
 
350 blob_append_sql(&sql,
351 ", min(CASE (SELECT value FROM tagxref"
352 " WHERE tagtype>0 AND tagid=%d"
353 " AND tagxref.rid=mlink.mid)"
354 " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)",
355 TAG_BRANCH);
 
356 }
357 blob_append_sql(&sql,
358 " FROM mlink, event"
359 " WHERE mlink.fnid=%d"
360 " AND event.objid=mlink.mid",
361 fnid
362 );
363 if( baseCheckin ){
364 compute_direct_ancestors(baseCheckin, 10000000);
365 blob_append_sql(&sql," AND mlink.mid IN (SELECT rid FROM ancestor)");
366 }
@@ -401,10 +405,11 @@
405 fossil_free(zUuid);
406 }else{
407 blob_appendf(&title, "History of files named ");
408 hyperlinked_path(zFilename, &title, 0, "tree", "");
409 }
410 if( fShowId ) blob_appendf(&title, " (%d)", fnid);
411 @ <h2>%b(&title)</h2>
412 blob_reset(&title);
413 pGraph = graph_init();
414 @ <div id="canvas" style="position:relative;width:1px;height:1px;"
415 @ onclick="clickOnGraph(event)"></div>
@@ -455,11 +460,15 @@
460 char *zPrevName = db_text(0, "SELECT name FROM filename WHERE fnid=%d",
461 pfnid);
462 @ <b>Renamed</b> from
463 @ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
464 }
465 @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)]</a>
466 if( fShowId ){
467 @ (%d(frid))
468 }
469 @ part of check-in
470 }else{
471 char *zNewName;
472 zNewName = db_text(0,
473 "SELECT name FROM filename WHERE fnid = "
474 " (SELECT fnid FROM mlink"
@@ -473,10 +482,13 @@
482 }else{
483 @ <b>Deleted</b> by check-in
484 }
485 }
486 hyperlink_to_uuid(zCkin);
487 if( fShowId ){
488 @ (%d(fmid))
489 }
490 @ %W(zCom) (user:
491 hyperlink_to_user(zUser, zDate, "");
492 @ branch: %h(zBr))
493 if( g.perm.Hyperlink && zUuid ){
494 const char *z = zFilename;
495
+2 -1
--- src/main.c
+++ src/main.c
@@ -143,10 +143,11 @@
143143
int fSqlTrace; /* True if --sqltrace flag is present */
144144
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
145145
int fSqlPrint; /* True if -sqlprint flag is present */
146146
int fQuiet; /* True if -quiet flag is present */
147147
int fHttpTrace; /* Trace outbound HTTP requests */
148
+ int fAnyTrace; /* Any kind of tracing */
148149
char *zHttpAuth; /* HTTP Authorization user:pass information */
149150
int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
150151
int fSshTrace; /* Trace the SSH setup traffic */
151152
int fSshClient; /* HTTP client flags for SSH client */
152153
char *zSshCmd; /* SSH command string */
@@ -658,15 +659,15 @@
658659
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
659660
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
660661
g.fSshClient = 0;
661662
g.zSshCmd = 0;
662663
if( g.fSqlTrace ) g.fSqlStats = 1;
663
- g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
664664
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
665665
#ifdef FOSSIL_ENABLE_TH1_HOOKS
666666
g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
667667
#endif
668
+ g.fAnyTrace = g.fSqlTrace|g.fSystemTrace|g.fSshTrace|g.fHttpTrace;
668669
g.zHttpAuth = 0;
669670
g.zLogin = find_option("user", "U", 1);
670671
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
671672
g.zErrlog = find_option("errorlog", 0, 1);
672673
fossil_init_flags_from_options();
673674
--- src/main.c
+++ src/main.c
@@ -143,10 +143,11 @@
143 int fSqlTrace; /* True if --sqltrace flag is present */
144 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
145 int fSqlPrint; /* True if -sqlprint flag is present */
146 int fQuiet; /* True if -quiet flag is present */
147 int fHttpTrace; /* Trace outbound HTTP requests */
 
148 char *zHttpAuth; /* HTTP Authorization user:pass information */
149 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
150 int fSshTrace; /* Trace the SSH setup traffic */
151 int fSshClient; /* HTTP client flags for SSH client */
152 char *zSshCmd; /* SSH command string */
@@ -658,15 +659,15 @@
658 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
659 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
660 g.fSshClient = 0;
661 g.zSshCmd = 0;
662 if( g.fSqlTrace ) g.fSqlStats = 1;
663 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
664 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
665 #ifdef FOSSIL_ENABLE_TH1_HOOKS
666 g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
667 #endif
 
668 g.zHttpAuth = 0;
669 g.zLogin = find_option("user", "U", 1);
670 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
671 g.zErrlog = find_option("errorlog", 0, 1);
672 fossil_init_flags_from_options();
673
--- src/main.c
+++ src/main.c
@@ -143,10 +143,11 @@
143 int fSqlTrace; /* True if --sqltrace flag is present */
144 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
145 int fSqlPrint; /* True if -sqlprint flag is present */
146 int fQuiet; /* True if -quiet flag is present */
147 int fHttpTrace; /* Trace outbound HTTP requests */
148 int fAnyTrace; /* Any kind of tracing */
149 char *zHttpAuth; /* HTTP Authorization user:pass information */
150 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
151 int fSshTrace; /* Trace the SSH setup traffic */
152 int fSshClient; /* HTTP client flags for SSH client */
153 char *zSshCmd; /* SSH command string */
@@ -658,15 +659,15 @@
659 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
660 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
661 g.fSshClient = 0;
662 g.zSshCmd = 0;
663 if( g.fSqlTrace ) g.fSqlStats = 1;
 
664 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
665 #ifdef FOSSIL_ENABLE_TH1_HOOKS
666 g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
667 #endif
668 g.fAnyTrace = g.fSqlTrace|g.fSystemTrace|g.fSshTrace|g.fHttpTrace;
669 g.zHttpAuth = 0;
670 g.zLogin = find_option("user", "U", 1);
671 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
672 g.zErrlog = find_option("errorlog", 0, 1);
673 fossil_init_flags_from_options();
674
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1556,11 +1556,11 @@
15561556
}
15571557
}
15581558
if( P("showsql") ){
15591559
@ <blockquote>%h(blob_sql_text(&sql))</blockquote>
15601560
}
1561
- if( P("showrid") ) tmFlags |= TIMELINE_SHOWRID;
1561
+ if( P("showid") ) tmFlags |= TIMELINE_SHOWRID;
15621562
blob_zero(&sql);
15631563
db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
15641564
@ <h2>%b(&desc)</h2>
15651565
blob_reset(&desc);
15661566
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0);
15671567
--- src/timeline.c
+++ src/timeline.c
@@ -1556,11 +1556,11 @@
1556 }
1557 }
1558 if( P("showsql") ){
1559 @ <blockquote>%h(blob_sql_text(&sql))</blockquote>
1560 }
1561 if( P("showrid") ) tmFlags |= TIMELINE_SHOWRID;
1562 blob_zero(&sql);
1563 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
1564 @ <h2>%b(&desc)</h2>
1565 blob_reset(&desc);
1566 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0);
1567
--- src/timeline.c
+++ src/timeline.c
@@ -1556,11 +1556,11 @@
1556 }
1557 }
1558 if( P("showsql") ){
1559 @ <blockquote>%h(blob_sql_text(&sql))</blockquote>
1560 }
1561 if( P("showid") ) tmFlags |= TIMELINE_SHOWRID;
1562 blob_zero(&sql);
1563 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
1564 @ <h2>%b(&desc)</h2>
1565 blob_reset(&desc);
1566 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0);
1567

Keyboard Shortcuts

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