Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[FIXED JENKINS-11887] Cleanup code comments, checked successful test …

…execution
  • Loading branch information...
commit c9439100a4f9e8e8ca2fbc330237063797572c0f 1 parent d69d608
authored January 03, 2012
19  src/main/java/hudson/plugins/trac/TracGitRepositoryBrowser.java
@@ -9,7 +9,6 @@
9 9
 import hudson.scm.ChangeLogSet;
10 10
 import hudson.scm.EditType;
11 11
 import hudson.scm.RepositoryBrowser;
12  
-import hudson.scm.SubversionRepositoryBrowser;
13 12
 import hudson.scm.browsers.QueryBuilder;
14 13
 
15 14
 import java.io.IOException;
@@ -19,7 +18,9 @@
19 18
 import org.kohsuke.stapler.DataBoundConstructor;
20 19
 
21 20
 /**
22  
- * {@link SubversionRepositoryBrowser} that produces Trac links.
  21
+ * {@link GitRepositoryBrowser} that produces Trac links.
  22
+ * 
  23
+ *  @author Gerd Zanker (gerd.zanker@web.de)
23 24
  */
24 25
 public class TracGitRepositoryBrowser extends GitRepositoryBrowser {
25 26
     
@@ -48,14 +49,15 @@ protected URL getTracWebURL(GitChangeSet changeSet) throws MalformedURLException
48 49
 
49 50
     @Override
50 51
     public URL getDiffLink(Path path) throws IOException {
51  
-    	// normally the diffs of a changeset are shown on one Trac HTML page and use the pattern 
52  
-    	// <url>"/changeset/"<changesetID>"#file"<NoOfFileInChangeset>
53  
-    	// BUt because the git changeset doesn't return an order list (only a HashSet)
54  
-    	// it is not possible to get correct index for the file inside the changeset
55  
-    	
  52
+    	// Normally the diffs of a changeset are shown on one single Trac HTML page 
  53
+    	// and use the pattern <url>"/changeset/"<changesetID>"#file"<NoOfFileInChangeset>
  54
+    	// But because the git changeset doesn't return an order list (only a HashSet)
  55
+    	// it is not possible to get correct index for the file inside the changeset.
  56
+    	// see https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitChangeSet.java#L57
  57
+    	    	
56 58
     	// Therefore a different URL pattern is used to show only the diff of a single file. 
57 59
     	// returns <url>"/changeset/"<changesetID>/<file>
58  
-    	// The drawback is that the user has to navigate and not only to scroll to see other diffs.
  60
+    	// The drawback is 'only' that the user has to navigate and not only to scroll to see other diffs.
59 61
     	
60 62
     	// Instead of https://fedorahosted.org/eclipse-fedorapackager/changeset/0956859f7db2656cae445488689a214c104bf1b3#file3
61 63
     	// e.g.       https://fedorahosted.org/eclipse-fedorapackager/changeset/0956859f7db2656cae445488689a214c104bf1b3/org.fedoraproject.eclipse.packager.rpm/src/org/fedoraproject/eclipse/packager/rpm/internal/handlers/SRPMImportHandler.java
@@ -65,7 +67,6 @@ public URL getDiffLink(Path path) throws IOException {
65 67
         return null;
66 68
     }
67 69
 
68  
-
69 70
 	@Override
70 71
     public URL getFileLink(Path path) throws IOException {
71 72
     	// returns <url>"/browser/"<file>"$rev="<changsetID>
34  src/test/java/hudson/plugins/trac/TracGitRepositoryBrowserTest.java
@@ -17,6 +17,8 @@
17 17
 import org.xml.sax.SAXException;
18 18
 
19 19
 /**
  20
+ * Tests for TracGitRepositoryBrowser 
  21
+ * 
20 22
  * @author Gerd Zanker (gerd.zanker@web.de)
21 23
  * 
22 24
  * Based on the ViewGetWeb code from
@@ -24,9 +26,17 @@
24 26
  */
25 27
 public class TracGitRepositoryBrowserTest extends TestCase {
26 28
 
  29
+	/** 
  30
+	 * URL used for testing
  31
+	 */
27 32
 	private static final String TRAC_URL = "https://trac";
28  
-    private final TracGitRepositoryBrowser tracGitBrowser = new TracGitRepositoryBrowserMock();
29  
-
  33
+	
  34
+    /**
  35
+     * TracGitRepositoryBrowser instance used for testing.
  36
+     * The getTracWebURL function is mocked to easily return the testing URL. 
  37
+     */
  38
+	private final TracGitRepositoryBrowser tracGitBrowser = new TracGitRepositoryBrowserMock();
  39
+    
30 40
     /**
31 41
      * Mock implementation to return the test URL.
32 42
      */
@@ -57,8 +67,7 @@ public void testGetChangeSetLinkGitChangeSet() throws IOException, SAXException
57 67
     /**
58 68
      * Test method for
59 69
      * {@link hudson.plugins.git.browser.TracGitBrowser#getDiffLink(hudson.plugins.git.GitChangeSet.Path)}.
60  
-     * Test cases where links are tested, leading to the same changeset page as above, but using anchors.
61  
-     * The anchors are the diff sections for each file inside the changeset.
  70
+     * Test cases where links are tested, leading to the diff of the file from the same changeset page as above.
62 71
      * 
63 72
      * @throws SAXException
64 73
      * @throws IOException
@@ -123,7 +132,14 @@ public void testGetFileLinkPathForDeletedFile() throws IOException, SAXException
123 132
     }
124 133
     
125 134
     
126  
-
  135
+    /**
  136
+     * Helper to create a changeset for testing.
  137
+     * 
  138
+     * @param rawchangelogpath
  139
+     * @return
  140
+     * @throws IOException
  141
+     * @throws SAXException
  142
+     */
127 143
     private GitChangeSet createChangeSet(String rawchangelogpath) throws IOException, SAXException {
128 144
         final File rawchangelog = new File(TracGitRepositoryBrowserTest.class.getResource(rawchangelogpath).getFile());
129 145
         final GitChangeLogParser logParser = new GitChangeLogParser(false);
@@ -132,6 +148,14 @@ private GitChangeSet createChangeSet(String rawchangelogpath) throws IOException
132 148
     }
133 149
 
134 150
 
  151
+    /**
  152
+     * Helper to create a map of paths.
  153
+     * 
  154
+     * @param changelog
  155
+     * @return
  156
+     * @throws IOException
  157
+     * @throws SAXException
  158
+     */
135 159
     private HashMap<String, Path> createPathMap(final String changelog) throws IOException, SAXException {
136 160
         final HashMap<String, Path> pathMap = new HashMap<String, Path>();
137 161
         final Collection<Path> changeSet = createChangeSet(changelog).getPaths();

0 notes on commit c943910

Please sign in to comment.
Something went wrong with that request. Please try again.