Fossil SCM

Allow unified diff for the --tk diff option.

mistachkin 2012-09-27 00:37 trunk
Commit 5be507df71828bfa19ef3111e684197a97586e24
2 files changed +2 +4 -1
+2
--- src/diff.c
+++ src/diff.c
@@ -1538,17 +1538,19 @@
15381538
** --html Format for HTML DIFF_HTML
15391539
** --invert Invert the diff DIFF_INVERT
15401540
** --linenum|-n Show line numbers DIFF_LINENO
15411541
** --noopt Disable optimization DIFF_NOOPT
15421542
** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1543
+** --unified Unified diff. ~DIFF_SIDEBYSIDE
15431544
** --width|-W N N character lines. DIFF_WIDTH_MASK
15441545
*/
15451546
int diff_options(void){
15461547
u64 diffFlags = 0;
15471548
const char *z;
15481549
int f;
15491550
if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1551
+ if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
15501552
if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
15511553
if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
15521554
diffFlags |= f;
15531555
}
15541556
if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
15551557
--- src/diff.c
+++ src/diff.c
@@ -1538,17 +1538,19 @@
1538 ** --html Format for HTML DIFF_HTML
1539 ** --invert Invert the diff DIFF_INVERT
1540 ** --linenum|-n Show line numbers DIFF_LINENO
1541 ** --noopt Disable optimization DIFF_NOOPT
1542 ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
 
1543 ** --width|-W N N character lines. DIFF_WIDTH_MASK
1544 */
1545 int diff_options(void){
1546 u64 diffFlags = 0;
1547 const char *z;
1548 int f;
1549 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
 
1550 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
1551 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
1552 diffFlags |= f;
1553 }
1554 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
1555
--- src/diff.c
+++ src/diff.c
@@ -1538,17 +1538,19 @@
1538 ** --html Format for HTML DIFF_HTML
1539 ** --invert Invert the diff DIFF_INVERT
1540 ** --linenum|-n Show line numbers DIFF_LINENO
1541 ** --noopt Disable optimization DIFF_NOOPT
1542 ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1543 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
1544 ** --width|-W N N character lines. DIFF_WIDTH_MASK
1545 */
1546 int diff_options(void){
1547 u64 diffFlags = 0;
1548 const char *z;
1549 int f;
1550 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1551 if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
1552 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
1553 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
1554 diffFlags |= f;
1555 }
1556 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
1557
+4 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -490,11 +490,13 @@
490490
@ if {$tcl_platform(platform)=="windows"} {.t config -font {courier 9}}
491491
@ .t tag config ln -foreground gray
492492
@ .t tag config chng -background {#d0d0ff}
493493
@ .t tag config add -background {#c0ffc0}
494494
@ .t tag config rm -background {#ffc0c0}
495
-@ proc dehtml {x} {return [string map {&amp; & &lt; < &gt; >} $x]}
495
+@ proc dehtml {x} {
496
+@ return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
497
+@ }
496498
@ set in [open $cmd r]
497499
@ while {![eof $in]} {
498500
@ set line [gets $in]
499501
@ if {[regexp {^<a name="chunk.*"></a>} $line]} continue
500502
@ if {[regexp {^===} $line]} {
@@ -581,10 +583,11 @@
581583
** -i use internal diff logic
582584
** --new-file|-N output complete text of added or deleted files
583585
** --tk Launch a Tcl/Tk GUI for display
584586
** --to VERSION select VERSION as target for the diff
585587
** --side-by-side|-y side-by-side diff
588
+** --unified unified diff
586589
** --width|-W N Width of lines in side-by-side diff
587590
*/
588591
void diff_cmd(void){
589592
int isGDiff; /* True for gdiff. False for normal diff */
590593
int isInternDiff; /* True for internal diff */
591594
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -490,11 +490,13 @@
490 @ if {$tcl_platform(platform)=="windows"} {.t config -font {courier 9}}
491 @ .t tag config ln -foreground gray
492 @ .t tag config chng -background {#d0d0ff}
493 @ .t tag config add -background {#c0ffc0}
494 @ .t tag config rm -background {#ffc0c0}
495 @ proc dehtml {x} {return [string map {&amp; & &lt; < &gt; >} $x]}
 
 
496 @ set in [open $cmd r]
497 @ while {![eof $in]} {
498 @ set line [gets $in]
499 @ if {[regexp {^<a name="chunk.*"></a>} $line]} continue
500 @ if {[regexp {^===} $line]} {
@@ -581,10 +583,11 @@
581 ** -i use internal diff logic
582 ** --new-file|-N output complete text of added or deleted files
583 ** --tk Launch a Tcl/Tk GUI for display
584 ** --to VERSION select VERSION as target for the diff
585 ** --side-by-side|-y side-by-side diff
 
586 ** --width|-W N Width of lines in side-by-side diff
587 */
588 void diff_cmd(void){
589 int isGDiff; /* True for gdiff. False for normal diff */
590 int isInternDiff; /* True for internal diff */
591
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -490,11 +490,13 @@
490 @ if {$tcl_platform(platform)=="windows"} {.t config -font {courier 9}}
491 @ .t tag config ln -foreground gray
492 @ .t tag config chng -background {#d0d0ff}
493 @ .t tag config add -background {#c0ffc0}
494 @ .t tag config rm -background {#ffc0c0}
495 @ proc dehtml {x} {
496 @ return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
497 @ }
498 @ set in [open $cmd r]
499 @ while {![eof $in]} {
500 @ set line [gets $in]
501 @ if {[regexp {^<a name="chunk.*"></a>} $line]} continue
502 @ if {[regexp {^===} $line]} {
@@ -581,10 +583,11 @@
583 ** -i use internal diff logic
584 ** --new-file|-N output complete text of added or deleted files
585 ** --tk Launch a Tcl/Tk GUI for display
586 ** --to VERSION select VERSION as target for the diff
587 ** --side-by-side|-y side-by-side diff
588 ** --unified unified diff
589 ** --width|-W N Width of lines in side-by-side diff
590 */
591 void diff_cmd(void){
592 int isGDiff; /* True for gdiff. False for normal diff */
593 int isInternDiff; /* True for internal diff */
594

Keyboard Shortcuts

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