Diff
Not logged in

Differences From:

File src/content.c part of check-in [48c4e69d2b] - Cluster-based synchronization appears to be working. by drh on 2007-09-09 17:51:16. Also file src/content.c part of check-in [bbcb6326c9] - Pulled in the navbar and timeline changes. by aku on 2007-09-17 00:58:51. [view]

To:

File src/content.c part of check-in [574763bab9] - Added revision support to diff and revert by jnc on 2007-09-26 03:37:12. Also file src/content.c part of check-in [8d55aa3597] - Merged in new revision support for diff and revert commands into mainstream by jnc on 2007-09-26 03:38:58. [view]

@@ -74,8 +74,34 @@
     }
     db_finalize(&q);
   }
   return rc;
+}
+
+/*
+** Get the contents of a file within a given revision.
+*/
+int content_get_historical_file(const char *revision, const char *file, Blob *content){
+  Blob mfile;
+  Manifest m;
+  int i, rid=0;
+
+  rid = name_to_rid(revision);
+  content_get(rid, &mfile);
+
+  if( manifest_parse(&m, &mfile) ){
+    for(i=0; i<m.nFile; i++){
+      if( strcmp(m.aFile[i].zName, file)==0 ){
+        rid = uuid_to_rid(m.aFile[i].zUuid, 0);
+        return content_get(rid, content);
+      }
+    }
+    fossil_panic("file: %s does not exist in revision: %s", file, revision);
+  }else{
+    fossil_panic("could not parse manifest for revision: %s", revision);
+  }
+
+  return 0;
 }
 
 /*
 ** COMMAND:  test-content-get