Fossil SCM

Add the --tkdebug command-line option to commands that support --tk. Change the --debug option on merge-info into --tkdebug for consistency.

drh 2025-02-20 11:13 merge-info
Commit 5548a91116196659f970fd120f90efc64b89b8f65f1f9805e2a328b5b896cc9f
+5 -1
--- src/diff.tcl
+++ src/diff.tcl
@@ -91,12 +91,16 @@
9191
incr ii
9292
return $x
9393
}
9494
9595
proc readDiffs {fossilcmd} {
96
- global difftxt
96
+ global difftxt debug
9797
if {![info exists difftxt]} {
98
+ if {$debug} {
99
+ puts "# [list open $fossilcmd r]"
100
+ flush stdout
101
+ }
98102
set in [open $fossilcmd r]
99103
fconfigure $in -encoding utf-8
100104
set difftxt [split [read $in] \n]
101105
close $in
102106
}
103107
--- src/diff.tcl
+++ src/diff.tcl
@@ -91,12 +91,16 @@
91 incr ii
92 return $x
93 }
94
95 proc readDiffs {fossilcmd} {
96 global difftxt
97 if {![info exists difftxt]} {
 
 
 
 
98 set in [open $fossilcmd r]
99 fconfigure $in -encoding utf-8
100 set difftxt [split [read $in] \n]
101 close $in
102 }
103
--- src/diff.tcl
+++ src/diff.tcl
@@ -91,12 +91,16 @@
91 incr ii
92 return $x
93 }
94
95 proc readDiffs {fossilcmd} {
96 global difftxt debug
97 if {![info exists difftxt]} {
98 if {$debug} {
99 puts "# [list open $fossilcmd r]"
100 flush stdout
101 }
102 set in [open $fossilcmd r]
103 fconfigure $in -encoding utf-8
104 set difftxt [split [read $in] \n]
105 close $in
106 }
107
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1188,10 +1188,11 @@
11881188
int i;
11891189
Blob script;
11901190
const char *zTempFile = 0;
11911191
char *zCmd;
11921192
const char *zTclsh;
1193
+ int bDebug = find_option("tkdebug",0,0)!=0;
11931194
int bDarkMode = find_option("dark",0,0)!=0;
11941195
blob_zero(&script);
11951196
/* Caution: When this routine is called from the merge-info command,
11961197
** the --tcl argument requires an argument. But merge-info does not
11971198
** use -i, so we can take -i as that argument. This routine needs to
@@ -1222,10 +1223,11 @@
12221223
blob_append(&script, " ", 1);
12231224
for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]);
12241225
}
12251226
}
12261227
blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode);
1228
+ blob_appendf(&script, "set debug %d\n", bDebug);
12271229
blob_appendf(&script, "%s", builtin_file("diff.tcl", 0));
12281230
if( zTempFile ){
12291231
blob_write_to_file(&script, zTempFile);
12301232
fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile);
12311233
}else{
12321234
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1188,10 +1188,11 @@
1188 int i;
1189 Blob script;
1190 const char *zTempFile = 0;
1191 char *zCmd;
1192 const char *zTclsh;
 
1193 int bDarkMode = find_option("dark",0,0)!=0;
1194 blob_zero(&script);
1195 /* Caution: When this routine is called from the merge-info command,
1196 ** the --tcl argument requires an argument. But merge-info does not
1197 ** use -i, so we can take -i as that argument. This routine needs to
@@ -1222,10 +1223,11 @@
1222 blob_append(&script, " ", 1);
1223 for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]);
1224 }
1225 }
1226 blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode);
 
1227 blob_appendf(&script, "%s", builtin_file("diff.tcl", 0));
1228 if( zTempFile ){
1229 blob_write_to_file(&script, zTempFile);
1230 fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile);
1231 }else{
1232
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1188,10 +1188,11 @@
1188 int i;
1189 Blob script;
1190 const char *zTempFile = 0;
1191 char *zCmd;
1192 const char *zTclsh;
1193 int bDebug = find_option("tkdebug",0,0)!=0;
1194 int bDarkMode = find_option("dark",0,0)!=0;
1195 blob_zero(&script);
1196 /* Caution: When this routine is called from the merge-info command,
1197 ** the --tcl argument requires an argument. But merge-info does not
1198 ** use -i, so we can take -i as that argument. This routine needs to
@@ -1222,10 +1223,11 @@
1223 blob_append(&script, " ", 1);
1224 for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]);
1225 }
1226 }
1227 blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode);
1228 blob_appendf(&script, "set debug %d\n", bDebug);
1229 blob_appendf(&script, "%s", builtin_file("diff.tcl", 0));
1230 if( zTempFile ){
1231 blob_write_to_file(&script, zTempFile);
1232 fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile);
1233 }else{
1234
+9 -10
--- src/merge.c
+++ src/merge.c
@@ -39,11 +39,11 @@
3939
}
4040
/* The undocumented --script FILENAME option causes the Tk script to
4141
** be written into the FILENAME instead of being run. This is used
4242
** for testing and debugging. */
4343
zTempFile = find_option("script",0,1);
44
- bDebug = find_option("debug",0,0)!=0;
44
+ bDebug = find_option("tkdebug",0,0)!=0;
4545
verify_all_options();
4646
4747
blob_zero(&script);
4848
blob_appendf(&script, "set ncontext %d\n", nContext);
4949
blob_appendf(&script, "set fossilexe {\"%/\"}\n", g.nameOfExe);
@@ -314,11 +314,11 @@
314314
** information needed to display the changes to
315315
** FILE caused by the most recent merge. FILE must
316316
** be a pathname relative to the root of the check-out.
317317
**
318318
** Debugging options available only when --tk is used:
319
-** --debug Show sub-commands run to implement --tk
319
+** --tkdebug Show sub-commands run to implement --tk
320320
** --script FILE Write script used to implement --tk into FILE
321321
*/
322322
void merge_info_cmd(void){
323323
const char *zCnt;
324324
const char *zTcl;
@@ -345,18 +345,11 @@
345345
diffMode = 13;
346346
}else
347347
if( (zDiff2 = find_option("diff23", 0, 1))!=0 ){
348348
diffMode = 23;
349349
}
350
-
351
- if( bTk==0 ){
352
- find_option("v",0,0);
353
- verify_all_options();
354
- if( g.argc>2 ){
355
- usage("[OPTIONS]");
356
- }
357
- }
350
+
358351
if( zCnt ){
359352
nContext = atoi(zCnt);
360353
if( nContext<0 ) nContext = 0xfffffff;
361354
}else{
362355
nContext = 6;
@@ -384,10 +377,16 @@
384377
diffMode, zDiff2, nContext, bDark ? " --dark" : "");
385378
diff_tk(zCmd, g.argc);
386379
fossil_free(zCmd);
387380
return;
388381
}
382
+
383
+ verify_all_options();
384
+ if( g.argc>2 ){
385
+ usage("[OPTIONS]");
386
+ }
387
+
389388
if( bAll ){
390389
zWhere = "";
391390
}else{
392391
zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
393392
}
394393
--- src/merge.c
+++ src/merge.c
@@ -39,11 +39,11 @@
39 }
40 /* The undocumented --script FILENAME option causes the Tk script to
41 ** be written into the FILENAME instead of being run. This is used
42 ** for testing and debugging. */
43 zTempFile = find_option("script",0,1);
44 bDebug = find_option("debug",0,0)!=0;
45 verify_all_options();
46
47 blob_zero(&script);
48 blob_appendf(&script, "set ncontext %d\n", nContext);
49 blob_appendf(&script, "set fossilexe {\"%/\"}\n", g.nameOfExe);
@@ -314,11 +314,11 @@
314 ** information needed to display the changes to
315 ** FILE caused by the most recent merge. FILE must
316 ** be a pathname relative to the root of the check-out.
317 **
318 ** Debugging options available only when --tk is used:
319 ** --debug Show sub-commands run to implement --tk
320 ** --script FILE Write script used to implement --tk into FILE
321 */
322 void merge_info_cmd(void){
323 const char *zCnt;
324 const char *zTcl;
@@ -345,18 +345,11 @@
345 diffMode = 13;
346 }else
347 if( (zDiff2 = find_option("diff23", 0, 1))!=0 ){
348 diffMode = 23;
349 }
350
351 if( bTk==0 ){
352 find_option("v",0,0);
353 verify_all_options();
354 if( g.argc>2 ){
355 usage("[OPTIONS]");
356 }
357 }
358 if( zCnt ){
359 nContext = atoi(zCnt);
360 if( nContext<0 ) nContext = 0xfffffff;
361 }else{
362 nContext = 6;
@@ -384,10 +377,16 @@
384 diffMode, zDiff2, nContext, bDark ? " --dark" : "");
385 diff_tk(zCmd, g.argc);
386 fossil_free(zCmd);
387 return;
388 }
 
 
 
 
 
 
389 if( bAll ){
390 zWhere = "";
391 }else{
392 zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
393 }
394
--- src/merge.c
+++ src/merge.c
@@ -39,11 +39,11 @@
39 }
40 /* The undocumented --script FILENAME option causes the Tk script to
41 ** be written into the FILENAME instead of being run. This is used
42 ** for testing and debugging. */
43 zTempFile = find_option("script",0,1);
44 bDebug = find_option("tkdebug",0,0)!=0;
45 verify_all_options();
46
47 blob_zero(&script);
48 blob_appendf(&script, "set ncontext %d\n", nContext);
49 blob_appendf(&script, "set fossilexe {\"%/\"}\n", g.nameOfExe);
@@ -314,11 +314,11 @@
314 ** information needed to display the changes to
315 ** FILE caused by the most recent merge. FILE must
316 ** be a pathname relative to the root of the check-out.
317 **
318 ** Debugging options available only when --tk is used:
319 ** --tkdebug Show sub-commands run to implement --tk
320 ** --script FILE Write script used to implement --tk into FILE
321 */
322 void merge_info_cmd(void){
323 const char *zCnt;
324 const char *zTcl;
@@ -345,18 +345,11 @@
345 diffMode = 13;
346 }else
347 if( (zDiff2 = find_option("diff23", 0, 1))!=0 ){
348 diffMode = 23;
349 }
350
 
 
 
 
 
 
 
