Skip to content
Permalink
Browse files

Merge pull request #224 from Joibel/master

[Fixed JENKINS-22342] ensure URL normalization correct, retain compatibility
  • Loading branch information
MarkEWaite committed Apr 12, 2014
2 parents 743d715 + a84e48a commit 737e25272e598fa3786ab2dd961cbcf0ebe2eceb
@@ -24,7 +24,6 @@
@DataBoundConstructor
public BitbucketWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -25,7 +25,6 @@
@DataBoundConstructor
public CGit(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -25,10 +25,9 @@
private static final long serialVersionUID = 2881872624557203410L;

@DataBoundConstructor
public FisheyeGitRepositoryBrowser(String repoUrl) {
public FisheyeGitRepositoryBrowser(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}
}

@Override
public URL getDiffLink(Path path) throws IOException {
@@ -30,7 +30,6 @@
public GitBlitRepositoryBrowser(String repoUrl, String projectName) {
super(repoUrl);
this.projectName = projectName;
this.normalizeUrl = true;
}

@Override
@@ -27,7 +27,6 @@
public GitLab(String repoUrl, String version) {
super(repoUrl);
this.version = Double.valueOf(version);
this.normalizeUrl = true;
}

public double getVersion() {
@@ -51,9 +50,9 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {

/**
* Creates a link to the commit diff.
*
*
* https://[GitLab URL]/commits/a9182a07750c9a0dfd89a8461adf72ef5ef0885b#[path to file]
*
*
* @param path
* @return diff link
* @throws IOException
@@ -67,7 +66,7 @@ public URL getDiffLink(Path path) throws IOException {
/**
* Creates a link to the file.
* https://[GitLab URL]/a9182a07750c9a0dfd89a8461adf72ef5ef0885b/tree/pom.xml
*
*
* @param path
* @return file link
* @throws IOException
@@ -106,6 +105,6 @@ private String calculatePrefix() {
}

return "commits/";
}
}

}
@@ -14,7 +14,6 @@
public abstract class GitRepositoryBrowser extends RepositoryBrowser<GitChangeSet> {

private /* mostly final */ String url;
protected boolean normalizeUrl;

@Deprecated
protected GitRepositoryBrowser() {
@@ -44,7 +43,7 @@ public final URL getUrl() throws IOException {
}
}

if (normalizeUrl) {
if (getNormalizeUrl()) {
return normalizeToEndWithSlash(new URL(u));
}
else {
@@ -62,7 +61,7 @@ public final URL getUrl() throws IOException {
* @throws IOException
*/
public abstract URL getDiffLink(GitChangeSet.Path path) throws IOException;

/**
* Determines the link to a single file under Git.
* This page should display all the past revisions of this file, etc.
@@ -74,5 +73,15 @@ public final URL getUrl() throws IOException {
*/
public abstract URL getFileLink(GitChangeSet.Path path) throws IOException;

/**
* Determines whether a URL should be normalized
* Overridden in the rare case where it shouldn't
*
* @return True if the URL should be normalized
*/
protected boolean getNormalizeUrl() {
return true;
}

private static final long serialVersionUID = 1L;
}
@@ -25,7 +25,11 @@
@DataBoundConstructor
public GitWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = false;
}

@Override
protected boolean getNormalizeUrl() {
return false;
}

@Override
@@ -33,7 +33,6 @@
@DataBoundConstructor
public GithubWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -24,7 +24,6 @@
@DataBoundConstructor
public GitoriousWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -34,9 +33,9 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {

/**
* Creates a link to the commit diff.
*
*
* https://[Gitorious URL]/commit/a9182a07750c9a0dfd89a8461adf72ef5ef0885b/diffs?diffmode=sidebyside&fragment=1#[path to file]
*
*
* @param path
* @return diff link
* @throws IOException
@@ -50,7 +49,7 @@ public URL getDiffLink(Path path) throws IOException {
/**
* Creates a link to the file.
* https://[Gitorious URL]/blobs/a9182a07750c9a0dfd89a8461adf72ef5ef0885b/pom.xml
*
*
* @param path
* @return file link
* @throws IOException
@@ -26,7 +26,6 @@
@DataBoundConstructor
public KilnGit(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -27,7 +27,6 @@
public Phabricator(String repoUrl, String repo) {
super(repoUrl);
this.repo = repo;
this.normalizeUrl = true;
}

public String getRepo() {
@@ -16,7 +16,7 @@

/**
* Git Browser for <a href="http://www.redmine.org/">Redmine</a>.
*
*
* @author mfriedenhagen
*/
public class RedmineWeb extends GitRepositoryBrowser {
@@ -26,7 +26,6 @@
@DataBoundConstructor
public RedmineWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -37,9 +36,9 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {

/**
* Creates a link to the file diff.
*
*
* https://SERVER/PATH/projects/PROJECT/repository/revisions/a9182a07750c9a0dfd89a8461adf72ef5ef0885b/diff/pom.xml
*
*
* Returns a diff link for {@link EditType#DELETE} and {@link EditType#EDIT}, for {@link EditType#ADD} returns an
* {@link #getFileLink}.
*
@@ -67,7 +66,7 @@ public URL getDiffLink(Path path) throws IOException {
* Creates a link to the file.
* https://SERVER/PATH/projects/PROJECT/repository/revisions/a9182a07750c9a0dfd89a8461adf72ef5ef0885b/entry/pom.xml
* For deleted files just returns a diff link, which will have /dev/null as target file.
*
*
* @param path
* file
* @return file link
@@ -25,7 +25,6 @@
@DataBoundConstructor
public RhodeCode(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -25,7 +25,6 @@
@DataBoundConstructor
public Stash(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -31,7 +31,6 @@
public ViewGitWeb(String repoUrl, String projectName) {
super(repoUrl);
this.projectName = projectName;
this.normalizeUrl = true;
}

@Override

0 comments on commit 737e252

Please sign in to comment.
You can’t perform that action at this time.