Check-in [9df32e2808]
Not logged in
Overview

SHA1 Hash:9df32e280830decdb65206f9276b60bb81e14aed
Date: 2007-08-01 01:24:37
User: drh
Comment:Added the vdiff webpage with links from vinfo.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [77aac55e7c] to [1c93e96623].

@@ -220,10 +220,11 @@
     @ <h2>Version %s(db_column_text(&q,0))</h2>
     @ <ul>
     @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
     @ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
     @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
+    @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
     @ </ul>
   }
   db_finalize(&q);
   @ <p><h2>Descendents:</h2>
   n = showDescendents(rid, 2);
@@ -307,10 +308,71 @@
     hyperlink_to_uuid(db_column_text(&q,0));
     @ %h(db_column_text(&q,2)) (by %h(db_column_text(&q,3)))</td>
   }
   db_finalize(&q);
   @ </table>
+  style_footer();
+}
+
+
+/*
+** Append the difference between two RIDs to the output
+*/
+static void append_diff(int fromid, int toid){
+  Blob from, to, out;
+  content_get(fromid, &from);
+  content_get(toid, &to);
+  blob_zero(&out);
+  unified_diff(&from, &to, 5, &out);
+  @ %h(blob_str(&out))
+  blob_reset(&from);
+  blob_reset(&to);
+  blob_reset(&out);
+}
+
+/*
+** WEBPAGE: vdiff
+**
+** Show all differences for a particular check-in specified by g.zExtra
+*/
+void vdiff_page(void){
+  int rid, i;
+  Stmt q;
+  Manifest m;
+  Blob mfile, file;
+  char *zUuid;
+
+  login_check_credentials();
+  if( !g.okHistory ){ login_needed(); return; }
+  style_header("Version Diff");
+
+  rid = name_to_rid(g.zExtra);
+  if( rid==0 ){
+    cgi_redirect("index");
+  }
+  db_prepare(&q,
+     "SELECT pid, fid, name"
+     "  FROM mlink, filename"
+     " WHERE mlink.mid=%d"
+     "   AND filename.fnid=mlink.fnid"
+     " ORDER BY name",
+     rid
+  );
+  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
+  @ <h2>All Changes In Version
+  hyperlink_to_uuid(zUuid);
+  @ </h2>
+  while( db_step(&q)==SQLITE_ROW ){
+    int pid = db_column_int(&q,0);
+    int fid = db_column_int(&q,1);
+    const char *zName = db_column_text(&q,2);
+    @ <p><a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></p>
+    @ <blockquote><pre>
+    append_diff(pid, fid);
+    @ </pre></blockquote>
+  }
+  db_finalize(&q);
   style_footer();
 }