351 if( zCnt ){
352 nContext = atoi(zCnt);
353 if( nContext<0 ) nContext = 0xfffffff;
354 }else{
355 nContext = 6;
@@ -384,10 +377,16 @@
377 diffMode, zDiff2, nContext, bDark ? " --dark" : "");
378 diff_tk(zCmd, g.argc);
379 fossil_free(zCmd);
380 return;
381 }
382
383 verify_all_options();
384 if( g.argc>2 ){
385 usage("[OPTIONS]");
386 }
387
388 if( bAll ){
389 zWhere = "";
390 }else{
391 zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
392 }
393
--- src/merge.tcl
+++ src/merge.tcl
@@ -367,10 +367,11 @@
367367
lappend cmd merge-info --diff$mode $fn -c $ncontext
368368
if {$darkmode} {
369369
lappend cmd --dark
370370
}
371371
if {$debug} {
372
+ lappend cmd --tkdebug
372373
puts $cmd
373374
flush stdout
374375
}
375376
exec {*}$cmd &
376377
}
377378
--- src/merge.tcl
+++ src/merge.tcl
@@ -367,10 +367,11 @@
367 lappend cmd merge-info --diff$mode $fn -c $ncontext
368 if {$darkmode} {
369 lappend cmd --dark
370 }
371 if {$debug} {
 
372 puts $cmd
373 flush stdout
374 }
375 exec {*}$cmd &
376 }
377
--- src/merge.tcl
+++ src/merge.tcl
@@ -367,10 +367,11 @@
367 lappend cmd merge-info --diff$mode $fn -c $ncontext
368 if {$darkmode} {
369 lappend cmd --dark
370 }
371 if {$debug} {
372 lappend cmd --tkdebug
373 puts $cmd
374 flush stdout
375 }
376 exec {*}$cmd &
377 }
378

Keyboard Shortcuts

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