Diff
Not logged in

Differences From:

File src/diffcmd.c part of check-in [c863ec1a98] - The "diff" command with no arguments now does a diff on all files in the checkout which have been edited. by drh on 2008-10-21 06:52:23. Also file src/diffcmd.c part of check-in [32b480faa3] - Create named fork test-tag-1 by drh on 2008-10-24 13:45:08. [view]

To:

File src/diffcmd.c part of check-in [85670cfcc8] - Improvements to the output of the "diff" command so that it is closer to standards. by drh on 2008-10-24 10:56:19. [view]

@@ -94,8 +94,12 @@
       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));
@@ -133,16 +137,19 @@
 **   %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();
@@ -179,9 +186,9 @@
 
   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);
@@ -192,8 +199,9 @@
     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{