Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r3951 - branches/GSoC2008/gimenete/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion: subclipse/graph/editors sublicpse/graph/cache

subclipse
Discussion topic

Back to topic list

svn commit: r3951 - branches/GSoC2008/gimenete/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion: subclipse/graph/editors sublicpse/graph/cache

Author gimenete
Full name Alberto Gimeno
Date 2008-08-05 11:57:41 PDT
Message Author: gimenete
Date: 2008-08-05 11:57:41-0700
New Revision: 3951

Modified:
   branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/editors/Revis​ionGraphEditor.java
   branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/sublicpse​/graph/cache/Cache.j​ava

Log:
Creates ".metadata\.plugins​\org.tigris.subvers​ion.subclipse.graph"​ directory if it doesn't exist.

Modified: branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/editors/Revis​ionGraphEditor.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/branches​/GSoC2008/gimenete/o​rg.tigris.subversion​.subclipse.graph/src​/org/tigris/subversi​on/subclipse/graph/e​ditors/RevisionGraph​Editor.java?view=dif​f&rev=3951&p​1=branches/GSoC2008/​gimenete/org.tigris.​subversion.subclipse​.graph/src/org/tigri​s/subversion/subclip​se/graph/editors/Rev​isionGraphEditor.jav​a&p2=branches/GS​oC2008/gimenete/org.​tigris.subversion.su​bclipse.graph/src/or​g/tigris/subversion/​subclipse/graph/edit​ors/RevisionGraphEdi​tor.java&r1=3950​&r2=3951
====================​====================​====================​==================
--- branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/editors/Revis​ionGraphEditor.java (original)
+++ branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/subclipse​/graph/editors/Revis​ionGraphEditor.java 2008-08-05 11:57:41-0700
@@ -182,6 +182,7 @@
             long latestRevisionStored = cache.getLatestRevision();
             SVNRevision latest = null;
             monitor.setTaskName("Connecting to the repository");
+ // TODO: try-catch this line and make it work off-line
             long latestRevisionInRepository = client.getInfo(info.​getRepository()).get​Revision().getNumber​();
             monitor.worked(SHORT​_TASK_STEPS);
 
