mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
Revised the FishEye setting so that Hudson can work with FishEye repositories that only partially mirror a SVN repository.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2660 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
f83b872b07
commit
2eee703c3f
4 files changed
+45
-5
No files matched your search
@@ -31,25 +31,55 @@ public class FishEyeSVN extends SubversionRepositoryBrowser {
|
||||
*/
|
||||
public final URL url;
|
||||
|
||||
/**
|
||||
* Root SVN module name (like 'foo/bar' — normalized to
|
||||
* have no leading nor trailing slash.) Can be empty.
|
||||
*/
|
||||
private final String rootModule;
|
||||
|
||||
/**
|
||||
* @stapler-constructor
|
||||
*/
|
||||
public FishEyeSVN(URL url) throws MalformedURLException {
|
||||
public FishEyeSVN(URL url, String rootModule) throws MalformedURLException {
|
||||
if(!url.toExternalForm().endsWith("/"))
|
||||
url = new URL(url.toExternalForm()+"/");
|
||||
this.url = url;
|
||||
|
||||
// normalize
|
||||
rootModule = rootModule.trim();
|
||||
if(rootModule.startsWith("/"))
|
||||
rootModule = rootModule.substring(1);
|
||||
if(rootModule.endsWith("/"))
|
||||
rootModule = rootModule.substring(0,rootModule.length()-1);
|
||||
|
||||
this.rootModule = rootModule;
|
||||
}
|
||||
|
||||
public String getRootModule() {
|
||||
if(rootModule==null)
|
||||
return ""; // compatibility
|
||||
return rootModule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDiffLink(Path path) throws IOException {
|
||||
int r = path.getLogEntry().getRevision();
|
||||
return new URL(url,trimHeadSlash(path.getValue())+
|
||||
MessageFormat.format("?r1={0}&r2={1}",r-1,r));
|
||||
return new URL(url, getPath(path)+MessageFormat.format("?r1={0}&r2={1}",r-1,r));
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getFileLink(Path path) throws IOException {
|
||||
return new URL(url,trimHeadSlash(path.getValue()));
|
||||
return new URL(url, getPath(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims off the root module portion to compute the path within FishEye.
|
||||
*/
|
||||
private String getPath(Path path) {
|
||||
String s = trimHeadSlash(path.getValue());
|
||||
if(s.startsWith(rootModule)) // this should be always true, but be defensive
|
||||
s = trimHeadSlash(s.substring(rootModule.length()));
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user