Check-in [85670cfcc8]
Not logged in
Overview

SHA1 Hash:85670cfcc852fdf5ca15a761185dadf9f02310d2
Date: 2008-10-24 10:56:19
User: drh
Comment:Improvements to the output of the "diff" command so that it is closer to standards.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/diffcmd.c from [74bdae74dd] to [38b20f8775].

@@ -93,10 +93,14 @@
     }else if( isDeleted ){
       printf("DELETED  %s\n", zPathname);
     }else if( isChnged==3 ){
       printf("ADDED_BY_MERGE %s\n", zPathname);
     }else{
+      printf("Index: %s\n======================================="
+             "============================\n",
+             zPathname
+      );
       shell_escape(&cmd, zFullName);
       printf("%s\n", blob_str(&cmd));
       fflush(stdout);
       system(blob_str(&cmd));
     }
@@ -132,18 +136,21 @@
 **   %fossil setting gdiff-command meld
 **   %fossil setting gdiff-command xxdiff
 **   %fossil setting gdiff-command kdiff3
 */
 void diff_cmd(void){
-  int isGDiff = g.argv[1][0]=='g';
-  const char *zFile, *zRevision;
-  Blob cmd;
-  Blob fname;
+  int isGDiff;               /* True for gdiff.  False for normal diff */
+  const char *zFile;         /* Name of file to diff */
+  const char *zRevision;     /* Version of file to diff against current */
+  Blob cmd;                  /* The diff command-line for external diff */
+  Blob fname;                /* */
   Blob vname;
   Blob record;
-  int cnt=0,internalDiff;
+  int cnt=0;
+  int internalDiff;          /* True to use the internal diff engine */
 
+  isGDiff = g.argv[1][0]=='g';
   internalDiff = find_option("internal","i",0)!=0;
   zRevision = find_option("revision", "r", 1);
   verify_all_options();
   db_must_be_within_tree();
 
@@ -178,11 +185,11 @@
   }while( access(blob_str(&vname),0)==0 );
 
   if( zRevision==0 ){
     int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
     if( rid==0 ){
-      fossil_panic("no history for file: %b", &fname);
+      fossil_fatal("no history for file: %b", &fname);
     }
     content_get(rid, &record);
   }else{
     historical_version_of_file(zRevision, blob_str(&fname), &record);
   }
@@ -191,10 +198,11 @@
     Blob current;
     blob_zero(&current);
     blob_read_from_file(&current, zFile);
     blob_zero(&out);
     text_diff(&record, &current, &out, 5);
+    printf("--- %s\n+++ %s\n", blob_str(&fname), blob_str(&fname));
     printf("%s\n", blob_str(&out));
     blob_reset(&current);
     blob_reset(&out);
   }else{
     blob_write_to_file(&record, blob_str(&vname));