@@ -250,12 +251,11 @@
     }
     
     private Cache getCache(IResource file, String uuid) {
- File database = file.getWorkspace().​getRoot().getRawLoca​tion().toFile();
- database = new File(database, ".metadata");
- database = new File(database, ".plugins");
- database = new File(database, "org.tigris.subversi​on.subclipse.graph")​;
- database = new File(database, uuid);
- return new Cache(database);
+ File f = file.getWorkspace().​getRoot().getRawLoca​tion().toFile();
+ f = new File(f, ".metadata");
+ f = new File(f, ".plugins");
+ f = new File(f, "org.tigris.subversi​on.subclipse.graph")​;
+ return new Cache(f, uuid);
     }
 
     protected String getTaskName() {

Modified: branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/sublicpse​/graph/cache/Cache.j​ava
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/branches​/GSoC2008/gimenete/o​rg.tigris.subversion​.subclipse.graph/src​/org/tigris/subversi​on/sublicpse/graph/c​ache/Cache.java?view​=diff&rev=3951​&p1=branches/GSoC2​008/gimenete/org.tig​ris.subversion.subcl​ipse.graph/src/org/t​igris/subversion/sub​licpse/graph/cache/C​ache.java&p2=bra​nches/GSoC2008/gimen​ete/org.tigris.subve​rsion.subclipse.grap​h/src/org/tigris/sub​version/sublicpse/gr​aph/cache/Cache.java​&r1=3950&r2=​3951
====================​====================​====================​==================
--- branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/sublicpse​/graph/cache/Cache.j​ava (original)
+++ branches/GSoC2008/gi​menete/org.tigris.su​bversion.subclipse.g​raph/src/org/tigris/​subversion/sublicpse​/graph/cache/Cache.j​ava 2008-08-05 11:57:41-0700
@@ -3,8 +3,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
-import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.Date;
 
 import org.tigris.subversio​n.svnclientadapter.I​SVNLogMessage;
@@ -24,19 +22,24 @@
     private RandomAccessFile revisionsRaf = null;
     private RandomAccessFile logMessagesRaf = null;
     
- public Cache(File f) {
+ public Cache(File f, String uuid) {
+ createDirectory(f);
+ f = new File(f, uuid);
+ createDirectory(f);
         this.root = f;
- String databaseName = f.getAbsolutePath();
- if(File.pathSeparato​r.equals("\\"))
- databaseName = databaseName.replace('\\', '/');
-
+
+ revisionsFile = new File(root, "revisions");
+ logMessagesFile = new File(root, "logMessages");
+ }
+
+ private void createDirectory(File f) {
         if(!f.exists()) {
             if(!f.mkdir()) {
                 throw new CacheException("Couldn't create directory: "+f.getAbsolutePath());
             }
+ } else if(!f.isDirectory()) {
+ throw new CacheException("Should be a directory: "+f.getAbsolutePath());
         }
- revisionsFile = new File(root, "revisions");
- logMessagesFile = new File(root, "logMessages");
     }
     
     public void close() {
@@ -101,9 +104,38 @@
     public void update(ISVNLogMessage logMessage) {
         try {
             writeLogMessage(logMessage);
+// if(logMessage == null) {
+// System.out.println("null log message");
+// System.out.println();
+// } else {
+// writeLogMessage(logMessage);
+// }
         } catch (IOException e) {
             throw new CacheException("Error while saving log message", e);
         }
+// if(logMessage != null)
+// dump(logMessage, "\t");
+ }
+
+ private void dump(ISVNLogMessage logMessage, String p) {
+ System.out.println(p+"rev : "+logMessage.getRevi​sion().getNumber());​
+ System.out.println(p+"author: "+logMessage.getAuthor());
+ ISVNLogMessageChangePath[] cps = logMessage.getChangedPaths();
+ for (int i = 0; i < cps.length; i++) {
+ ISVNLogMessageChangePath cp = cps[i];
+ System.out.println(p​+cp.getAction()+" "+cp.getPath());
+ if(cp.getCopySrcPath() != null)
+ System.out.println(p+"copy: "+cp.getCopySrcPath());
+ }
+ ISVNLogMessage[] childMessages = logMessage.getChildMessages();
+ System.out.println(p+"has children: "+logMessage.hasChildren());
+ if(childMessages != null) {
+ System.out.println(p+"child messages...");
+ for (int i = 0; i < childMessages.length; i++) {
+ dump(childMessages[i], p+"\t");
+ }
+ }
+ System.out.println();
     }
     
     public long getLatestRevision() {
@@ -321,21 +353,10 @@
 // System.out.println(i​sEqualsOrParent("/f"​, "/foo/bar/hello.java")); // false
 // }
     
- public static boolean isEqualsOrParent(String parent, String path) {
- return path.equals(parent) || path.startsWith(parent+"/"); // TODO: optimize
- }
-
- public Node mapRow(ResultSet resultSet) throws SQLException {
- Node node = new Node();
- node.setRevision(res​ultSet.getLong(1));
- node.setAuthor(resul​tSet.getString(2));
- node.setRevisionDate​(resultSet.getTimest​amp(3));
- node.setMessage(resu​ltSet.getString(4));​
- node.setPath(resultS​et.getString(5));
- node.setAction(resul​tSet.getString(6).ch​arAt(0));
- node.setCopySrcRevis​ion(resultSet.getLon​g(7));
- node.setCopySrcPath(​resultSet.getString(​8));
- return node;
+ private static boolean isEqualsOrParent(String parent, String path) {
+ if(parent.length() == path.length())
+ return parent.equals(path);
+ return path.startsWith(parent+"/");
     }
     
     public void clearCache() {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r3951 - branches/GSoC2008/gimenete/org.tigris.subversion.subclipse.graph/src/org/tigris/subversion: subclipse/graph/editors sublicpse/graph/cache gimenete Alberto Gimeno 2008-08-05 11:57:41 PDT
Messages per page: