1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  package net.sf.statcvs.output;
21  
22  import java.util.Set;
23  
24  import net.sf.statcvs.model.Directory;
25  import net.sf.statcvs.model.Revision;
26  import net.sf.statcvs.model.VersionedFile;
27  
28  public class TracIntegration implements WebRepositoryIntegration {
29  
30      private String baseUrl;
31  
32      public TracIntegration(final String baseURL) {
33          if (baseURL.endsWith("/")) {
34              baseUrl = baseURL.substring(0, baseURL.length() - 1);
35          } else {
36              baseUrl = baseURL;
37          }
38      }
39  
40      public String getName() {
41          return "Trac";
42      }
43  
44      public String getDirectoryUrl(final Directory directory) {
45          return baseUrl + "/browser/" + directory.getPath();
46      }
47  
48      public String getFileHistoryUrl(final VersionedFile file) {
49          return baseUrl + "/log/" + file.getFilenameWithPath();
50      }
51  
52      public String getFileViewUrl(final Revision revision) {
53          return baseUrl + "/browser/" + revision.getFile().getFilenameWithPath() + "?rev=" + revision.getRevisionNumber();
54      }
55  
56      public String getBaseUrl() {
57          return baseUrl;
58      }
59  
60      public String getDiffUrl(final Revision oldRevision, final Revision newRevision) {
61          return baseUrl + "/changeset?" + "old=" + oldRevision.getRevisionNumber() + "@" + oldRevision.getFile().getFilenameWithPath() + "&new="
62                  + newRevision.getRevisionNumber() + "@" + newRevision.getFile().getFilenameWithPath();
63      }
64  
65      public String getFileViewUrl(final VersionedFile file) {
66          return baseUrl + "/browser/" + file.getFilenameWithPath();
67      }
68  
69      public void setAtticFileNames(final Set atticFileNames) {
70          
71      }
72  
73  }