1 19 package org.netbeans.modules.subversion.ui.history; 20 21 import org.tigris.subversion.svnclientadapter.ISVNLogMessage; 22 import org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath; 23 import org.tigris.subversion.svnclientadapter.SVNUrl; 24 import java.io.File ; 25 import java.util.*; 26 27 34 class RepositoryRevision { 35 36 private ISVNLogMessage message; 37 38 private SVNUrl repositoryRootUrl; 39 40 43 private final List<Event> events = new ArrayList<Event>(1); 44 45 public RepositoryRevision(ISVNLogMessage message, SVNUrl rootUrl) { 46 this.message = message; 47 this.repositoryRootUrl = rootUrl; 48 initEvents(); 49 } 50 51 public SVNUrl getRepositoryRootUrl() { 52 return repositoryRootUrl; 53 } 54 55 private void initEvents() { 56 ISVNLogMessageChangePath [] paths = message.getChangedPaths(); 57 if (paths == null) return; 58 for (ISVNLogMessageChangePath path : paths) { 59 events.add(new Event(path)); 60 } 61 } 62 63 public List<Event> getEvents() { 64 return events; 65 } 66 67 public ISVNLogMessage getLog() { 68 return message; 69 } 70 71 public String toString() { 72 StringBuffer text = new StringBuffer (); 73 text.append(getLog().getRevision().getNumber()); 74 text.append("\t"); 75 text.append(getLog().getDate()); 76 text.append("\t"); 77 text.append(getLog().getAuthor()); text.append("\n"); text.append(getLog().getMessage()); 80 return text.toString(); 81 } 82 83 public class Event { 84 85 88 private File file; 89 90 private ISVNLogMessageChangePath changedPath; 91 92 private String name; 93 private String path; 94 95 public Event(ISVNLogMessageChangePath changedPath) { 96 this.changedPath = changedPath; 97 name = changedPath.getPath().substring(changedPath.getPath().lastIndexOf('/') + 1); 98 path = changedPath.getPath().substring(0, changedPath.getPath().lastIndexOf('/')); 99 } 100 101 public RepositoryRevision getLogInfoHeader() { 102 return RepositoryRevision.this; 103 } 104 105 public ISVNLogMessageChangePath getChangedPath() { 106 return changedPath; 107 } 108 109 112 public File getFile() { 113 return file; 114 } 115 116 119 public void setFile(File file) { 120 this.file = file; 121 } 122 123 public String getName() { 124 return name; 125 } 126 127 public String getPath() { 128 return path; 129 } 130 131 public String toString() { 132 StringBuffer text = new StringBuffer (); 133 text.append("\t"); 134 text.append(getPath()); 135 return text.toString(); 136 } 137 138 139 } 140 } 141 | Popular Tags |