Check-in [01ce2cf3dc]
Not logged in
Overview

SHA1 Hash:01ce2cf3dc8949a16646fecaa3f48bd353fe12d7
Date: 2007-09-24 14:02:30
User: jnc
Comment:Added a gdiff command. diff command now runs config diff-command, gdiff command (graphical diff) now runs config gdiff-command. With both, if -i is supplied, internal diff is used. With both, if they are not configured, internal diff is used. Fixed bug with internal diff giving files in reverse order. Also put div id="sub-menu" inside of submenu if, as to not display the sub menu if no sub menu items exist
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/diffcmd.c from [a106583630] to [4af4f0ff55].

@@ -42,49 +42,63 @@
   }
 }
 
 /*
 ** COMMAND: diff
+** COMMAND: gdiff
 **
-** Usage: %fossil diff ?-i FILE...
+** Usage: %fossil diff|gdiff ?-i FILE...
 **
 ** Show the difference between the current version of a file (as it
 ** exists on disk) and that same file as it was checked out.
-** If -i is supplied, the internal diff command will be executed
-** otherwise, fossil attempts to use the user configured diff-command.
+**
+** diff will show a textual diff while gdiff will attempt to run a
+** graphical diff command that you have setup. If the choosen command
+** is not yet configured, the internal textual diff command will be
+** used.
+**
+** If -i is supplied for either diff or gdiff, the internal textual
+** diff command will be executed.
 **
 ** Here are a few external diff command settings, for example:
 **
-**   %fossil config diff-command=tkdiff
-**   %fossil config diff-command=eskill22
-**   %fossil config diff-command=tortoisemerge
-**   %fossil config diff-command=meld
-**   %fossil config diff-command=xxdiff
-**   %fossil config diff-command=kdiff3
+**   %fossil config diff-command=diff
+**
+**   %fossil config gdiff-command=tkdiff
+**   %fossil config gdiff-command=eskill22
+**   %fossil config gdiff-command=tortoisemerge
+**   %fossil config gdiff-command=meld
+**   %fossil config gdiff-command=xxdiff
+**   %fossil config gdiff-command=kdiff3
 */
 void diff_cmd(void){
   const char *zFile;
   Blob cmd;
   Blob fname;
   int i, internalDiff;
   char *zV1 = 0;
   char *zV2 = 0;
 
-  internalDiff = find_option("intertal","i",0)!=0;
+  internalDiff = find_option("internal","i",0)!=0;
 
   if( g.argc<3 ){
     usage("?OPTIONS? FILE");
   }
   db_must_be_within_tree();
 
   if( internalDiff==0 ){
-  	const char *zExternalCommand = db_global_get("diff-command", 0);
+    const char *zExternalCommand;
+    if( strcmp(g.argv[1], "diff")==0 ){
+      zExternalCommand = db_global_get("diff-command", 0);
+    }else{
+      zExternalCommand = db_global_get("gdiff-command", 0);
+    }
     if( zExternalCommand==0 ){
       internalDiff=1;
     }
-  	blob_zero(&cmd);
-  	blob_appendf(&cmd, "%s ", zExternalCommand);
+    blob_zero(&cmd);
+    blob_appendf(&cmd, "%s ", zExternalCommand);
   }
   for(i=2; i<g.argc-1; i++){
     const char *z = g.argv[i];
     if( (strcmp(z,"-v")==0 || strcmp(z,"--version")==0) && i<g.argc-2 ){
       if( zV1==0 ){
@@ -123,11 +137,11 @@
       Blob current;
       Blob out;
       blob_zero(&current);
       blob_read_from_file(&current, zFile);
       blob_zero(&out);
-      unified_diff(&current, &record, 5, &out);
+      unified_diff(&record, &current, 5, &out);
       printf("%s\n", blob_str(&out));
       blob_reset(&current);
       blob_reset(&out);
     }else{
       blob_write_to_file(&record, blob_str(&vname));

Modified src/style.c from [f0dc6f508b] to [b61388a566].

@@ -107,12 +107,12 @@
   }
   if( !g.noPswd ){
     @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
   }
   @ </div>
-  @ <div id="sub-menu">
   if( nSubmenu>0 ){
+    @ <div id="sub-menu">
     int i;
     qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
     for(i=0; i<nSubmenu; i++){
       struct Submenu *p = &aSubmenu[i];
       char *zTail = i<nSubmenu-1 ? " | " : "";
@@ -122,12 +122,12 @@
       }else{
         @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a>
         @ <span class="tail">%s(zTail)</span>
       }
     }
-  }
-  @ </div>
+    @ </div>
+  }
   @ <div id="page">
   g.cgiPanic = 1;
 }
 
 /*