From 12e56b46d8a246f8bfb1e3206cadf9aaf8f919b9 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 4 Jun 2012 13:59:52 +0200 Subject: [PATCH 001/159] added options to disable ssl verification --- .../main/java/sonia/scm/net/HttpRequest.java | 60 ++++++++++++- .../scm/net/TrustAllHostnameVerifier.java | 60 +++++++++++++ .../sonia/scm/net/TrustAllTrustManager.java | 87 +++++++++++++++++++ .../java/sonia/scm/net/URLHttpClient.java | 42 +++++++++ 4 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java create mode 100644 scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java diff --git a/scm-core/src/main/java/sonia/scm/net/HttpRequest.java b/scm-core/src/main/java/sonia/scm/net/HttpRequest.java index 588e4dd111..ff4989e1a2 100644 --- a/scm-core/src/main/java/sonia/scm/net/HttpRequest.java +++ b/scm-core/src/main/java/sonia/scm/net/HttpRequest.java @@ -174,7 +174,7 @@ public class HttpRequest * * * @return - * + * * @since 1.14 */ public boolean isDecodeGZip() @@ -182,6 +182,30 @@ public class HttpRequest return decodeGZip; } + /** + * Method description + * + * + * @return + * @since 1.17 + */ + public boolean isDisableCertificateValidation() + { + return disableCertificateValidation; + } + + /** + * Method description + * + * + * @return + * @since 1.17 + */ + public boolean isDisableHostnameValidation() + { + return disableHostnameValidation; + } + //~--- set methods ---------------------------------------------------------- /** @@ -208,15 +232,41 @@ public class HttpRequest * @param decodeGZip * * @return - * + * * @since 1.14 */ public HttpRequest setDecodeGZip(boolean decodeGZip) { this.decodeGZip = decodeGZip; + return this; } + /** + * Method description + * + * + * @param disableCertificateValidation + * @since 1.17 + */ + public void setDisableCertificateValidation( + boolean disableCertificateValidation) + { + this.disableCertificateValidation = disableCertificateValidation; + } + + /** + * Method description + * + * + * @param disableHostnameValidation + * @since 1.17 + */ + public void setDisableHostnameValidation(boolean disableHostnameValidation) + { + this.disableHostnameValidation = disableHostnameValidation; + } + /** * Method description * @@ -276,6 +326,12 @@ public class HttpRequest //~--- fields --------------------------------------------------------------- + /** Field description */ + private boolean disableHostnameValidation = false; + + /** Field description */ + private boolean disableCertificateValidation = false; + /** Field description */ private boolean decodeGZip = false; diff --git a/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java b/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java new file mode 100644 index 0000000000..437216a3ca --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.net; + +//~--- JDK imports ------------------------------------------------------------ + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; + +/** + * + * @author Sebastian Sdorra + */ +public class TrustAllHostnameVerifier implements HostnameVerifier +{ + + /** + * Method description + * + * + * @param hostname + * @param session + * + * @return + */ + @Override + public boolean verify(String hostname, SSLSession session) + { + return true; + } +} diff --git a/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java b/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java new file mode 100644 index 0000000000..7f89682d30 --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.net; + +//~--- JDK imports ------------------------------------------------------------ + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.X509TrustManager; + +/** + * + * @author Sebastian Sdorra + */ +public class TrustAllTrustManager implements X509TrustManager +{ + + /** + * Method description + * + * + * @param chain + * @param authType + * + * @throws CertificateException + */ + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException {} + + /** + * Method description + * + * + * @param chain + * @param authType + * + * @throws CertificateException + */ + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException {} + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public X509Certificate[] getAcceptedIssuers() + { + return null; + } +} diff --git a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java index 3fecc05d91..62c2e67c0e 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java +++ b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java @@ -64,6 +64,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; + /** * * @author Sebastian Sdorra @@ -383,6 +387,39 @@ public class URLHttpClient implements HttpClient } } + /** + * Method description + * + * + * @param request + * @param connection + */ + private void applySSLSettings(HttpRequest request, + HttpsURLConnection connection) + { + if (request.isDisableCertificateValidation()) + { + try + { + TrustManager[] trustAllCerts = new TrustManager[] { + new TrustAllTrustManager() }; + SSLContext sc = SSLContext.getInstance("SSL"); + + sc.init(null, trustAllCerts, new java.security.SecureRandom()); + connection.setSSLSocketFactory(sc.getSocketFactory()); + } + catch (Exception ex) + { + logger.error("could not disable certificate validation", ex); + } + } + + if (request.isDisableHostnameValidation()) + { + connection.setHostnameVerifier(new TrustAllHostnameVerifier()); + } + } + /** * Method description * @@ -514,6 +551,11 @@ public class URLHttpClient implements HttpClient connection = (HttpURLConnection) url.openConnection(); } + if (connection instanceof HttpsURLConnection) + { + applySSLSettings(request, (HttpsURLConnection) connection); + } + connection.setReadTimeout(TIMEOUT_RAED); connection.setConnectTimeout(TIMEOUT_CONNECTION); From 715ceedf360891d7bc636bc5d597db635b7161cd Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 4 Jun 2012 14:01:58 +0200 Subject: [PATCH 002/159] added option to ignore proxy settings --- .../main/java/sonia/scm/net/HttpRequest.java | 33 +++++++++++++++++-- .../java/sonia/scm/net/URLHttpClient.java | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/net/HttpRequest.java b/scm-core/src/main/java/sonia/scm/net/HttpRequest.java index ff4989e1a2..68c391c646 100644 --- a/scm-core/src/main/java/sonia/scm/net/HttpRequest.java +++ b/scm-core/src/main/java/sonia/scm/net/HttpRequest.java @@ -206,6 +206,18 @@ public class HttpRequest return disableHostnameValidation; } + /** + * Method description + * + * + * @return + * @since 1.17 + */ + public boolean isIgnoreProxySettings() + { + return ignoreProxySettings; + } + //~--- set methods ---------------------------------------------------------- /** @@ -282,6 +294,18 @@ public class HttpRequest return this; } + /** + * Method description + * + * + * @param ignoreProxySettings + * @since 1.17 + */ + public void setIgnoreProxySettings(boolean ignoreProxySettings) + { + this.ignoreProxySettings = ignoreProxySettings; + } + /** * Method description * @@ -326,6 +350,12 @@ public class HttpRequest //~--- fields --------------------------------------------------------------- + /** Field description */ + private Map> headers; + + /** Field description */ + private boolean ignoreProxySettings = false; + /** Field description */ private boolean disableHostnameValidation = false; @@ -335,9 +365,6 @@ public class HttpRequest /** Field description */ private boolean decodeGZip = false; - /** Field description */ - private Map> headers; - /** Field description */ private Map> parameters; diff --git a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java index 62c2e67c0e..0d623fae4a 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java +++ b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java @@ -523,7 +523,7 @@ public class URLHttpClient implements HttpClient { HttpURLConnection connection = null; - if (configuration.isEnableProxy()) + if (!request.isIgnoreProxySettings() && configuration.isEnableProxy()) { if (logger.isDebugEnabled()) { From ade02c31c55da85a6a36fb2a41145bcb445e9709 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 4 Jun 2012 14:06:30 +0200 Subject: [PATCH 003/159] disable ssl validation for mercurial hook detection --- .../sonia/scm/repository/HgHookManager.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgHookManager.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgHookManager.java index 818bcf5a20..795e01c22b 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgHookManager.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgHookManager.java @@ -36,6 +36,7 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- import com.google.inject.Inject; +import com.google.inject.Provider; import com.google.inject.Singleton; import org.slf4j.Logger; @@ -43,6 +44,9 @@ import org.slf4j.LoggerFactory; import sonia.scm.ConfigChangedListener; import sonia.scm.config.ScmConfiguration; +import sonia.scm.net.HttpClient; +import sonia.scm.net.HttpRequest; +import sonia.scm.net.HttpResponse; import sonia.scm.util.HttpUtil; import sonia.scm.util.Util; @@ -81,12 +85,15 @@ public class HgHookManager implements ConfigChangedListener * * * @param configuration + * @param httpClientProvider */ @Inject - public HgHookManager(ScmConfiguration configuration) + public HgHookManager(ScmConfiguration configuration, + Provider httpClientProvider) { this.configuration = configuration; this.configuration.addListener(this); + this.httpClientProvider = httpClientProvider; } //~--- methods -------------------------------------------------------------- @@ -292,10 +299,15 @@ public class HgHookManager implements ConfigChangedListener logger.trace("check hook url {}", url); } - HttpURLConnection connection = - (HttpURLConnection) new URL(url).openConnection(); + HttpRequest request = new HttpRequest(url); - result = connection.getResponseCode() == 204; + request.setDisableCertificateValidation(true); + request.setDisableHostnameValidation(true); + request.setIgnoreProxySettings(true); + + HttpResponse response = httpClientProvider.get().get(request); + + result = response.getStatusCode() == 204; } catch (IOException ex) { @@ -318,4 +330,7 @@ public class HgHookManager implements ConfigChangedListener /** Field description */ private volatile String hookUrl; + + /** Field description */ + private Provider httpClientProvider; } From 33a0fdf52f09a4b851618ad84b1299681703a5a5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 4 Jun 2012 14:08:44 +0200 Subject: [PATCH 004/159] improve logging for new httpclient options --- .../main/java/sonia/scm/net/URLHttpClient.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java index 0d623fae4a..5f62f20e49 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java +++ b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java @@ -399,6 +399,11 @@ public class URLHttpClient implements HttpClient { if (request.isDisableCertificateValidation()) { + if (logger.isTraceEnabled()) + { + logger.trace("disable certificate validation"); + } + try { TrustManager[] trustAllCerts = new TrustManager[] { @@ -416,6 +421,11 @@ public class URLHttpClient implements HttpClient if (request.isDisableHostnameValidation()) { + if (logger.isTraceEnabled()) + { + logger.trace("disable hostname validation"); + } + connection.setHostnameVerifier(new TrustAllHostnameVerifier()); } } @@ -543,6 +553,11 @@ public class URLHttpClient implements HttpClient } else { + if (request.isIgnoreProxySettings() && logger.isTraceEnabled()) + { + logger.trace("ignore proxy settings"); + } + if (logger.isDebugEnabled()) { logger.debug("fetch '{}'", url.toExternalForm()); From 586702b8cb66d8fd0ff38157284a710335a51158 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 4 Jun 2012 16:25:50 +0200 Subject: [PATCH 005/159] close branch issue-170 From d3976c861cdfce7fa0e2699f8061274815819ef1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 6 Jun 2012 14:59:31 +0200 Subject: [PATCH 006/159] fix mercurial import with non valid mail address in contact field --- .../sonia/scm/repository/HgImportHandler.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgImportHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgImportHandler.java index 2d85ea7bf2..30b5063c11 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgImportHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgImportHandler.java @@ -30,14 +30,19 @@ */ + package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.io.INIConfiguration; import sonia.scm.io.INIConfigurationReader; import sonia.scm.io.INIConfigurationWriter; import sonia.scm.io.INISection; +import sonia.scm.util.ValidationUtil; //~--- JDK imports ------------------------------------------------------------ @@ -54,6 +59,12 @@ public class HgImportHandler extends AbstactImportHandler /** Field description */ public static final String HG_DIR = ".hg"; + /** + * the logger for HgImportHandler + */ + private static final Logger logger = + LoggerFactory.getLogger(HgImportHandler.class); + //~--- constructors --------------------------------------------------------- /** @@ -103,10 +114,21 @@ public class HgImportHandler extends AbstactImportHandler else { repository.setDescription(web.getParameter("description")); - repository.setContact(web.getParameter("contact")); + + String contact = web.getParameter("contact"); + + if (ValidationUtil.isMailAddressValid(contact)) + { + repository.setContact(contact); + } + else if (logger.isWarnEnabled()) + { + logger.warn("contact {} is not a valid mail address", contact); + } + handler.setWebParameter(web); } - + // issue-97 handler.registerMissingHook(c, repositoryName); From 9092ead5624c171a9d91cca25f6886ca40a28982 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 7 Jun 2012 09:59:58 +0200 Subject: [PATCH 007/159] close branch issue-173 From a3f2028ae65479ac9eca00f5e502c79bb834180f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 9 Jun 2012 11:47:42 +0200 Subject: [PATCH 008/159] update slf4j to version 1.6.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index db1bb49860..8138550468 100644 --- a/pom.xml +++ b/pom.xml @@ -390,7 +390,7 @@ 4.10 - 1.6.4 + 1.6.5 1.0.4 2.5 From ac0c0fb44ce11e3e960a44b1a6b5edfbeacea8e1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 12:43:52 +0200 Subject: [PATCH 009/159] fix license headers --- .../sonia/scm/filter/GZipFilterConfig.java | 33 ++++++++++--------- .../src/main/java/sonia/scm/i18n/Bundle.java | 33 ++++++++++--------- .../java/sonia/scm/repository/EscapeUtil.java | 33 ++++++++++--------- .../repository/RepositoryTypePredicate.java | 33 ++++++++++--------- .../scm/resources/ResourceNameComparator.java | 33 ++++++++++--------- .../scm/store/AbstractListenableStore.java | 33 ++++++++++--------- .../java/sonia/scm/store/ListenableStore.java | 33 ++++++++++--------- .../scm/store/ListenableStoreFactory.java | 33 ++++++++++--------- .../scm/web/cgi/CGIStatusCodeHandler.java | 33 ++++++++++--------- .../test/java/sonia/scm/util/IOUtilTest.java | 33 ++++++++++--------- 10 files changed, 170 insertions(+), 160 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/filter/GZipFilterConfig.java b/scm-core/src/main/java/sonia/scm/filter/GZipFilterConfig.java index 047a56c4e4..1132ff1259 100644 --- a/scm-core/src/main/java/sonia/scm/filter/GZipFilterConfig.java +++ b/scm-core/src/main/java/sonia/scm/filter/GZipFilterConfig.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.filter; /** diff --git a/scm-core/src/main/java/sonia/scm/i18n/Bundle.java b/scm-core/src/main/java/sonia/scm/i18n/Bundle.java index 9523948cd7..be349fddb7 100644 --- a/scm-core/src/main/java/sonia/scm/i18n/Bundle.java +++ b/scm-core/src/main/java/sonia/scm/i18n/Bundle.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.i18n; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java b/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java index 291bd4a553..e3d41c4f1c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryTypePredicate.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryTypePredicate.java index 7b6eb0b302..ac7d389a60 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryTypePredicate.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryTypePredicate.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/resources/ResourceNameComparator.java b/scm-core/src/main/java/sonia/scm/resources/ResourceNameComparator.java index 720c374c3e..bd3cbb4960 100644 --- a/scm-core/src/main/java/sonia/scm/resources/ResourceNameComparator.java +++ b/scm-core/src/main/java/sonia/scm/resources/ResourceNameComparator.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.resources; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/store/AbstractListenableStore.java b/scm-core/src/main/java/sonia/scm/store/AbstractListenableStore.java index c31ec49e08..b7263b2f17 100644 --- a/scm-core/src/main/java/sonia/scm/store/AbstractListenableStore.java +++ b/scm-core/src/main/java/sonia/scm/store/AbstractListenableStore.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.store; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/store/ListenableStore.java b/scm-core/src/main/java/sonia/scm/store/ListenableStore.java index 36c9364e76..026f3dc644 100644 --- a/scm-core/src/main/java/sonia/scm/store/ListenableStore.java +++ b/scm-core/src/main/java/sonia/scm/store/ListenableStore.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.store; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/store/ListenableStoreFactory.java b/scm-core/src/main/java/sonia/scm/store/ListenableStoreFactory.java index 0fee1b62ae..abc67352b3 100644 --- a/scm-core/src/main/java/sonia/scm/store/ListenableStoreFactory.java +++ b/scm-core/src/main/java/sonia/scm/store/ListenableStoreFactory.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.store; /** diff --git a/scm-core/src/main/java/sonia/scm/web/cgi/CGIStatusCodeHandler.java b/scm-core/src/main/java/sonia/scm/web/cgi/CGIStatusCodeHandler.java index 5efb6fe1e1..d0f8418517 100644 --- a/scm-core/src/main/java/sonia/scm/web/cgi/CGIStatusCodeHandler.java +++ b/scm-core/src/main/java/sonia/scm/web/cgi/CGIStatusCodeHandler.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.web.cgi; //~--- JDK imports ------------------------------------------------------------ diff --git a/scm-core/src/test/java/sonia/scm/util/IOUtilTest.java b/scm-core/src/test/java/sonia/scm/util/IOUtilTest.java index 675fb68b23..d35aab1506 100644 --- a/scm-core/src/test/java/sonia/scm/util/IOUtilTest.java +++ b/scm-core/src/test/java/sonia/scm/util/IOUtilTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.util; //~--- non-JDK imports -------------------------------------------------------- From 8961e652ba984a0c349f74b577b60c9fde6aa752 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 12:59:17 +0200 Subject: [PATCH 010/159] initial import of new repository api and spi --- .../repository/api/BlameCommandBuilder.java | 270 +++++++++++ .../repository/api/BrowseCommandBuilder.java | 270 +++++++++++ .../scm/repository/api/CatCommandBuilder.java | 173 +++++++ .../sonia/scm/repository/api/Command.java | 45 ++ .../api/CommandNotSupportedException.java | 93 ++++ .../repository/api/DiffCommandBuilder.java | 173 +++++++ .../scm/repository/api/LogCommandBuilder.java | 451 ++++++++++++++++++ .../scm/repository/api/RepositoryService.java | 165 +++++++ .../api/RepositoryServiceFactory.java | 228 +++++++++ .../RepositoryServiceNotFoundException.java | 80 ++++ .../scm/repository/api/package-info.java | 37 ++ .../scm/repository/spi/BlameCommand.java | 57 +++ .../repository/spi/BlameCommandRequest.java | 68 +++ .../scm/repository/spi/BrowseCommand.java | 57 +++ .../repository/spi/BrowseCommandRequest.java | 46 ++ .../sonia/scm/repository/spi/CatCommand.java | 56 +++ .../scm/repository/spi/CatCommandRequest.java | 69 +++ .../sonia/scm/repository/spi/DiffCommand.java | 56 +++ .../repository/spi/DiffCommandRequest.java | 90 ++++ .../spi/FileBaseCommandRequest.java | 174 +++++++ .../sonia/scm/repository/spi/LogCommand.java | 68 +++ .../scm/repository/spi/LogCommandRequest.java | 326 +++++++++++++ .../spi/RepositoryServiceProvider.java | 115 +++++ .../spi/RepositoryServiceResolver.java | 59 +++ .../sonia/scm/repository/spi/Resetable.java | 49 ++ .../scm/repository/spi/package-info.java | 37 ++ 26 files changed, 3312 insertions(+) create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/Command.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/package-info.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/package-info.java diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java new file mode 100644 index 0000000000..a6916754ce --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -0,0 +1,270 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; + +import sonia.scm.cache.Cache; +import sonia.scm.cache.CacheManager; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.Repository; +import sonia.scm.repository.spi.BlameCommand; +import sonia.scm.repository.spi.BlameCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * Shows changeset information by line for a given file. + * Blame is also known as annotate in some SCM systems. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class BlameCommandBuilder +{ + + /** name of the cache */ + private static final String CACHE_NAME = "sonia.scm.cache.blame"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs a new {@link BlameCommandBuilder}, this constructor should + * only be called from the {@link RepositoryService}. + * + * @param cacheManager cache manager + * @param blameCommand implementation of the {@link BlameCommand} + * @param repository repository to query + */ + BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand, + Repository repository) + { + this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class, + CACHE_NAME); + this.blameCommand = blameCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Reset each parameter to its default value. + * + * @return {@code this} + */ + public BlameCommandBuilder reset() + { + request.reset(); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns changeset informations by line for the given file. + * + * @param path path of the file + * @return changeset informations by line for the given file + * + * @throws IllegalArgumentException if the path is null or empty + */ + public BlameResult getBlameResult(String path) + { + Preconditions.checkArgument(!Strings.isNullOrEmpty(path), + "path is required"); + + BlameCommandRequest requestClone = request.clone(); + + requestClone.setPath(path); + + BlameResult result = null; + + if (disableCache) + { + result = blameCommand.getBlameResult(requestClone); + } + else + { + CacheKey key = new CacheKey(repository, request); + + result = cache.get(key); + + if (result == null) + { + result = blameCommand.getBlameResult(requestClone); + + if (result != null) + { + cache.put(key, result); + } + } + } + + return result; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Disables the cache. This means that every {@link BlameResult} + * is directly retrieved from the {@link Repository}. Note: Disabling + * the cache cost a lot of performance and could be much more slower. + * + * + * @param disableCache true to disable the cache + * + * @return {@code this} + */ + public BlameCommandBuilder setDisableCache(boolean disableCache) + { + this.disableCache = disableCache; + + return this; + } + + /** + * Sets the start revision for the blame. + * + * + * @param revision revision to start from + * + * @return {@code this} + */ + public BlameCommandBuilder setRevision(String revision) + { + request.setRevision(revision); + + return this; + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Key for cache. + * + * + * @version Enter version here..., 12/06/05 + * @author Enter your name here... + */ + private static class CacheKey implements Serializable + { + + /** + * Constructs ... + * + * + * @param repository + * @param request + */ + public CacheKey(Repository repository, BlameCommandRequest request) + { + this.repositoryId = repository.getId(); + this.request = request; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final CacheKey other = (CacheKey) obj; + + return Objects.equal(repositoryId, other.repositoryId) + && Objects.equal(request, other.request); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(repositoryId, request); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private String repositoryId; + + /** Field description */ + private BlameCommandRequest request; + } + + + //~--- fields --------------------------------------------------------------- + + /** implementation of the blame command */ + private BlameCommand blameCommand; + + /** the cache */ + private Cache cache; + + /** disable change */ + private boolean disableCache; + + /** the repository */ + private Repository repository; + + /** request for the blame command implementation */ + private BlameCommandRequest request = new BlameCommandRequest(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java new file mode 100644 index 0000000000..73aeb4f611 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -0,0 +1,270 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; + +import sonia.scm.cache.Cache; +import sonia.scm.cache.CacheManager; +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.Repository; +import sonia.scm.repository.spi.BrowseCommand; +import sonia.scm.repository.spi.BrowseCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * BrowseCommandBuilder is able to browse the files of a {@link Repository}. + * + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class BrowseCommandBuilder +{ + + /** Name of the cache */ + private static final String CACHE_NAME = "sonia.scm.cache.browse"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs a new {@link LogCommandBuilder}, this constructor should + * only be called from the {@link RepositoryService}. + * + * @param cacheManager cache manager + * @param logCommand implementation of the {@link LogCommand} + * @param browseCommand + * @param repository repository to query + */ + BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand, + Repository repository) + { + this.cache = cacheManager.getCache(CacheKey.class, BrowserResult.class, + CACHE_NAME); + this.browseCommand = browseCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Reset each parameter to its default value. + * + * + * @return {@code this} + */ + public BrowseCommandBuilder reset() + { + request.reset(); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Return the files for the given parameters. + * + * + * @return files for the given parameters + */ + public BrowserResult getBrowserResult() + { + BrowserResult result = null; + + if (disableCache) + { + result = browseCommand.getBrowserResult(request); + } + else + { + CacheKey key = new CacheKey(repository, request); + + result = cache.get(key); + + if (result != null) + { + cache.put(key, result); + } + } + + return result; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Disables the cache. This means that every {@link BrowserResult} + * is directly retrieved from the {@link Repository}. Note: Disabling + * the cache cost a lot of performance and could be much more slower. + * + * + * @param disableCache true to disable the cache + * + * @return {@code this} + */ + public BrowseCommandBuilder setDisableCache(boolean disableCache) + { + this.disableCache = disableCache; + + return this; + } + + /** + * Retrieve only files which are children of the given path. + * This path have to be a directory. + * + * @param path path of the folder + * + * @return {@code this} + */ + public BrowseCommandBuilder setPath(String path) + { + request.setPath(path); + + return this; + } + + /** + * Retrieve only files of the given revision. + * + * @param revision revision for the files + * + * @return {@code this} + */ + public BrowseCommandBuilder setRevision(String revision) + { + request.setRevision(revision); + + return this; + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Key for cache. + * + * + * @version Enter version here..., 12/06/05 + * @author Enter your name here... + */ + private static class CacheKey implements Serializable + { + + /** + * Constructs ... + * + * + * @param repository + * @param request + */ + public CacheKey(Repository repository, BrowseCommandRequest request) + { + this.repositoryId = repository.getId(); + this.request = request; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final CacheKey other = (CacheKey) obj; + + return Objects.equal(repositoryId, other.repositoryId) + && Objects.equal(request, other.request); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(repositoryId, request); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private String repositoryId; + + /** Field description */ + private BrowseCommandRequest request; + } + + + //~--- fields --------------------------------------------------------------- + + /** implementation of the browse command */ + private BrowseCommand browseCommand; + + /** cache */ + private Cache cache; + + /** disables the cache */ + private boolean disableCache; + + /** the repsitory */ + private Repository repository; + + /** request for the command */ + private BrowseCommandRequest request = new BrowseCommandRequest(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java new file mode 100644 index 0000000000..e066e38357 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; +import com.google.common.io.Closeables; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.spi.CatCommand; +import sonia.scm.repository.spi.CatCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +/** + * Shows the content of a file in the {@link Repository}. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class CatCommandBuilder +{ + + /** + * Constructs a new {@link CatCommandBuilder}, this constructor should + * only be called from the {@link RepositoryService}. + * + * @param catCommand implementation of the {@link CatCommand} + */ + CatCommandBuilder(CatCommand catCommand) + { + this.catCommand = catCommand; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Reset each parameter to its default value. + * + * @return {@code this} + */ + public CatCommandBuilder reset() + { + request.reset(); + + return this; + } + + /** + * Passes the content of the given file to the outputstream. + * + * @param outputStream outputstream for the content + * @param path file path + * + * @return {@code this} + */ + public CatCommandBuilder retriveContent(OutputStream outputStream, + String path) + { + getCatResult(outputStream, path); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the content of the given file. + * + * @param path file path + * @return content of the file + */ + public String getContent(String path) + { + String content = null; + ByteArrayOutputStream baos = null; + + try + { + baos = new ByteArrayOutputStream(); + getCatResult(baos, path); + content = baos.toString(); + } + finally + { + Closeables.closeQuietly(baos); + } + + return content; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Sets the revision of the file. + * + * + * @param revision revision of the file + * + * @return {@code this} + */ + public CatCommandBuilder setRevision(String revision) + { + request.setRevision(revision); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Executes the cat command. + * + * + * @param outputStream the outputstream for the content + * @param path path of the file + */ + private void getCatResult(OutputStream outputStream, String path) + { + Preconditions.checkNotNull(outputStream, "OutputStream is required"); + Preconditions.checkArgument(!Strings.isNullOrEmpty(path), + "path is required"); + + CatCommandRequest requestClone = request.clone(); + + requestClone.setPath(path); + catCommand.getCatResult(requestClone, outputStream); + } + + //~--- fields --------------------------------------------------------------- + + /** implementation of the cat command */ + private CatCommand catCommand; + + /** request for the cat command */ + private CatCommandRequest request = new CatCommandRequest(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/Command.java b/scm-core/src/main/java/sonia/scm/repository/api/Command.java new file mode 100644 index 0000000000..5caba59440 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/Command.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +/** + * Enumeration of available commands. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public enum Command +{ + LOG, BROWSE, CAT, DIFF, BLAME +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java new file mode 100644 index 0000000000..ddf1cc7b21 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +/** + * This exception is thrown if the {@link RepositoryService} does not support + * the requested command. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class CommandNotSupportedException extends RuntimeException +{ + + /** + * Constructs a new {@link CommandNotSupportedException}. + * + * + * @param command not supported command + */ + public CommandNotSupportedException(Command command) + { + //J- + this( + command, + "The requested feature " + .concat(command.toString()) + .concat(" is not supported") + ); + //J+ + } + + /** + * Constructs a new {@link CommandNotSupportedException}. + * + * + * @param command not supported command + * @param message message to be shown + */ + public CommandNotSupportedException(Command command, String message) + { + super(message); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the command which is not supported. + * + * + * @return not supported command + */ + public Command getCommand() + { + return command; + } + + //~--- fields --------------------------------------------------------------- + + /** not supported command */ + private Command command; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java new file mode 100644 index 0000000000..e1f54ef7e5 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Preconditions; +import com.google.common.io.Closeables; + +import sonia.scm.repository.spi.DiffCommand; +import sonia.scm.repository.spi.DiffCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +/** + * Shows differences between revisions for a specified file or + * the entire revision.
+ * Note: One of the parameter path or revision have to be set. + * TODO check current behavior. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class DiffCommandBuilder +{ + + /** + * Constructs a new {@link DiffCommandBuilder}, this constructor should + * only be called from the {@link RepositoryService}. + * + * @param implementation of {@link DiffCommand} + * + * @param diffCommand + */ + DiffCommandBuilder(DiffCommand diffCommand) + { + this.diffCommand = diffCommand; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Passes the difference of the given parameter to the outputstream. + * + * + * @param outputStream outputstream for the difference + * + * @return {@code this} + */ + public DiffCommandBuilder retriveContent(OutputStream outputStream) + { + getDiffResult(outputStream); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the content of the difference as string. + * + * @return content of the difference + */ + public String getContent() + { + String content = null; + ByteArrayOutputStream baos = null; + + try + { + baos = new ByteArrayOutputStream(); + getDiffResult(baos); + content = baos.toString(); + } + finally + { + Closeables.closeQuietly(baos); + } + + return content; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Show the difference only for the given path. + * + * + * @param path path for difference + * + * @return {@code this} + */ + public DiffCommandBuilder setPath(String path) + { + request.setPath(path); + + return this; + } + + /** + * Show the difference only for the given revision. + * + * + * @param revision revision for difference + * + * @return {@code this} + */ + public DiffCommandBuilder setRevision(String revision) + { + request.setRevision(revision); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param outputStream + * @param path + */ + private void getDiffResult(OutputStream outputStream) + { + Preconditions.checkNotNull(outputStream, "OutputStream is required"); + Preconditions.checkArgument(request.isValid(), + "path and/or revision is required"); + diffCommand.getDiffResult(request, outputStream); + } + + //~--- fields --------------------------------------------------------------- + + /** implementation of the diff command */ + private DiffCommand diffCommand; + + /** request for the diff command implementation */ + private DiffCommandRequest request = new DiffCommandRequest(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java new file mode 100644 index 0000000000..af483b202c --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -0,0 +1,451 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableList; + +import sonia.scm.cache.Cache; +import sonia.scm.cache.CacheManager; +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.Repository; +import sonia.scm.repository.spi.LogCommand; +import sonia.scm.repository.spi.LogCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * LogCommandBuilder is able to show the history of a file in a + * {@link Repository} or the entire history of a {@link Repository}. + * This class could be used to retrieve a single {@link Changeset} by its id + * or to get a list of changesets in a {@link ChangesetPagingResult} + * which can be used for paging.
+ *
+ * Samples: + *
+ *
+ * Get a instance of LogCommandBuilder: + *

+ * public class Sample {
+ *
+ *   {@literal @}Inject
+ *   public Sample(RepositoryServiceFactory factory){
+ *     LogCommandBuilder log = factory.create("repository-id").getLogCommand();
+ *   }
+ *
+ * }
+ * 
+ * + * Retrieve a single {@link Changeset}: + *

+ * LogCommand log = repositoryService.getLogCommand();
+ * Changeset changeset = log.getChangeset("id-of-the-commit");
+ * 
+ * + * Retrieve changesets of a {@link Repository} with paging: + *

+ * LogCommand log = repositoryService.getLogCommand();
+ * ChangesetPagingResult changesetPagingResult =
+ *          log.setPagingStart(25).setPagingLimit(25).getChangesets();
+ * 
+ * + * Retrieve all changesets of a file in a {@link Repository}: + *

+ * LogCommand log = repositoryService.getLogCommand();
+ * ChangesetPagingResult changesetPagingResult =
+ *          log.setPath("pom.xml").disablePagingLimit().getChangesets();
+ * 
+ * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class LogCommandBuilder +{ + + /** name of the cache */ + private static final String CACHE_NAME = "sonia.scm.cache.log"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs a new {@link LogCommandBuilder}, this constructor should + * only be called from the {@link RepositoryService}. + * + * @param cacheManager cache manager + * @param logCommand implementation of the {@link LogCommand} + * @param repository repository to query + */ + LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand, + Repository repository) + { + this.cache = cacheManager.getCache(CacheKey.class, + ChangesetPagingResult.class, CACHE_NAME); + this.logCommand = logCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Disable paging limit all available changesets will be retrieved. + * This method does the same as {@link #setPagingLimit(int)} + * with a value of -1. + * + * + * @return {@code this} + */ + public LogCommandBuilder disablePagingLimit() + { + request.setPagingLimit(-1); + + return this; + } + + /** + * Reset each parameter to its default value. + * + * + * @return {@code this} + */ + public LogCommandBuilder reset() + { + request.reset(); + + return this; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the {@link Changeset} with the given id or null if the + * {@link Changeset} could not be found in the {@link Repository}. + * + * + * @param id id of the {@link Changeset} + * + * @return the {@link Changeset} with the given id or null + */ + public Changeset getChangeset(String id) + { + Changeset changeset = null; + + if (disableCache) + { + changeset = logCommand.getChangeset(id); + } + else + { + CacheKey key = new CacheKey(repository, id); + ChangesetPagingResult cpr = cache.get(key); + + if (cpr == null) + { + changeset = logCommand.getChangeset(id); + + if (changeset != null) + { + cpr = new ChangesetPagingResult(1, ImmutableList.of(changeset)); + cache.put(key, cpr); + } + } + else + { + changeset = cpr.iterator().next(); + } + } + + return changeset; + } + + /** + * Return all changesets with the given parameters. + * + * + * @return all changesets with the given parameters + */ + public ChangesetPagingResult getChangesets() + { + ChangesetPagingResult cpr = null; + + if (disableCache) + { + cpr = logCommand.getChangesets(request); + } + else + { + CacheKey key = new CacheKey(repository, request); + + cpr = cache.get(key); + + if (cpr == null) + { + cpr = logCommand.getChangesets(request); + + if (cpr != null) + { + cache.put(key, cpr); + } + } + } + + return cpr; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Retrieve only changesets of the given branch. + * + * + * @param branch branch name to query + * + * @return {@code this} + */ + public LogCommandBuilder setBranch(String branch) + { + request.setBranch(branch); + + return this; + } + + /** + * Disables the cache for changesets. This means that every {@link Changeset} + * is directly retrieved from the {@link Repository}. Note: Disabling + * the cache cost a lot of performance and could be much more slower. + * + * + * @param disableCache true to disable the cache + * + * @return {@code this} + */ + public LogCommandBuilder setDisableCache(boolean disableCache) + { + this.disableCache = disableCache; + + return this; + } + + /** + * Retrieve changesets until the given the {@link Changeset} + * with the given id. + * + * + * @param endChangeset id of the end {@link Changeset} + * + * @return {@code this} + */ + public LogCommandBuilder setEndChangeset(String endChangeset) + { + request.setEndChangeset(endChangeset); + + return this; + } + + /** + * Set the limit for the returned changesets. The default value is 20. + * Setting the value to -1 means to disable the limit. + * + * + * @param pagingLimit limit for returned changesets + * + * @return {@code this} + */ + public LogCommandBuilder setPagingLimit(int pagingLimit) + { + request.setPagingLimit(pagingLimit); + + return this; + } + + /** + * Sets the start value for paging. The value is 0. + * + * + * @param pagingStart start value for paging + * + * @return {@code this} + */ + public LogCommandBuilder setPagingStart(int pagingStart) + { + request.setPagingStart(pagingStart); + + return this; + } + + /** + * Retrieve only changesets which are affect the given path. + * + * + * @param path file path in the {@link Repository}. + * + * @return {@code this} + */ + public LogCommandBuilder setPath(String path) + { + request.setPath(path); + + return this; + } + + /** + * Start at the given {@link Changeset}. + * + * + * @param startChangeset changeset id to start with + * + * @return {@code this} + */ + public LogCommandBuilder setStartChangeset(String startChangeset) + { + request.setStartChangeset(startChangeset); + + return this; + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Class description + * + * + * @version Enter version here..., 12/06/05 + * @author Enter your name here... + */ + private static class CacheKey implements Serializable + { + + /** + * Constructs ... + * + * + * @param repository + * @param request + */ + public CacheKey(Repository repository, LogCommandRequest request) + { + this.repositoryId = repository.getId(); + this.request = request; + } + + /** + * Constructs ... + * + * + * + * @param repository + * @param changesetId + */ + public CacheKey(Repository repository, String changesetId) + { + this.repositoryId = repository.getId(); + this.changesetId = changesetId; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final CacheKey other = (CacheKey) obj; + + return Objects.equal(repositoryId, other.repositoryId) + && Objects.equal(changesetId, other.changesetId) + && Objects.equal(request, other.request); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(repositoryId, changesetId, request); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private String changesetId; + + /** Field description */ + private String repositoryId; + + /** Field description */ + private LogCommandRequest request; + } + + + //~--- fields --------------------------------------------------------------- + + /** cache for changesets */ + private Cache cache; + + /** disable cache */ + private boolean disableCache; + + /** Implementation of the log command */ + private LogCommand logCommand; + + /** repository to query */ + private Repository repository; + + /** request for the log command */ + private LogCommandRequest request = new LogCommandRequest(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java new file mode 100644 index 0000000000..53207c7406 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.cache.CacheManager; +import sonia.scm.repository.Repository; +import sonia.scm.repository.spi.RepositoryServiceProvider; + +/** + * From the {@link RepositoryService} it is possible to access all commands for + * a single {@link Repository}. The {@link RepositoryService} is only access + * able from the {@link RepositoryServiceFactory}.
+ *
+ * + * Note: Not every {@link RepositoryService} supports every command. If + * the command is not supported the method will trow a + * {@link CommandNotSupportedException}. It is possible to check if the command + * is supported by the {@link RepositoryService} with the + * {@link RepositoryService#isSupported(Command)} method. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class RepositoryService +{ + + /** + * Constructs a new {@link RepositoryService}. This constructor should only + * be called from the {@link RepositoryServiceFactory}. + * + * @param cacheManager cache manager + * @param provider implementation for {@link RepositoryServiceProvider} + * @param repository the repository + */ + RepositoryService(CacheManager cacheManager, + RepositoryServiceProvider provider, Repository repository) + { + this.cacheManager = cacheManager; + this.provider = provider; + this.repository = repository; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * The blame command shows changeset information by line for a given file. + * + * @return instance of {@link BlameCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + */ + public BlameCommandBuilder getBlameCommand() + { + return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(), + repository); + } + + /** + * The browse command allows browsing of a repository. + * + * @return instance of {@link BrowseCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + */ + public BrowseCommandBuilder getBrowseCommand() + { + return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(), + repository); + } + + /** + * The cat command show the content of a given file. + * + * @return instance of {@link CatCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + */ + public CatCommandBuilder getCatCommand() + { + return new CatCommandBuilder(provider.getCatCommand()); + } + + /** + * The diff command shows differences between revisions for a specified file + * or the entire revision. + * + * @return instance of {@link DiffCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + */ + public DiffCommandBuilder getDiffCommand() + { + return new DiffCommandBuilder(provider.getDiffCommand()); + } + + /** + * The log command shows revision history of entire repository or files. + * + * @return instance of {@link LogCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + */ + public LogCommandBuilder getLogCommand() + { + return new LogCommandBuilder(cacheManager, provider.getLogCommand(), + repository); + } + + /** + * Returns true if the command is supported by the repository service. + * + * + * @param command command + * + * @return true if the command is supported + */ + public boolean isSupported(Command command) + { + return provider.getSupportedCommands().contains(command); + } + + //~--- fields --------------------------------------------------------------- + + /** cache manager */ + private CacheManager cacheManager; + + /** implementation of the repository service provider */ + private RepositoryServiceProvider provider; + + /** the repository */ + private Repository repository; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java new file mode 100644 index 0000000000..55097b5433 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -0,0 +1,228 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import sonia.scm.cache.CacheManager; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryManager; +import sonia.scm.repository.RepositoryNotFoundException; +import sonia.scm.repository.spi.RepositoryServiceProvider; +import sonia.scm.repository.spi.RepositoryServiceResolver; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Set; + +/** + * The {@link RepositoryServiceFactory} is the entrypoint of the repository api. + * You could create {@link RepositoryService} from a {@link Repository} and + * with the {@link RepositoryService} you could browse and control the entire + * {@link Repository}. + *

 

+ * Simple usage example: + * + *

+ * public class Sample {
+ *
+ *   private final RepositoryServiceFactory factory;
+ *
+ *   {@literal @}Inject
+ *   public Sample(RepositoryServiceFactory factory){
+ *     this.factory = factory;
+ *   }
+ *
+ *   public Changeset getChangeset(String repositoryId, String commitId){
+ *     RepositoryService service = factory.create(repositoryId);
+ *     return service.getLogCommand().getChangeset(commitId);
+ *   }
+ *
+ * }
+ * 
+ * + * @author Sebastian Sdorra + * @since 1.17 + */ +@Singleton +public final class RepositoryServiceFactory +{ + + /** + * Constructs a new {@link RepositoryServiceFactory}. This constructor + * should not be called manually, it should only be used by the injection + * container. + * + * @param cacheManager cache manager + * @param repositoryManager manager for repositories + * @param resolvers a set of {@link RepositoryServiceResolver} + */ + @Inject + public RepositoryServiceFactory(CacheManager cacheManager, + RepositoryManager repositoryManager, + Set resolvers) + { + this.cacheManager = cacheManager; + this.repositoryManager = repositoryManager; + this.resolvers = resolvers; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Creates a new RepositoryService for the given repository. + * + * + * @param repositoryId id of the repository + * + * @return a implementation of RepositoryService + * for the given type of repository + * + * @throws RepositoryNotFoundException if no repository + * with the given id is available + * @throws RepositoryServiceNotFoundException if no repository service + * implementation for this kind of repository is available + * @throws IllegalArgumentException if the repository id is null or empty + */ + public RepositoryService create(String repositoryId) + throws RepositoryNotFoundException + { + Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryId), + "a non empty repositoryId is required"); + + Repository repository = repositoryManager.get(repositoryId); + + if (repository == null) + { + throw new RepositoryNotFoundException( + "could not find a repository with id ".concat(repositoryId)); + } + + return create(repository); + } + + /** + * Creates a new RepositoryService for the given repository. + * + * + * @param type type of the repository + * @param name name of the repository + * + * @return a implementation of RepositoryService + * for the given type of repository + * + * @throws RepositoryNotFoundException if no repository + * with the given id is available + * @throws RepositoryServiceNotFoundException if no repository service + * implementation for this kind of repository is available + * @throws IllegalArgumentException if one of the parameters is null or empty + */ + public RepositoryService create(String type, String name) + throws RepositoryNotFoundException + { + Preconditions.checkArgument(!Strings.isNullOrEmpty(type), + "a non empty type is required"); + Preconditions.checkArgument(!Strings.isNullOrEmpty(name), + "a non empty name is required"); + + Repository repository = repositoryManager.get(type, name); + + if (repository == null) + { + StringBuilder msg = + new StringBuilder("could not find a repository with type "); + + msg.append(type).append(" and name ").append(name); + + throw new RepositoryNotFoundException(msg.toString()); + } + + return create(repository); + } + + /** + * Creates a new RepositoryService for the given repository. + * + * + * @param repository the repository + * + * @return a implementation of RepositoryService + * for the given type of repository + * + * @throws RepositoryServiceNotFoundException if no repository service + * implementation for this kind of repository is available + * @throws NullPointerException if the repository is null + */ + public RepositoryService create(Repository repository) + { + Preconditions.checkNotNull(repository, "repository is required"); + + RepositoryService service = null; + + for (RepositoryServiceResolver resolver : resolvers) + { + RepositoryServiceProvider provider = resolver.reslove(repository); + + if (provider != null) + { + service = new RepositoryService(cacheManager, provider, repository); + + break; + } + } + + if (service == null) + { + throw new RepositoryServiceNotFoundException(repository); + } + + return service; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private CacheManager cacheManager; + + /** Field description */ + private RepositoryManager repositoryManager; + + /** Field description */ + private Set resolvers; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java new file mode 100644 index 0000000000..09d6b43a4d --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.api; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.Repository; + +/** + * This exception is throw if no {@link RepositoryService} + * is available for the given {@link Repository}. + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class RepositoryServiceNotFoundException extends RuntimeException +{ + + /** + * Constructs a new {@link RepositoryServiceNotFoundException}. + * + * + * @param repository unsupported repository + */ + public RepositoryServiceNotFoundException(Repository repository) + { + super("could not find a repository service provider implementation for repository " + .concat(repository.getName())); + this.repository = repository; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the unsupported repository. + * + * + * @return unsupported repository + */ + public Repository getRepository() + { + return repository; + } + + //~--- fields --------------------------------------------------------------- + + /** unsupported repository */ + private Repository repository; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/package-info.java b/scm-core/src/main/java/sonia/scm/repository/api/package-info.java new file mode 100644 index 0000000000..a1713ee6a9 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/package-info.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +/** + * API for repository access. + */ +package sonia.scm.repository.api; diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java new file mode 100644 index 0000000000..9908a3c35a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.BlameResult; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface BlameCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + */ + public BlameResult getBlameResult(BlameCommandRequest request); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java new file mode 100644 index 0000000000..f7df5a4371 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class BlameCommandRequest extends FileBaseCommandRequest +{ + + /** + * Method description + * + * + * @return + */ + @Override + public BlameCommandRequest clone() + { + BlameCommandRequest clone = null; + + try + { + clone = (BlameCommandRequest) super.clone(); + } + catch (CloneNotSupportedException e) + { + + // this shouldn't happen, since we are Cloneable + throw new InternalError("BlameCommandRequest seems not to be cloneable"); + } + + return clone; + } +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java new file mode 100644 index 0000000000..5b6677e3b1 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.BrowserResult; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface BrowseCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + */ + public BrowserResult getBrowserResult(BrowseCommandRequest request); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java new file mode 100644 index 0000000000..52fbf96a0d --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class BrowseCommandRequest extends FileBaseCommandRequest + implements Resetable, Serializable {} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java new file mode 100644 index 0000000000..83d9f8c5da --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface CatCommand +{ + + /** + * Method description + * + * + * @param request + * @param output + */ + public void getCatResult(CatCommandRequest request, OutputStream output); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java new file mode 100644 index 0000000000..1673204b1a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class CatCommandRequest extends FileBaseCommandRequest + implements Cloneable +{ + + /** + * Method description + * + * + * @return + */ + @Override + public CatCommandRequest clone() + { + CatCommandRequest clone = null; + + try + { + clone = (CatCommandRequest) super.clone(); + } + catch (CloneNotSupportedException e) + { + + // this shouldn't happen, since we are Cloneable + throw new InternalError("CatCommandRequest seems not to be cloneable"); + } + + return clone; + } +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java new file mode 100644 index 0000000000..c5197a1860 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface DiffCommand +{ + + /** + * Method description + * + * + * @param request + * @param output + */ + public void getDiffResult(DiffCommandRequest request, OutputStream output); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java new file mode 100644 index 0000000000..daca399877 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Strings; + +import sonia.scm.Validateable; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class DiffCommandRequest extends FileBaseCommandRequest + implements Cloneable, Validateable +{ + + /** + * Method description + * + * + * @return + */ + @Override + public DiffCommandRequest clone() + { + DiffCommandRequest clone = null; + + try + { + clone = (DiffCommandRequest) super.clone(); + } + catch (CloneNotSupportedException e) + { + + // this shouldn't happen, since we are Cloneable + throw new InternalError("DiffCommandRequest seems not to be cloneable"); + } + + return clone; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public boolean isValid() + { + return !Strings.isNullOrEmpty(getPath()) + ||!Strings.isNullOrEmpty(getRevision()); + } +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java new file mode 100644 index 0000000000..609ab8d82f --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public abstract class FileBaseCommandRequest implements Resetable, Serializable +{ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final FileBaseCommandRequest other = (FileBaseCommandRequest) obj; + + return Objects.equal(path, other.path) + && Objects.equal(revision, other.revision); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(path, revision); + } + + /** + * Method description + * + */ + @Override + public void reset() + { + path = null; + revision = null; + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("path", path) + .add("revision", revision) + .toString(); + //J+ + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param path + */ + public void setPath(String path) + { + this.path = path; + } + + /** + * Method description + * + * + * @param revision + */ + public void setRevision(String revision) + { + this.revision = revision; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + String getPath() + { + return path; + } + + /** + * Method description + * + * + * @return + */ + String getRevision() + { + return revision; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private String path; + + /** Field description */ + private String revision; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java new file mode 100644 index 0000000000..419cecb93e --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface LogCommand +{ + + /** + * Method description + * + * + * @param id + * + * @return + */ + public Changeset getChangeset(String id); + + /** + * Method description + * + * + * @param request + * + * @return + */ + public ChangesetPagingResult getChangesets(LogCommandRequest request); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java new file mode 100644 index 0000000000..96fc585c6a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java @@ -0,0 +1,326 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public final class LogCommandRequest implements Serializable, Resetable +{ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final LogCommandRequest other = (LogCommandRequest) obj; + + return Objects.equal(startChangeset, other.startChangeset) + && Objects.equal(endChangeset, other.endChangeset) + && Objects.equal(pagingStart, other.pagingStart) + && Objects.equal(pagingLimit, other.pagingLimit) + && Objects.equal(branch, other.branch) + && Objects.equal(path, other.path) + && Objects.equal(pending, other.pending); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(startChangeset, endChangeset, pagingStart, + pagingLimit, branch, path, pending); + } + + /** + * Method description + * + */ + @Override + public void reset() + { + startChangeset = null; + endChangeset = null; + pagingStart = 0; + pagingLimit = 20; + path = null; + branch = null; + pending = false; + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("startChangeset", startChangeset) + .add("endChangeset", endChangeset) + .add("pagingStart", pagingStart) + .add("pagingLimit", pagingLimit) + .add("branch", branch) + .add("path", path) + .add("pending", pending) + .toString(); + //J+ + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param branch + */ + public void setBranch(String branch) + { + this.branch = branch; + } + + /** + * Method description + * + * + * @param endChangeset + */ + public void setEndChangeset(String endChangeset) + { + this.endChangeset = endChangeset; + } + + /** + * Method description + * + * + * @param pagingLimit + */ + public void setPagingLimit(int pagingLimit) + { + this.pagingLimit = pagingLimit; + } + + /** + * Method description + * + * + * @param pagingStart + */ + public void setPagingStart(int pagingStart) + { + this.pagingStart = pagingStart; + } + + /** + * Method description + * + * + * @param path + */ + public void setPath(String path) + { + this.path = path; + } + + /** + * Method description + * + * + * @param pending + */ + public void setPending(boolean pending) + { + this.pending = pending; + } + + /** + * Method description + * + * + * @param startChangeset + */ + public void setStartChangeset(String startChangeset) + { + this.startChangeset = startChangeset; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + String getBranch() + { + return branch; + } + + /** + * Method description + * + * + * @return + */ + String getEndChangeset() + { + return endChangeset; + } + + /** + * Method description + * + * + * @return + */ + int getPagingLimit() + { + return pagingLimit; + } + + /** + * Method description + * + * + * @return + */ + int getPagingStart() + { + return pagingStart; + } + + /** + * Method description + * + * + * @return + */ + String getPath() + { + return path; + } + + /** + * Method description + * + * + * @return + */ + String getStartChangeset() + { + return startChangeset; + } + + /** + * Method description + * + * + * @return + */ + boolean isPagingUnlimited() + { + return pagingLimit < 0; + } + + /** + * Method description + * + * + * @return + */ + boolean isPending() + { + return pending; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private String branch; + + /** Field description */ + private String endChangeset; + + /** Field description */ + private int pagingLimit = 20; + + /** Field description */ + private int pagingStart = 0; + + /** Field description */ + private String path; + + /** Field description */ + private boolean pending = false; + + /** Field description */ + private String startChangeset; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java new file mode 100644 index 0000000000..6944c50e29 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.Command; +import sonia.scm.repository.api.CommandNotSupportedException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Set; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public abstract class RepositoryServiceProvider +{ + + /** + * Method description + * + * + * @return + */ + public abstract Set getSupportedCommands(); + + /** + * Method description + * + * + * @return + */ + public BlameCommand getBlameCommand() + { + throw new CommandNotSupportedException(Command.BLAME); + } + + /** + * Method description + * + * + * @return + */ + public BrowseCommand getBrowseCommand() + { + throw new CommandNotSupportedException(Command.BROWSE); + } + + /** + * Method description + * + * + * @return + */ + public CatCommand getCatCommand() + { + throw new CommandNotSupportedException(Command.CAT); + } + + /** + * Method description + * + * + * @return + */ + public DiffCommand getDiffCommand() + { + throw new CommandNotSupportedException(Command.DIFF); + } + + /** + * Method description + * + * + * @return + */ + public LogCommand getLogCommand() + { + throw new CommandNotSupportedException(Command.LOG); + } +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java new file mode 100644 index 0000000000..f0ed4c0814 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.plugin.ExtensionPoint; +import sonia.scm.repository.Repository; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +@ExtensionPoint +public interface RepositoryServiceResolver +{ + + /** + * Method description + * + * + * @param repository + * + * @return + */ + public RepositoryServiceProvider reslove(Repository repository); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java b/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java new file mode 100644 index 0000000000..e438955c54 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public interface Resetable +{ + + /** + * Method description + * + */ + public void reset(); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java b/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java new file mode 100644 index 0000000000..b6a0c7f646 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +/** + * SPI for repository access. This package is only for service provider. + */ +package sonia.scm.repository.spi; From 4afe19285c8f7a0c11518baf0c4aa656695e5555 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 14:24:19 +0200 Subject: [PATCH 011/159] start implementation of git log command --- .../java/sonia/scm/repository/GitUtil.java | 30 ++ .../repository/spi/AbstractGitCommand.java | 88 ++++++ .../scm/repository/spi/GitLogCommand.java | 263 ++++++++++++++++++ .../spi/GitRepositoryServiceProvider.java | 107 +++++++ .../spi/GitRepositoryServiceResolver.java | 94 +++++++ 5 files changed, 582 insertions(+) create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java index bbfc5728ed..0566a48d1e 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java @@ -155,6 +155,36 @@ public class GitUtil //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @param repo + * @param branchName + * + * @return + * + * @throws IOException + */ + public static ObjectId getBranchId(org.eclipse.jgit.lib.Repository repo, + String branchName) + throws IOException + { + ObjectId branchId = null; + Ref ref = repo.getRef(branchName); + + if (ref != null) + { + branchId = ref.getObjectId(); + } + else if (logger.isWarnEnabled()) + { + logger.warn("could not find branch for {}", branchName); + } + + return branchId; + } + /** * Method description * diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java new file mode 100644 index 0000000000..f8b9a46198 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.eclipse.jgit.lib.Repository; + +import sonia.scm.repository.GitUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractGitCommand +{ + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + protected AbstractGitCommand(sonia.scm.repository.Repository repository, + File repositoryDirectory) + { + this.repository = repository; + this.repositoryDirectory = repositoryDirectory; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @return + * + * @throws IOException + */ + protected Repository open() throws IOException + { + return GitUtil.open(repositoryDirectory); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + protected sonia.scm.repository.Repository repository; + + /** Field description */ + private File repositoryDirectory; +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java new file mode 100644 index 0000000000..9856eedc24 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -0,0 +1,263 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Strings; +import com.google.common.collect.Lists; + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.NoHeadException; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.revwalk.RevWalk; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.GitChangesetConverter; +import sonia.scm.repository.GitUtil; +import sonia.scm.util.IOUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class GitLogCommand extends AbstractGitCommand implements LogCommand +{ + + /** + * the logger for GitLogCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(GitLogCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + GitLogCommand(sonia.scm.repository.Repository repository, + File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param revision + * + * @return + */ + @Override + public Changeset getChangeset(String revision) + { + if (logger.isDebugEnabled()) + { + logger.debug("fetch changeset {}", revision); + } + + Changeset changeset = null; + Repository gr = null; + GitChangesetConverter converter = null; + + try + { + gr = open(); + + if (!gr.getAllRefs().isEmpty()) + { + RevWalk revWalk = new RevWalk(gr); + ObjectId id = GitUtil.getRevisionId(gr, revision); + RevCommit commit = revWalk.parseCommit(id); + + if (commit != null) + { + converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH); + changeset = converter.createChangeset(commit); + } + else if (logger.isWarnEnabled()) + { + logger.warn("could not find revision {}", revision); + } + } + } + catch (IOException ex) + { + logger.error("could not open repository", ex); + } + finally + { + IOUtil.close(converter); + GitUtil.close(gr); + } + + return changeset; + } + + /** + * Method description + * + * + * @param request + * + * @return + */ + @Override + public ChangesetPagingResult getChangesets(LogCommandRequest request) + { + if (logger.isDebugEnabled()) + { + logger.debug("fetch changesets for request: {}", request); + } + + ChangesetPagingResult changesets = null; + org.eclipse.jgit.lib.Repository gr = null; + GitChangesetConverter converter = null; + + try + { + gr = open(); + + if (!gr.getAllRefs().isEmpty()) + { + org.eclipse.jgit.api.LogCommand cmd = new Git(gr).log(); + + converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH); + + if (!Strings.isNullOrEmpty(request.getPath())) + { + cmd.addPath(request.getPath()); + } + + if (!Strings.isNullOrEmpty(request.getStartChangeset())) + { + ObjectId start = GitUtil.getRevisionId(gr, + request.getStartChangeset()); + + if (!Strings.isNullOrEmpty(request.getEndChangeset())) + { + ObjectId end = GitUtil.getRevisionId(gr, + request.getStartChangeset()); + + cmd.addRange(start, end); + } + else + { + cmd.add(start); + } + } + else + { + cmd.add(GitUtil.getRepositoryHead(gr)); + } + + if (!Strings.isNullOrEmpty(request.getBranch())) + { + ObjectId branchId = GitUtil.getBranchId(gr, request.getBranch()); + + if (branchId != null) + { + cmd.add(branchId); + } + } + + int counter = 0; + int start = request.getPagingStart(); + + if (start < 0) + { + if (logger.isErrorEnabled()) + { + logger.error("start parameter is negative, reset to 0"); + } + + start = 0; + } + + List changesetList = Lists.newArrayList(); + int limit = request.getPagingLimit(); + + for (RevCommit commit : cmd.call()) + { + if ((counter >= start) && ((limit < 0) || (counter < start + limit))) + { + changesetList.add(converter.createChangeset(commit)); + } + + counter++; + } + + changesets = new ChangesetPagingResult(start, changesetList); + } + else if (logger.isWarnEnabled()) + { + logger.warn("the repository {} seems to be empty", + repository.getName()); + } + } + catch (NoHeadException ex) + { + logger.error("could not read changesets", ex); + } + catch (IOException ex) + { + logger.error("could not open repository", ex); + } + finally + { + IOUtil.close(converter); + GitUtil.close(gr); + } + + return changesets; + } +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java new file mode 100644 index 0000000000..564c69df60 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.ImmutableSet; + +import sonia.scm.repository.GitRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.api.Command; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +import java.util.Set; + +/** + * + * @author Sebastian Sdorra + */ +public class GitRepositoryServiceProvider extends RepositoryServiceProvider +{ + + /** Field description */ + private static final Set COMMANDS = ImmutableSet.of(Command.LOG); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + * @param repository + */ + public GitRepositoryServiceProvider(GitRepositoryHandler handler, + Repository repository) + { + this.repository = repository; + this.repositoryDirectory = handler.getDirectory(repository); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public LogCommand getLogCommand() + { + return new GitLogCommand(repository, repositoryDirectory); + } + + /** + * Method description + * + * + * @return + */ + @Override + public Set getSupportedCommands() + { + return COMMANDS; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private Repository repository; + + /** Field description */ + private File repositoryDirectory; +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java new file mode 100644 index 0000000000..b6f922e07e --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.inject.Inject; + +import sonia.scm.plugin.ext.Extension; +import sonia.scm.repository.GitRepositoryHandler; +import sonia.scm.repository.Repository; + +/** + * + * @author Sebastian Sdorra + */ +@Extension +public class GitRepositoryServiceResolver implements RepositoryServiceResolver +{ + + /** Field description */ + public static final String TYPE = "git"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + */ + @Inject + public GitRepositoryServiceResolver(GitRepositoryHandler handler) + { + this.handler = handler; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public GitRepositoryServiceProvider reslove(Repository repository) + { + GitRepositoryServiceProvider provider = null; + + if (TYPE.equalsIgnoreCase(repository.getType())) + { + provider = new GitRepositoryServiceProvider(handler, repository); + } + + return provider; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private GitRepositoryHandler handler; +} From c8b5902650e48be71b4547290d5c49a0d27fe907 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 15:16:55 +0200 Subject: [PATCH 012/159] fix wrong end parameter --- .../src/main/java/sonia/scm/repository/spi/GitLogCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 9856eedc24..4f43769fa7 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -186,7 +186,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand if (!Strings.isNullOrEmpty(request.getEndChangeset())) { ObjectId end = GitUtil.getRevisionId(gr, - request.getStartChangeset()); + request.getEndChangeset()); cmd.addRange(start, end); } From c209def286b38e5c987a84fad6b22100329ca253 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 15:46:19 +0200 Subject: [PATCH 013/159] reimplement getChangesets by request --- .../scm/repository/spi/GitLogCommand.java | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 4f43769fa7..1fa98e23b2 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -169,47 +169,8 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand if (!gr.getAllRefs().isEmpty()) { - org.eclipse.jgit.api.LogCommand cmd = new Git(gr).log(); - converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH); - if (!Strings.isNullOrEmpty(request.getPath())) - { - cmd.addPath(request.getPath()); - } - - if (!Strings.isNullOrEmpty(request.getStartChangeset())) - { - ObjectId start = GitUtil.getRevisionId(gr, - request.getStartChangeset()); - - if (!Strings.isNullOrEmpty(request.getEndChangeset())) - { - ObjectId end = GitUtil.getRevisionId(gr, - request.getEndChangeset()); - - cmd.addRange(start, end); - } - else - { - cmd.add(start); - } - } - else - { - cmd.add(GitUtil.getRepositoryHead(gr)); - } - - if (!Strings.isNullOrEmpty(request.getBranch())) - { - ObjectId branchId = GitUtil.getBranchId(gr, request.getBranch()); - - if (branchId != null) - { - cmd.add(branchId); - } - } - int counter = 0; int start = request.getPagingStart(); @@ -225,18 +186,53 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand List changesetList = Lists.newArrayList(); int limit = request.getPagingLimit(); + boolean started = false; + ObjectId startId = null; + + if (!Strings.isNullOrEmpty(request.getStartChangeset())) + { + startId = gr.resolve(request.getStartChangeset()); + } + + ObjectId endId = null; + + if (!Strings.isNullOrEmpty(request.getStartChangeset())) + { + endId = gr.resolve(request.getEndChangeset()); + } + + org.eclipse.jgit.api.LogCommand cmd = new Git(gr).log().all(); + + if (!Strings.isNullOrEmpty(request.getPath())) + { + cmd = cmd.addPath(request.getPath()); + } for (RevCommit commit : cmd.call()) { - if ((counter >= start) && ((limit < 0) || (counter < start + limit))) + if (!started && ((startId == null) || commit.getId().equals(startId))) { - changesetList.add(converter.createChangeset(commit)); + started = true; } - counter++; + if (started) + { + if ((counter >= start) + && ((limit < 0) || (counter < start + limit))) + { + changesetList.add(converter.createChangeset(commit)); + } + + counter++; + + if ((endId != null) && commit.getId().equals(endId)) + { + break; + } + } } - changesets = new ChangesetPagingResult(start, changesetList); + changesets = new ChangesetPagingResult(counter, changesetList); } else if (logger.isWarnEnabled()) { From b4380a006722c7a5245c04cd213852ee067691b1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 16:24:14 +0200 Subject: [PATCH 014/159] added unit tests for git log command --- .../spi/AbstractGitCommandTestBase.java | 185 +++++++++++++++++ .../scm/repository/spi/GitLogCommandTest.java | 188 ++++++++++++++++++ .../scm/repository/spi/scm-git-spi-test.zip | Bin 0 -> 19256 bytes 3 files changed, 373 insertions(+) create mode 100644 scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java create mode 100644 scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java create mode 100644 scm-plugins/scm-git-plugin/src/test/resources/sonia/scm/repository/spi/scm-git-spi-test.zip diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java new file mode 100644 index 0000000000..0878e570c7 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.io.Closeables; +import com.google.common.io.Resources; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryTestData; +import sonia.scm.util.IOUtil; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import java.net.URL; + +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractGitCommandTestBase +{ + + /** + * Method description + * + */ + @Before + public void before() + { + repositoryDirectory = createRepositoryDirectory(); + } + + /** + * Method description + * + * + * @return + */ + protected Repository createRepository() + { + return RepositoryTestData.createHeartOfGold(); + } + + /** + * Method description + * + * + * @return + * + * @throws IOException + */ + protected File createRepositoryDirectory() + { + File folder = null; + + try + { + folder = tempFolder.newFolder(); + folder.mkdirs(); + extract(folder); + } + catch (IOException ex) + { + fail(ex.getMessage()); + } + + return folder; + } + + /** + * Method description + * + * + * @param folder + * + * @throws IOException + */ + private void extract(File folder) throws IOException + { + URL url = + Resources.getResource("sonia/scm/repository/spi/scm-git-spi-test.zip"); + ZipInputStream zip = null; + + try + { + zip = new ZipInputStream(url.openStream()); + + ZipEntry entry = zip.getNextEntry(); + + while (entry != null) + { + File file = new File(folder, entry.getName()); + File parent = file.getParentFile(); + + if (!parent.exists()) + { + parent.mkdirs(); + } + + if (entry.isDirectory()) + { + file.mkdirs(); + } + else + { + OutputStream output = null; + + try + { + output = new FileOutputStream(file); + IOUtil.copy(zip, output); + } + finally + { + Closeables.closeQuietly(output); + } + } + + zip.closeEntry(); + entry = zip.getNextEntry(); + } + } + finally + { + Closeables.closeQuietly(zip); + } + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + + /** Field description */ + protected Repository repository = createRepository(); + + /** Field description */ + protected File repositoryDirectory; +} diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java new file mode 100644 index 0000000000..9365cd1696 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.Modifications; + +import static org.hamcrest.Matchers.*; + +import static org.junit.Assert.*; + +/** + * + * @author Sebastian Sdorra + */ +public class GitLogCommandTest extends AbstractGitCommandTestBase +{ + + /** + * Method description + * + */ + @Test + public void testGetAll() + { + ChangesetPagingResult result = new GitLogCommand( + repository, + repositoryDirectory).getChangesets( + new LogCommandRequest()); + + assertNotNull(result); + assertEquals(4, result.getTotal()); + assertEquals(4, result.getChangesets().size()); + } + + /** + * Method description + * + */ + @Test + public void testGetAllByPath() + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPath("a.txt"); + + ChangesetPagingResult result = + new GitLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + assertEquals("3f76a12f08a6ba0dc988", result.getChangesets().get(0).getId()); + assertEquals("435df2f061add3589cb3", result.getChangesets().get(1).getId()); + } + + /** + * Method description + * + */ + @Test + public void testGetAllWithLimit() + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingLimit(2); + + ChangesetPagingResult result = + new GitLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(4, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("86a6645eceefe8b9a247", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("3f76a12f08a6ba0dc988", c2.getId()); + } + + /** + * Method description + * + */ + @Test + public void testGetCommit() + { + GitLogCommand command = new GitLogCommand(repository, repositoryDirectory); + Changeset c = command.getChangeset("435df2f061add3589cb3"); + + assertNotNull(c); + assertEquals("435df2f061add3589cb3", c.getId()); + assertEquals("added a and b files", c.getDescription()); + checkDate(c.getDate()); + assertEquals("Douglas Adams", c.getAuthor().getName()); + assertEquals("douglas.adams@hitchhiker.com", c.getAuthor().getMail()); + assertEquals("added a and b files", c.getDescription()); + + Modifications mods = c.getModifications(); + + assertNotNull(mods); + assertTrue("modified list should be empty", mods.getModified().isEmpty()); + assertTrue("removed list should be empty", mods.getRemoved().isEmpty()); + assertFalse("added list should not be empty", mods.getAdded().isEmpty()); + assertEquals(2, mods.getAdded().size()); + assertThat(mods.getAdded(), contains("a.txt", "b.txt")); + } + + /** + * Method description + * + */ + @Test + public void testGetRange() + { + LogCommandRequest request = new LogCommandRequest(); + + request.setStartChangeset("592d797cd36432e59141"); + request.setEndChangeset("435df2f061add3589cb3"); + + ChangesetPagingResult result = + new GitLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c1); + assertEquals("592d797cd36432e59141", c1.getId()); + assertNotNull(c2); + assertEquals("435df2f061add3589cb3", c2.getId()); + } + + /** + * Method description + * + * + * @param date + */ + private void checkDate(Long date) + { + assertNotNull(date); + assertTrue("Date should not be older than current date", + date < System.currentTimeMillis()); + } +} diff --git a/scm-plugins/scm-git-plugin/src/test/resources/sonia/scm/repository/spi/scm-git-spi-test.zip b/scm-plugins/scm-git-plugin/src/test/resources/sonia/scm/repository/spi/scm-git-spi-test.zip new file mode 100644 index 0000000000000000000000000000000000000000..88bedbea9c1268f70b52a76225a26b8ebaa3b9c8 GIT binary patch literal 19256 zcmcJ02Rzl^|G!;X*)t(K>n_(tL}f%qk(qI)y;oL|k(9^^WseBSOp+NwC@Nc`(y)>! zl;8W3xaA|?|Kst$Jx&jLbf2&D+OP9^oui{cN=8Y9|CBqmDHiFDXVL&a;}Tf|NZw>%cpS8IE6{Irhtad9n)Rx#n0 zC!M+m!Yu|wABb9S9kA{iBO$`?VNKu`fWSqqU2m}h^zn-f*n^s~(y>+IuESeO#s!O$ zv~`vI&C`{?1x_d!i-l{3lz?I% z0gLnZ_mNIcc3w_MH?)W3afzzF z->KH`(x`&u@IE-BPqAy?zFF_)zw6KtC@97LZQqtq?*|->y zgGwwp5jx_p-~$mo?LH<}gJy%{0)_?8x%L+=NtZ5rd*{S``e-7b$4w~S58qnp768%u zlj8Nht{$|by}h;DPDLAK?$`}tYD~GI?W`u+rLUPW8(OL!c%YXm+Hm36hc|-Km&zV> z*j@a5%h&S`*KKCO&kV{v3qL#LoA=i|ragr%zuNSS?K4 z+JjL^huLeDm?Fvdm=~&Dqi-jFsd|%3gxji^9dKq+)gVuyI9<5^GQD0%vNGwjn3utX^w=Y%jc5g-iC4+T|_jI zqqCL3eJdq8v#JP=I-9Xx)xtNVUCVDmBQZ;zY<>xa%hIAzM!jDwVU&4y%&Y6)t@vE2 zUous$Nq z?YG-^CP>v~`F4llC(Y|FF*C%3yzLV(k@*4eb(J6lIk{lPH^R^k*z=13Yd3)Cf-RRt z_glXp?+T6GvlfE1ymPg~{o?%6L_$}t>KYdnRXbk!L5;)H8J)P@(gMpKnxwPq5L680kzx@FxQ;MsmDA%E6>MoP1Wwt9g)1 zKy>%w0Ms)RgAiYAiue)Vm(({VU2^J1LSf0+M7(~;H=|P120fFdW7RH|R7_&_z1C$J z_TnVg+Ucc!i)N71<@WBo#i;ZuST!4>TDde|%3fI!EPatCh(2E7{;GISHIH}xf~n1b zG(*esl^F2zH?Mk)W|e~W|Io9z*i_wv)2xqtFKa1xOWDGv&!-62MJa_M51^pGxwkw+ zXPTGg(pZK7Je{mjC-C?&kibRl$#2RZzIAqGy55W+3lr-OJHXd`ql&Qu`t~~_X798? zP1n$gSsZRLJFRi(gK|i@pd5p3TKL|3VE(ZtR}Z%n+~KswFuvQIQN|)1e0vQ%c_+P-aO0N^h{ua2 zh2r{&rIq-HQW?4VTV-6`eAu>k}nJOsU zN!&J*;wyCUeGUt)b!0lxk<_`sGl35LD&&`Zvs+s70#3Yd7uOsW7Mcsz(#{|{R}!$d zAopTiemX;J3c|y!T-80`dxXwi*4|89v#xhuLqde|f%7v<{pjZ|>hV18F9QM`++rfK zUfBoQdsoJ%cqM)v7RcM>sUT3O8Cx1(;WrsPCQo!$T9ICAUkHV8M(xGY<7rV3%{b$= zXrG2n?5+!-FyiMO_Y%0xLF~2PGuEVgVrJjUTSJ}@&j;ztoJkYREAny¥30zs@-M za33F!>QK=A*?Il&xaC|@IrG~WUi-#;-IxueCcY2Ld~&b~?(U{lrOa#YHTx8NAQT1R zpVZ~fcrI#Kz~H<{w|{=v`%I+4xjy3sSl@W2vZvjcb7_cJYDJ*Oj~dy`ZiE=w9`A}o zmy937rWd0dNITNM-EVq7EJWI!-N5;3G&?i=NQC3Hz`-7}TvB7ZRPPI=bZ5Wl8l|t? zbDI63p;gtwD!IVl^)3iyVmqPm{leJ6Ww#lfbWH38`2$ZH7C-u6N=K(GmlOw$nW>oenL>Nb zwcA~bg+5?W9SxOmFO%xCnY4<(Vs*}Cb{xF&gX)LQ^@MDVMKhM-=gIRn1v%#IQeYe2 zf{)$CpX6G_5-KyzZ9iG1ow8RfZQUnz?B($>F>!bOJ3RaiUkkm#f<_V|*94SCR8Pyg zL?*va9~sYmMy?@Vcl5G&u6Dv$o8~(Ucx>g(= z+NHyJO8IShsZk!}(7T1<2mNgGFwj+w5@cbla_rGh#*Sh)dn3E;&$z`3T-zmhzs!xF z9+S|}|CZ$dC01XDCVA|XpG$K%Rv}FE?V09U@PsDDKH+c(ziVXCGxut;YXz>VM$I!h zA-BD+S$fdOgLM0=35Kug?2?UW}WXR*ncz6mp{oWac5~zgwnuD_69K zw~ifIFzs_I;qT8}-@mF7tN$-jH719rr$0asslQA#TXxp^k)i{Uy1^h8hIuxw`?)sJ;^@=!;7R-Fv~`M54|s_GK^i9>hgdp~o`6#C^U-Qg)amXIcSKet(}*)t~jgB9Ap=9u@X z;>7aGcUC2aO-)D2Dgw`?wfXuqP)pzPsq1STJsO=-H*R=juiM^dO+y~Ne~6ABVNw>$%~_RxOvXd|IpP z)8TNdrn!f_f<51Mk@g+z9CVtmz8Rk3b*twma}#S(_(2158qWg@7}{H%DuFx| z3leJkpFBLj3)@+!n!&Rxp6%S&KxCFu^UqGR*Kf$v=je{hi#OlCKYf}aH}m|Nhd<{h zO}HB^6bmJ;TVW;xcYO}3)DFMU{fX^}cF45zz{;X&^rH5XX7{&>MZU;K&sM(Er^|Ky zP(fjD>zBbae4G*s1&n)+r1|&rezNq0fbeU+6m(oM`l%J@JSf7&?5Jr}r-Nlfujv z=v1F#dX+BAl0dw)wwSt3_|sYqf#ya>gqeRzK>};X^>AlU2Wy1X_)) z%d3@?_fo!m!b&+t)KvROF6-d@BbY5?-<1IR`gy9#Y;Gx2bH51XNIo_a&*HeZVZ<4M z8u>*^&k#YelM*N^(qU31va6aW^qmiXO|2g-Q1A-98gRJe#2iF|ExeztgyB>12z8FI zl-rv~$zx+^!7rf5>9ao%2w@WoZ1`9e51WP6c{<*4Fst#BqjIzmU5YZY>mI#+H}&W# z(oaQum3vjBy9#UE3_j9~$RFZ*<|ZppdQCplx#lbK&4G_@{T858-z1ryh8-<8KkrNQ z`K_g?DYlKvS5}{`WoF^Y@jHs<2JJFJA(Wq~o7tPM52e#C5mVlnzui`NEuvk~pB-MS z?;1BEl1o~lmMs$5kwBFn+jZqYx`A5AyN^`teeRK3JP(QBS$l+KDG&BKilPuJ#(I8= z3!a6h_Gjx1d^?b)6UT%t;!ezY($d#neMsj0W%8_}>+IkzO3voII}wU6J*1U0cJXpn z^CzZq#xB*rBk3z>nMsZ6xY#QVWnwXiwsiF2^{CA6cIfIq`?csz6S&y9`%3G5FE=Kd zqJ#NZ>;Rw8V$EzL^vIOcov>zb6(xeYAe$!Z+YOiIIG1GBuHf`gX3B{L?~!NGEpI$) z=;xBrEDMj`twh^qkM3f)xorBhQ7OG|xP%mzbZc3Y$9^HpKwHEz$#KbRCFriky%|9> zh4d?K(8bEf2@#9u8EfH@?QuMh8rdYAg3T9ohsOjNjK2pLvf9PP;8LExK_8!$++F1I zRJuR;jhC5MGECI3arU{Zc~0fy0cv}=fCqa1vg3D4HuD2%2GY^bKi!`@b)R%%K_!Gk z-`=6ortnh;%`&8Q;D@h2pWuqO6TNKm!J<2y_fL(!U~DuvlzREL%3;M%I6Ce_9lpDt z&DHSk%MRt%rq|*Pm0cj$n~(30eK5u|&m!nJ^oav{-sZ%i0PP05aP|7$g_?IT&5^c( znZtyY0xQYG>gyy#L_K6gMBE$4NEfUV^7r9jhiwUWT~pU?5S_1J&1fW4^RU>BdK0UojINz(-JYxFT=~l6TRzg%+SDqJhrec>v`5E!9M;#Dw=P) z`QE`#*}o9oDK1_Zp_yaxLDKtP)Jb@u?yZv@%q%NpEVkQ6B&MDtuCvy-Qu91&hTo6% zq;Wpo3C7NFy#V#I?}MnA>m%~{(6r$vTMr2|`R9UjucYNG^}KT$t)rnm}3SH&=$5 zb>zmfv>}9t$Se1Wsc@nM5-j|~hi8vHGPr|nYn#oTIOCHrr*ow>Ui? z4q#ul5_tftJXt(D6+~P%Q-@Ic((l3N^ITnwRy5<&kUm?^B5yh>yUdPblUXDIXLb%XUQnd3$Pi3CJ))grp-EY7K+` z@Q4U>;(9qS>3qJ4_p<%NA>7FxroDrY_0jE`-A?@n1>C7ef@dmXW1k)ytI`W&YK%=Y z=9U~tlL z08V$V{9NN{_-Oy#xBNaDiPWYSX#Ci8>{_~Y$VyKboxyZ5eyI5Pa-}*V6QfaVE2MUX zDDC+0kf-OXp=U#$(YcX~Nfbk=8r%Y(3+;-YAhOiuqprFZ!7xmkQ0Bun#>WM-AWvr4 z+2K7gZ)}v#a3oX7M5K;}VA*MJkq5gXg~!3H+P+no&uBGURRgqeHWs& z`uYs9(3(i!$)|%NRybXMaPCvuXS)w*)lc%*CyP)Tw6XI9Ut@f55<>4P)-)9u9Q&N! zKi9pTcpu%6k-Tmeq=Vnu0al>va4LDavXaF}MORB}FFZKN`i#4`OSPUcTP!R6GfDFH zv-SE3MdRcJu@ju3Dw<-@WaoyorQHmkdtd*czhV$zn3JFuHpUZQrbVT1IH09gi_nPl z3Ulqaq64|j?*38HKd@TcRd8(X{?yXIviMQZSh3UllwAVjRM@lnG5e<*$ima##9eeJ zVt6uAI9DIl6U{eXko&t1I`^V0z2X@52c*T@GEaK;H(lb}L6d3IJ&Rb__neyXJ@=LpI z9Ad8Rw$5J;xegR=>K=ntJ$4)IOwXm0Xx3mg>6t##Kv2)k&JkXPenH^Bn4 zc|IAhyE2jTGcGN<|A!OZqZ6+CUXmSUI!!mM(H3Y_P+ZUZLzVYfYs}t@M;9j=Ke8=9 zQcIZk^M5ewfU9x!Vs~mErP*~;F5A#0oGY>jlTa|I>zgiIyrS~n-S2s^D93A+>z55+S{DR9)pX9rD*!%9&J5>e#mWk4PTc3lW9(N)%gU^qgHB+g$ zoqrPhbk73|Pp51lkJ%F;eAD~V2S1<`u5ywx+>kwe-z$ehfBKcni%AD}-{!KeGLM3w zIa;$s-$q+451Ty?k80bPaGfkfx?{dv`0~!K)+}69;gx&)Lg?lCt|j;Wc^jI*5&g${jn2`U+7GG)BIXnnvSK4QE_=;dPa^ZM{}0$mqH z-=j-NB2K1-U!BKHc#+doK_!mL%N#C`3p{bIY1Ml58A@sP%r z>y9yJiC@@vG`)JILyiX9er~^AV>CvN+W;8D?vI?R1aClq+9k^vvk%kguev zc$v9$S}jet%5*5Wd*u8^%FY0$Mu{|fpC*CsXeiJfB?m&7wF3rwc6Agp3yh6Wf6sSZ zKU2HlEG#TYQ2Hx*3t<5;(kt&s!%C`h4t3T(tq2MT_$;cUMwVHQ3duZ`UiNaD>@>>{ zN1uTQv>kJ{SPRYPqPfCI#g`Gd4sthF2GL$i;jdwZJyPGlyjdRZOhdLGRHn{9uJ&$_ zSt*c^LLGwJCS&2)#A%{PGR}ctqXmjcLY=1*+wUfN{Fl{*?K)BD;Umrkvh{4q`;%zTz_-1 zH{4P>b}FQ~DuFVCzPHy3Es}0+C`f6Ws_odV7*0DOVQ=l;WIF|~%5##gW`l?*F)@?% zJr1h8oko&oIsRC~PUA}xF{SH>^jDJRlM^Ik&hpGjseQ&BO%ac8PWZFN&ObiH6Xox2 z)N2M7rKeOtr7X|i)k3g^2QwBM6Z0uAerdS>xOu+rJ?mfpJ=esKj`1*m3{}gzG_-(5J;jKWe506B zXlv)CaJo@i`G84w-OK!OQMKQlO-`q)rMjIg6gzyl(~QmOW#}c>SCzT4`5Ie~!Qb;a0 zE>UawE?}2iDI|v8W%81c+Km^HCYR*U)jAPS`xx$93GB`)VM9G650B|V9?ixED@?46_MBGa=tCmHHv)^YT+ z&bR25QSrP>(qTl{@s;qAUGtF*BGeM!@IDuVR2}aJ1yUzf+1Zm?ChVs zIxp{7y~*(ZR3qiO9#%)ktC3m6CKKp=0l;>{)Klp?Ds6U6vO zYLDfU`xizs^bBZ>Sw4eLwhSXh*oseOk21C^Q#G81E@XVBH0Ya8dR=0^$mi$yBc}>h z9eOU{Yx0F~sLWaEj`-`vLk^SvJ>}&^)m47A-!e(4t0*x!_RkcOJdU|QBE0{U5Fr8_{k<#!DB}*>~%`&*QFws~K$!Bwj&&7hXDC0$m;X_VbNp^isB#GS}_u zBfcl@9^oXzBiFLPjzAbH3kxp*8^JFyAqW;O zBZEc3U|9D+bY5il$ofsw{a zNrPnIs}jSL!mmF}{4B9XYm4@&yB2DCYELvys*REm@kfy%HrP1!N9@|n1{ATzhR(m( zz=JHpLXKJjO2@CwYycqAP#gq_g@I6LG)5YULcnowDI@|8!JtuKFcb@xl7WM8GOKLh zNvZu^mHkruT^REJm)?nJMT9su#Db4903*LY1Y*Ihi3J~3wsk5z$oCYHU3~xyei4WT zCn*g_f+08%0trVUK^U|Q0)d7jP|`RM3WCOfWk6UQ8j6Pf4q#h~#r`Tj)YBcaoYb9D zc=X05PwILh?s+}R&eqCvid%^H!Gsy}^9+|)<$@OPoahBf63^s&w_5qN7;DxU za6#A$U5gbmR81b|c%41aEisZIqI=V&sLtr9g3T?`_LfY9?euNA@t4-}Be%qoUO#jV z*qg0xG-BKdQ@B*qZEqcQJxe~cdGMa})0a)U*?|{Wu`wJS^UDVxIo%4n2pfEDCJU|q z$`-+0`Ss|*J2cHlR)j+euIqC$=hzD<);?5Bi+xk5{?tS5ijSG%`^X;i{nbQF+-G<; z6!B+%-mC~1bWIWeOwf3cz-Mw?*?MqII>4DA(sYD5jFQyf2h)D zTD)5FO$>@ur1jf_brTMY@PwgGe_r9r(O zGCgJf+p{(X6T`S~Z@Mnt>;MVBowLY~c49ge>QK1kGe+V$Z)oy}bx`E`1<;G?b04B? zZ#akdGOi@Nj||;IH={g)yeir=MZ-aSBzQxrV%vB<47Daz{(pHr9%S$1n{D)fMDdG2 zswhb`4l9Ge!eJmZ0)l`^0iF(qzyU``A%LKT0wHlo1Ol;kGQg7>|MXwM3xra8O+rL# zLt?SPz;!hz_Em68F&z;G-A1wqLmz*0a+ z#)08b7*yNdnckI|)pk@c{W%rw!`euA3?!2dpn;5?f z96xc*E>v{S>!8l+7ZfQ4j-3?d=La~eE#46?6u9-5&x+e;d;9vA!zKEI=|)W1v$CIE zy=BUAi2wBqs^poGevbOd#6pA0o;=GzD%$bGVb;D(A!j^@DGsrdweGn;b*L2fgQV)V zuH}a0EB?4Px!ED%;5Er>{P*c+E$`t$OyPSWTbT|3B8>n^%OD^S1O_aP#6d7n7!Hkv zp>Ze-4k{%j1xG+3FlorDL*hwoYdS#2qs5V!Z7{H%>A-t2^KlFs%a#YJ-98j8FPkwX!4QD+xKZW!wTl0QZ)GK;U2~3WCI; z;2;Q4fI)CLI0}Q1Mj+8(85tNBA+hr^_>Xe<^7gew^&;3^oD6czTLTCB^&&8z}I*D z!unXRsB*M11VvF{V$CdI9LSTRw8h>l9EA^jd@rX6`4nUY@~%9)agZmEN{Np?8&l=! zq3+=!Tt`{S_E`N)kn>sBZi9<5@ufk^QSO-V4&psYi&m%^gl_hg4u;X%8owb<-+Kpw zU-L#3+b>@*sjTnfl;Xe>ku3=~6BXrvSpiUF8eb6Y&A zEo-2)!xW|8tux~;Q~!b?G4Co=a_)iCy?u$+K`iAaJmA#)!%=WFieR@^{1 zXK1QFbgD~_sEH>&a)on~_O>ekaj-Ry*--(=9-qmvRk#K~03Kn$ffS8I%Am1G8KCNu zfHaEC7Eo|2tg&zZ^`70zY$%Z0P;Z7Ya0+&ePToJ7~_X zCEM*_oRDbSH5uZcC2Sk_|AfIeJU5zT|NQz^k#AGWW>vV`M837_xp)v_9$E)sz<@=7 zMZdm>&2Kz@Lv8V1hP+ORn22XLX>E6t}a}-lq2{AO1+z_|D`iVK?M@m)YaL+d6CV z!eeZf7Xtyt>fQmgRe|BLw%GX21x8G=pLEUO@LD2#AH@a;j)(~8))8d};D7q_wG{c< zYpFk)7djev%#DlLgwLZkW1a>u*B?s(SX(@?`4fxqNz-O5{J4nVfzx(?YYhMWK4~+c zGr;#+S06yazgF6k&8>Zv0(h^m_Ms!1RB8f{)}JVCx2p}25k64b*wthJ1<+nz!`gT! zKyZ0wX9NhJ=xio{1+LJq5!m9v&d$II-)(FLFCbqB-|7{|&d>>8PHaZM1l;^z+xmaJ zqu3b%!iNN#2@C-DjW-DV@vLBH;DpzfH-ooQZ3h4267$Z$32!=W2A>0NN&nvYf8Bf9 z84<$kC7X%7VOb~g$7Pd$1OGkrT?58DQD(p`PNMY@FaU)=fBX-=NKW93-TUxRt4a9Z zyTa#A!ujY1yO{wDT)&`xPfNE$TniL`mPLe{Bi~Q7K8ysQ@HNYpd~PIF!cpYr%^h2Z z`W?dXS$a#jt#?LAAhsvmzjpSkbl7ftYj}T8*VZ+P4~cXtykKjBO^1pQr$U|1f(zAmKb^9T3llu;3;>c0OJC zH`zZ!Eunwd32l&F9Y_Fx{~2)C>XGN$>R0#j$^>IX$0C1;0_J5PzULVz)$>N(; z{}v1$kg&PFnGaI2O?>RU)&6g?e|N{%$>Q~Ke=}KpuN(mUM*;bFr+gg{uaBREfIID* z|C{XgcI7R;A->g?IRLl=yCQ6uZ|0+h5OAmM^M8~5v&tciyK)j6d;m@FRek(tUA9r^ z5cbVC^WjejxYI5=z{fwxZXb6GB{%q3?M4HDJBYi4z39z+%n<_av@`v0vfJl#C(s5T zt4(PDa0mIEuqC~jk1|5Qoi?cdO?LZyZV%qzW3|5w0PY~46Lyz3^HEF)xYJ(qzsdgD zkfkB0+pQoQeC*(yy5=FR0wxRdkW8q0V`A#541*~1#_Bq8koc=Y?bE4*%N_#}mc z{gT129x Date: Mon, 11 Jun 2012 16:30:08 +0200 Subject: [PATCH 015/159] implement cat command for git --- .../scm/repository/spi/GitCatCommand.java | 196 ++++++++++++++++++ .../spi/GitRepositoryServiceProvider.java | 17 +- 2 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java new file mode 100644 index 0000000000..7b3e988449 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java @@ -0,0 +1,196 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.ObjectLoader; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.revwalk.RevTree; +import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.treewalk.filter.PathFilter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.GitUtil; +import sonia.scm.repository.PathNotFoundException; +import sonia.scm.repository.RepositoryException; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class GitCatCommand extends AbstractGitCommand implements CatCommand +{ + + /** + * the logger for GitCatCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(GitCatCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public GitCatCommand(sonia.scm.repository.Repository repository, + File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + */ + @Override + public void getCatResult(CatCommandRequest request, OutputStream output) + { + org.eclipse.jgit.lib.Repository repo = null; + + try + { + repo = open(); + + ObjectId revId = GitUtil.getRevisionId(repo, request.getRevision()); + + getContent(repo, revId, request.getPath(), output); + } + catch (Exception ex) + { + //TODO throw + logger.error("could not fetch content", ex); + } + finally + { + GitUtil.close(repo); + } + } + + /** + * Method description + * + * + * + * @param repo + * @param revId + * @param path + * @param output + * + * + * @throws IOException + * @throws RepositoryException + */ + public void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, + String path, OutputStream output) + throws IOException, RepositoryException + { + TreeWalk treeWalk = null; + RevWalk revWalk = null; + + try + { + treeWalk = new TreeWalk(repo); + treeWalk.setRecursive(Util.nonNull(path).contains("/")); + + if (logger.isDebugEnabled()) + { + logger.debug("load content for {} at {}", path, revId.name()); + } + + revWalk = new RevWalk(repo); + + RevCommit entry = revWalk.parseCommit(revId); + RevTree revTree = entry.getTree(); + + if (revTree != null) + { + treeWalk.addTree(revTree); + } + else + { + logger.error("could not find tree for {}", revId.name()); + } + + treeWalk.setFilter(PathFilter.create(path)); + + if (treeWalk.next()) + { + + // Path exists + if (treeWalk.getFileMode(0).getObjectType() == Constants.OBJ_BLOB) + { + ObjectId blobId = treeWalk.getObjectId(0); + ObjectLoader loader = repo.open(blobId); + + loader.copyTo(output); + } + else + { + + // Not a blob, its something else (tree, gitlink) + throw new PathNotFoundException(path); + } + } + else + { + throw new PathNotFoundException(path); + } + } + finally + { + GitUtil.release(revWalk); + GitUtil.release(treeWalk); + } + } +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index 564c69df60..aaece0406a 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -53,7 +53,8 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.LOG); + private static final Set COMMANDS = ImmutableSet.of(Command.CAT, + Command.LOG); //~--- constructors --------------------------------------------------------- @@ -65,7 +66,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider * @param repository */ public GitRepositoryServiceProvider(GitRepositoryHandler handler, - Repository repository) + Repository repository) { this.repository = repository; this.repositoryDirectory = handler.getDirectory(repository); @@ -73,6 +74,18 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public CatCommand getCatCommand() + { + return new GitCatCommand(repository, repositoryDirectory); + } + /** * Method description * From a407a6cb1dfad20e12a3088a478355def166130c Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 16:38:07 +0200 Subject: [PATCH 016/159] added unit tests for cat command --- .../scm/repository/spi/GitCatCommandTest.java | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java new file mode 100644 index 0000000000..69eaaad058 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.ByteArrayOutputStream; + +/** + * TODO add not found test + * + * @author Sebastian Sdorra + */ +public class GitCatCommandTest extends AbstractGitCommandTestBase +{ + + /** + * Method description + * + */ + @Test + public void testCat() + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4"); + assertEquals("a and b", execute(request)); + } + + /** + * Method description + * + */ + @Test + public void testSimpleCat() + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("a.txt"); + assertEquals("a", execute(request)); + } + + /** + * Method description + * + * + * @param request + * + * @return + */ + private String execute(CatCommandRequest request) + { + String content = null; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try + { + new GitCatCommand(repository, repositoryDirectory).getCatResult(request, + baos); + } + finally + { + content = baos.toString().trim(); + } + + return content; + } +} From 4986a4cb303de6c1ef996c00fcc1917e34c891af Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 16:57:25 +0200 Subject: [PATCH 017/159] implement git browse command --- .../repository/spi/AbstractGitCommand.java | 2 +- .../scm/repository/spi/GitBrowseCommand.java | 472 ++++++++++++++++++ .../scm/repository/spi/GitCatCommand.java | 2 +- .../spi/GitRepositoryServiceProvider.java | 16 +- 4 files changed, 488 insertions(+), 4 deletions(-) create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java index f8b9a46198..ced9de8909 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java @@ -84,5 +84,5 @@ public class AbstractGitCommand protected sonia.scm.repository.Repository repository; /** Field description */ - private File repositoryDirectory; + protected File repositoryDirectory; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java new file mode 100644 index 0000000000..d127c3d5cb --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java @@ -0,0 +1,472 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.eclipse.jgit.errors.MissingObjectException; +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.ObjectLoader; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.revwalk.RevTree; +import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.treewalk.filter.AndTreeFilter; +import org.eclipse.jgit.treewalk.filter.PathFilter; +import org.eclipse.jgit.treewalk.filter.TreeFilter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.FileObject; +import sonia.scm.repository.GitSubModuleParser; +import sonia.scm.repository.GitUtil; +import sonia.scm.repository.PathNotFoundException; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SubRepository; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * + * @author Sebastian Sdorra + */ +public class GitBrowseCommand extends AbstractGitCommand + implements BrowseCommand +{ + + /** Field description */ + public static final String PATH_MODULES = ".gitmodules"; + + /** + * the logger for GitBrowseCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(GitBrowseCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public GitBrowseCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + */ + @Override + public BrowserResult getBrowserResult(BrowseCommandRequest request) + { + BrowserResult result = null; + org.eclipse.jgit.lib.Repository repo = null; + + try + { + repo = open(); + + ObjectId revId = null; + + if (Util.isEmpty(request.getRevision())) + { + revId = GitUtil.getRepositoryHead(repo); + } + else + { + revId = GitUtil.getRevisionId(repo, request.getRevision()); + } + + if (revId != null) + { + result = getResult(repo, revId, request.getPath()); + } + else + { + if (Util.isNotEmpty(request.getRevision())) + { + logger.error("could not find revision {}", request.getRevision()); + } + else if (logger.isWarnEnabled()) + { + logger.warn("coul not find head of repository, empty?"); + } + + result = new BrowserResult(Constants.HEAD, null, null, + new ArrayList()); + } + } + catch (Exception ex) + { + logger.error("could not fetch browser result", ex); + } + finally + { + GitUtil.close(repo); + } + + return result; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param files + * @param repo + * @param revId + * @param path + * + * @throws IOException + * @throws RepositoryException + */ + private void appendSubModules(List files, + org.eclipse.jgit.lib.Repository repo, + ObjectId revId, String path) + throws IOException, RepositoryException + { + path = Util.nonNull(path); + + Map subRepositories = getSubRepositories(repo, + revId); + + if (subRepositories != null) + { + for (Entry e : subRepositories.entrySet()) + { + String p = e.getKey(); + + if (p.startsWith(path)) + { + p = p.substring(path.length()); + + if (p.startsWith("/")) + { + p = p.substring(1); + } + + if (p.endsWith("/")) + { + p = p.substring(0, p.length() - 1); + } + + if (!p.contains("/")) + { + FileObject fo = new FileObject(); + + fo.setDirectory(true); + fo.setPath(path); + fo.setName(p); + fo.setSubRepository(e.getValue()); + files.add(fo); + } + } + } + } + } + + /** + * Method description + * + * + * + * + * @param repo + * @param revId + * @param treeWalk + * + * @return + * + * @throws IOException + */ + private FileObject createFileObject(org.eclipse.jgit.lib.Repository repo, + ObjectId revId, TreeWalk treeWalk) + throws IOException + { + FileObject file = null; + + try + { + file = new FileObject(); + + String path = treeWalk.getPathString(); + + file.setName(treeWalk.getNameString()); + file.setPath(path); + + ObjectLoader loader = repo.open(treeWalk.getObjectId(0)); + + file.setDirectory(loader.getType() == Constants.OBJ_TREE); + file.setLength(loader.getSize()); + + // don't show message and date for directories to improve performance + if (!file.isDirectory()) + { + RevCommit commit = getLatestCommit(repo, revId, path); + + if (commit != null) + { + file.setLastModified(GitUtil.getCommitTime(commit)); + file.setDescription(commit.getShortMessage()); + } + else if (logger.isWarnEnabled()) + { + logger.warn("could not find latest commit for {} on {}", path, revId); + } + } + } + catch (MissingObjectException ex) + { + file = null; + logger.error("could not fetch object for id {}", revId); + + if (logger.isTraceEnabled()) + { + logger.trace("could not fetch object", ex); + } + } + + return file; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * + * @param repo + * @param revId + * @param path + * + * @return + */ + private RevCommit getLatestCommit(org.eclipse.jgit.lib.Repository repo, + ObjectId revId, String path) + { + RevCommit result = null; + RevWalk walk = null; + + try + { + walk = new RevWalk(repo); + walk.setTreeFilter(AndTreeFilter.create(PathFilter.create(path), + TreeFilter.ANY_DIFF)); + + RevCommit commit = walk.parseCommit(revId); + + walk.markStart(commit); + result = Util.getFirst(walk); + } + catch (Exception ex) + { + logger.error("could not parse commit for file", ex); + } + finally + { + GitUtil.release(walk); + } + + return result; + } + + /** + * Method description + * + * + * @param repo + * @param revId + * @param path + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private BrowserResult getResult(org.eclipse.jgit.lib.Repository repo, + ObjectId revId, String path) + throws IOException, RepositoryException + { + BrowserResult result = null; + RevWalk revWalk = null; + TreeWalk treeWalk = null; + + try + { + if (logger.isDebugEnabled()) + { + logger.debug("load repository browser for revision {}", revId.name()); + } + + treeWalk = new TreeWalk(repo); + revWalk = new RevWalk(repo); + + RevTree tree = revWalk.parseTree(revId); + + if (tree != null) + { + treeWalk.addTree(tree); + } + else + { + logger.error("could not find tree for {}", revId.name()); + } + + result = new BrowserResult(); + + List files = new ArrayList(); + + appendSubModules(files, repo, revId, path); + + if (Util.isEmpty(path)) + { + while (treeWalk.next()) + { + FileObject fo = createFileObject(repo, revId, treeWalk); + + if (fo != null) + { + files.add(fo); + } + } + } + else + { + String[] parts = path.split("/"); + int current = 0; + int limit = parts.length; + + while (treeWalk.next()) + { + String name = treeWalk.getNameString(); + + if (current >= limit) + { + String p = treeWalk.getPathString(); + + if (p.split("/").length > limit) + { + FileObject fo = createFileObject(repo, revId, treeWalk); + + if (fo != null) + { + files.add(fo); + } + } + } + else if (name.equalsIgnoreCase(parts[current])) + { + current++; + treeWalk.enterSubtree(); + } + } + } + + result.setFiles(files); + result.setRevision(revId.getName()); + } + finally + { + GitUtil.release(revWalk); + GitUtil.release(treeWalk); + } + + return result; + } + + /** + * Method description + * + * + * @param repo + * @param revision + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private Map getSubRepositories( + org.eclipse.jgit.lib.Repository repo, ObjectId revision) + throws IOException, RepositoryException + { + if (logger.isDebugEnabled()) + { + logger.debug("read submodules of {} at {}", repository.getName(), + revision); + } + + Map subRepositories = null; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try + { + new GitCatCommand(repository, repositoryDirectory).getContent(repo, + revision, PATH_MODULES, baos); + subRepositories = GitSubModuleParser.parse(baos.toString()); + } + catch (PathNotFoundException ex) + { + logger.trace("could not find .gitmodules", ex); + } + + return subRepositories; + } +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java index 7b3e988449..f8fd7c4777 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java @@ -131,7 +131,7 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand * @throws IOException * @throws RepositoryException */ - public void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, + void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, String path, OutputStream output) throws IOException, RepositoryException { diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index aaece0406a..bfb1a61a89 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -53,8 +53,8 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.CAT, - Command.LOG); + private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, + Command.CAT, Command.LOG); //~--- constructors --------------------------------------------------------- @@ -74,6 +74,18 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public BrowseCommand getBrowseCommand() + { + return new GitBrowseCommand(repository, repositoryDirectory); + } + /** * Method description * From 8f6bbb8eb58021f33ae7de6a4cea87e63527a433 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 17:15:14 +0200 Subject: [PATCH 018/159] added unit tests for git browse command --- .../spi/AbstractGitCommandTestBase.java | 13 ++ .../repository/spi/GitBrowseCommandTest.java | 157 ++++++++++++++++++ .../scm/repository/spi/GitLogCommandTest.java | 13 -- 3 files changed, 170 insertions(+), 13 deletions(-) create mode 100644 scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java index 0878e570c7..8ccf81affa 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java @@ -75,6 +75,19 @@ public class AbstractGitCommandTestBase repositoryDirectory = createRepositoryDirectory(); } + /** + * Method description + * + * + * @param date + */ + protected void checkDate(Long date) + { + assertNotNull(date); + assertTrue("Date should not be older than current date", + date < System.currentTimeMillis()); + } + /** * Method description * diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java new file mode 100644 index 0000000000..3846199696 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.FileObject; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class GitBrowseCommandTest extends AbstractGitCommandTestBase +{ + + /** + * Method description + * + */ + @Test + public void testBrowse() + { + BrowserResult result = new GitBrowseCommand( + repository, + repositoryDirectory).getBrowserResult( + new BrowseCommandRequest()); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(4, foList.size()); + + FileObject a = null; + FileObject c = null; + + for (FileObject f : foList) + { + if ("a.txt".equals(f.getName())) + { + a = f; + } + else if ("c".equals(f.getName())) + { + c = f; + } + } + + assertNotNull(a); + assertFalse(a.isDirectory()); + assertEquals("a.txt", a.getName()); + assertEquals("a.txt", a.getPath()); + assertEquals("added a and b files", a.getDescription()); + assertTrue(a.getLength() > 0); + checkDate(a.getLastModified()); + assertNotNull(c); + assertTrue(c.isDirectory()); + assertEquals("c", c.getName()); + assertEquals("c", c.getPath()); + } + + /** + * Method description + * + */ + @Test + public void testBrowseSubDirectory() + { + BrowseCommandRequest request = new BrowseCommandRequest(); + request.setPath("c"); + + BrowserResult result = new GitBrowseCommand( + repository, + repositoryDirectory).getBrowserResult( + request); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(2, foList.size()); + + FileObject d = null; + FileObject e = null; + + for (FileObject f : foList) + { + if ("d.txt".equals(f.getName())) + { + d = f; + } + else if ("e.txt".equals(f.getName())) + { + e = f; + } + } + + assertNotNull(d); + assertFalse(d.isDirectory()); + assertEquals("d.txt", d.getName()); + assertEquals("c/d.txt", d.getPath()); + assertEquals("added file d and e in folder c", d.getDescription()); + assertTrue(d.getLength() > 0); + checkDate(d.getLastModified()); + + assertNotNull(e); + assertFalse(e.isDirectory()); + assertEquals("e.txt", e.getName()); + assertEquals("c/e.txt", e.getPath()); + assertEquals("added file d and e in folder c", e.getDescription()); + assertTrue(e.getLength() > 0); + checkDate(e.getLastModified()); + } + +} diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 9365cd1696..0913fdf173 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -172,17 +172,4 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase assertNotNull(c2); assertEquals("435df2f061add3589cb3", c2.getId()); } - - /** - * Method description - * - * - * @param date - */ - private void checkDate(Long date) - { - assertNotNull(date); - assertTrue("Date should not be older than current date", - date < System.currentTimeMillis()); - } } From d58e1ac2c9040d97141914fd5adf02464ad37116 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 17:23:56 +0200 Subject: [PATCH 019/159] added git diff command --- .../scm/repository/spi/GitDiffCommand.java | 168 ++++++++++++++++++ .../spi/GitRepositoryServiceProvider.java | 15 +- 2 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java new file mode 100644 index 0000000000..170db0a68e --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.eclipse.jgit.diff.DiffEntry; +import org.eclipse.jgit.diff.DiffFormatter; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.revwalk.RevTree; +import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.treewalk.EmptyTreeIterator; +import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.treewalk.filter.PathFilter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.GitUtil; +import sonia.scm.repository.Repository; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.OutputStream; + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class GitDiffCommand extends AbstractGitCommand implements DiffCommand +{ + + /** + * the logger for GitDiffCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(GitDiffCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public GitDiffCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + */ + @Override + public void getDiffResult(DiffCommandRequest request, OutputStream output) + { + org.eclipse.jgit.lib.Repository gr = null; + RevWalk walk = null; + TreeWalk treeWalk = null; + DiffFormatter formatter = null; + + try + { + gr = open(); + walk = new RevWalk(gr); + + RevCommit commit = walk.parseCommit(gr.resolve(request.getRevision())); + + walk.markStart(commit); + commit = walk.next(); + treeWalk = new TreeWalk(gr); + treeWalk.reset(); + treeWalk.setRecursive(true); + + if (Util.isNotEmpty(request.getPath())) + { + treeWalk.setFilter(PathFilter.create(request.getPath())); + } + + if (commit.getParentCount() > 0) + { + RevTree tree = commit.getParent(0).getTree(); + + if (tree != null) + { + treeWalk.addTree(tree); + } + else + { + treeWalk.addTree(new EmptyTreeIterator()); + } + } + else + { + treeWalk.addTree(new EmptyTreeIterator()); + } + + treeWalk.addTree(commit.getTree()); + formatter = new DiffFormatter(new BufferedOutputStream(output)); + formatter.setRepository(gr); + + List entries = DiffEntry.scan(treeWalk); + + for (DiffEntry e : entries) + { + if (!e.getOldId().equals(e.getNewId())) + { + formatter.format(e); + } + } + + formatter.flush(); + } + catch (Exception ex) + { + logger.error("could not create diff", ex); + } + finally + { + GitUtil.release(walk); + GitUtil.release(treeWalk); + GitUtil.release(formatter); + GitUtil.close(gr); + } + } +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index bfb1a61a89..227f3ae8e4 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -54,7 +54,8 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT, Command.LOG); + Command.CAT, Command.DIFF, + Command.LOG); //~--- constructors --------------------------------------------------------- @@ -98,6 +99,18 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider return new GitCatCommand(repository, repositoryDirectory); } + /** + * Method description + * + * + * @return + */ + @Override + public DiffCommand getDiffCommand() + { + return new GitDiffCommand(repository, repositoryDirectory); + } + /** * Method description * From f5f2184356c5b9e29c7026f581200eaac005a3c8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 17:27:32 +0200 Subject: [PATCH 020/159] implement git blame command --- .../scm/repository/spi/GitBlameCommand.java | 163 ++++++++++++++++++ .../spi/GitRepositoryServiceProvider.java | 18 +- 2 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java new file mode 100644 index 0000000000..cbb5bb150a --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java @@ -0,0 +1,163 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.PersonIdent; +import org.eclipse.jgit.revwalk.RevCommit; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.BlameLine; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.GitUtil; +import sonia.scm.repository.Person; +import sonia.scm.repository.Repository; +import sonia.scm.util.AssertUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class GitBlameCommand extends AbstractGitCommand implements BlameCommand +{ + + /** + * the logger for GitBlameCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(GitBlameCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public GitBlameCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + */ + @Override + public BlameResult getBlameResult(BlameCommandRequest request) + { + AssertUtil.assertIsNotEmpty(request.getPath()); + + org.eclipse.jgit.blame.BlameResult gitBlameResult = null; + sonia.scm.repository.BlameResult blameResult = null; + org.eclipse.jgit.lib.Repository gr = null; + Git git = null; + + try + { + gr = open(); + git = new Git(gr); + + org.eclipse.jgit.api.BlameCommand blame = git.blame(); + + blame.setFilePath(request.getPath()); + + ObjectId revId = GitUtil.getRevisionId(gr, request.getRevision()); + + blame.setStartCommit(revId); + gitBlameResult = blame.call(); + AssertUtil.assertIsNotNull(gitBlameResult); + + List blameLines = new ArrayList(); + int total = gitBlameResult.getResultContents().size(); + int i = 0; + + for (; i < total; i++) + { + RevCommit commit = gitBlameResult.getSourceCommit(i); + + if (commit != null) + { + PersonIdent author = gitBlameResult.getSourceAuthor(i); + BlameLine blameLine = new BlameLine(); + + blameLine.setLineNumber(i + 1); + blameLine.setAuthor(new Person(author.getName(), + author.getEmailAddress())); + blameLine.setDescription(commit.getShortMessage()); + + long when = GitUtil.getCommitTime(commit); + + blameLine.setWhen(when); + + String rev = commit.getId().getName(); + + blameLine.setRevision(rev); + + String content = gitBlameResult.getResultContents().getString(i); + + blameLine.setCode(content); + blameLines.add(blameLine); + } + } + + blameResult = new sonia.scm.repository.BlameResult(i, blameLines); + } + catch (IOException ex) + { + logger.error("could not open repository", ex); + } + + return blameResult; + } +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index 227f3ae8e4..b300af1762 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -53,9 +53,9 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT, Command.DIFF, - Command.LOG); + private static final Set COMMANDS = ImmutableSet.of(Command.BLAME, + Command.BROWSE, Command.CAT, + Command.DIFF, Command.LOG); //~--- constructors --------------------------------------------------------- @@ -75,6 +75,18 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public BlameCommand getBlameCommand() + { + return new GitBlameCommand(repository, repositoryDirectory); + } + /** * Method description * From 94f46d587e737f70c74b4889e7b8a6c096748ceb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 11 Jun 2012 17:37:37 +0200 Subject: [PATCH 021/159] improve unit test repository --- .../repository/spi/GitBrowseCommandTest.java | 2 +- .../scm/repository/spi/GitCatCommandTest.java | 4 ++-- .../scm/repository/spi/GitLogCommandTest.java | 19 +++++++++--------- .../scm/repository/spi/scm-git-spi-test.zip | Bin 19256 -> 20891 bytes 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java index 3846199696..9ffe865e97 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java @@ -90,7 +90,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase assertFalse(a.isDirectory()); assertEquals("a.txt", a.getName()); assertEquals("a.txt", a.getPath()); - assertEquals("added a and b files", a.getDescription()); + assertEquals("added new line for blame", a.getDescription()); assertTrue(a.getLength() > 0); checkDate(a.getLastModified()); assertNotNull(c); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java index 69eaaad058..154e9d0a36 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java @@ -72,8 +72,8 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase { CatCommandRequest request = new CatCommandRequest(); - request.setPath("a.txt"); - assertEquals("a", execute(request)); + request.setPath("b.txt"); + assertEquals("b", execute(request)); } /** diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 0913fdf173..5945c38203 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -63,8 +63,8 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase new LogCommandRequest()); assertNotNull(result); - assertEquals(4, result.getTotal()); - assertEquals(4, result.getChangesets().size()); + assertEquals(5, result.getTotal()); + assertEquals(5, result.getChangesets().size()); } /** @@ -82,10 +82,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase new GitLogCommand(repository, repositoryDirectory).getChangesets(request); assertNotNull(result); - assertEquals(2, result.getTotal()); - assertEquals(2, result.getChangesets().size()); - assertEquals("3f76a12f08a6ba0dc988", result.getChangesets().get(0).getId()); - assertEquals("435df2f061add3589cb3", result.getChangesets().get(1).getId()); + assertEquals(3, result.getTotal()); + assertEquals(3, result.getChangesets().size()); + assertEquals("fcd0ef1831e4002ac43e", result.getChangesets().get(0).getId()); + assertEquals("3f76a12f08a6ba0dc988", result.getChangesets().get(1).getId()); + assertEquals("435df2f061add3589cb3", result.getChangesets().get(2).getId()); } /** @@ -103,18 +104,18 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase new GitLogCommand(repository, repositoryDirectory).getChangesets(request); assertNotNull(result); - assertEquals(4, result.getTotal()); + assertEquals(5, result.getTotal()); assertEquals(2, result.getChangesets().size()); Changeset c1 = result.getChangesets().get(0); assertNotNull(c1); - assertEquals("86a6645eceefe8b9a247", c1.getId()); + assertEquals("fcd0ef1831e4002ac43e", c1.getId()); Changeset c2 = result.getChangesets().get(1); assertNotNull(c2); - assertEquals("3f76a12f08a6ba0dc988", c2.getId()); + assertEquals("86a6645eceefe8b9a247", c2.getId()); } /** diff --git a/scm-plugins/scm-git-plugin/src/test/resources/sonia/scm/repository/spi/scm-git-spi-test.zip b/scm-plugins/scm-git-plugin/src/test/resources/sonia/scm/repository/spi/scm-git-spi-test.zip index 88bedbea9c1268f70b52a76225a26b8ebaa3b9c8..3fbab0be38e115c7c9fe342e52ea2a4bdc4e6893 100644 GIT binary patch delta 3948 zcma)8c~nzZ6Myd|Ac8_bkX2S$LJ~+`c0dRM0~1eoT;XPv7W!9!i|-Y-nO2NaFOdW4;xW)o(5Q=?nOF<(YiR})^f6@FrO5gx52 zqR}C|N}8LfT%?KiDdAe^m(gZ)j!0L<#l>L>QJ-foHOk^q)<2_USDh3ToI7*l*OggW zos3B#)U`TYCye-()t@2^3jc9vPJX>VDfV69boN1)wyhCc*pe>0;5}-GXBNMe?Kr<> z+F9R#@~KNt9jGgIZF&EL;mFxh^n|#u@!K=H4(Q<{1ua4PM#seuTVmhs?%-8Z^$m7+ zzH-}st!sZ-Zq~Tzemcn}lWKVslaYK^vp))VRtQu1MNH}RqF3b|YwKG5gBkS`^Tg%s zj02rTagtr7pQI9@E91@H<&1OpdY-;`+^$$SfLjBNOEpfKt4j6M;IpCWu3S4YRInf8Od&9XkTI=8ljcl5F#poZ z>p29)R`HcAwm9u8f$FgR4Ln3U45%5+mu7oeKfm;-Zt4d--fYnZMR_$ zb*uE^$c33DC+^-8R-IqQa35!Iduplt!{pDEcMcg8cI__MH)#sJ;r9#otr92XJ3qZ3 z*mLF_HFtATlQpYj+Q;K2OB-!#TJGkbZr{3Rf>Ds~iW-5qJpk|c&T{v|wBnYU^G!8J zIzPPqOYOA2=qCha>EL$+bql>-cGPWQH(cCRHDT#3S=og->Di4Z+V)L&apbg_jbbT! z8n5?ptB=a6k+e_QWY#_3BHeS|c(s||aP^Bn*DU_aukp26TjR{_zt^vx|LWkC8ucXx z>+ku6DYGTFoHmDS4>gl<@ZW6qU0$6dle$MQ6dn#QQ-4(4$ngB7=0%0)DL1_Chf`bY zSJZaL7CvQn%8W}4TWgK~UOlcQE%eDEs`2ofi{m$W{pgB&Y_A(b`e-zI<(G)S9Who`cVP75tn3d6O-$X^8N6O!b<uf~Ri{AcbQE&+N?ml4%82_N<|a9Z4oOt!v%SD3RDo zm}l=u=}RQ+v!|(3>NZA7TgN=39(G>g01}*iFV*WtQ0c1mQGU<6#F-V#*vSUhoIUqh zaPKX5xLfeEh53Q)iz}jZu16)FSh%CP;>vOTlc{^#fAr07Z%k}UpWK7wUV8HQ68hb@ zX@8Y_kv+V|ASv!Cirsfkf;H$EmdrTy1f{QTFM7XvNS%)_q5%=}5Bo{$X% z@{osq`q#yuvCr(<#U+{h{fkRk(5SyaG@>qa@~&BTE84%`CMnxCOKBH;jalYA@#D{n z{A8bVn$o&c_P14hSpV?SG5f7I#ySeqzgZg*EQsHq`(eC{^Qm=byY7_Y%*Thv?|71M z-khX7k`wiih_ow^?Z5{!mr-!bp$>bH14WK@!$|(@tr{!vca-1p#|Io1lR&H>}GRz|q0w-`yX>N6Wo(pphKUZ4Zv2e~*z zv85&?D;4uIJPCbKf&v%eTwKIgiE#m+BTi7U1?)t=fUArb3sk%W1wWoE8lXVJGI6Pe zC2wZPlgo8iCq{-`@thoTIrM7SQw&i&A9f8+GhB?gqFz5H{n1Yfv#^!#Af7%7(wI81 z!g=#RB)E%=^1ER})e0ADR3j{PokfWzLL1@sd_c*>-vpXi`oN;&@YZb<#Ip5aDP7$6 z-4+_?Qu0idllzEXBdD_#e8bRKCfv1xql`giW2RKYN;HloWHRRuT%yO4QHTbl(a&HR zlPMxG6>@uH8Ir1S@|{Ow<}a5Mc#>-z-HqdB}c4^ z7jP6RKA){rX)qf_zE8jbbcRo&GrM+9Ta(`Xrp6~CEQlgQ0)Tq4w*B5XI z<5=637Ti8lP=%}A-Ikt;J?&c=&|RCiY45x@3k{K$ll)ikkGl($um)dM9T6#6m?Sbh zkA7sVAlpMDuWItp9fa|dr>qb2fB~p#*}c%xIJp{GsjDrV;YbH_Oao6mpdUe%;tK@T zB!X2Xxn1=HdgL04AfcZ~;KLzsQ}PJh;uSpNG4i=$6^||Eak)H&P)s~drD7<8{~kjY zp()o-Bwt{gu57-uB>VQT^&Z=p=MOU%uWG+FCe%sIOo+~@$jjTCd*3ngcr#9%k;)1!-v+p3%AVhzqX?&`~Hk|Oxp(sGhc5kvSvBvHJ`t_q;T>< zy~}6E`n{nJ%ir>-{`8#*ul}Bvyh~_bq4&!Vx1Y9z26UG-OoMUf@>A9{TV&{fLs%rsuixTEFB*uv4KWvc2=SJo$&l|Yv?C1; zv{DQ~M)yI`Yw!rPd)xLIu>p4Noh*9onbA zw$Eta0ZG2Ln6nG4^OaMQT@dha=7Eu)1oLr)a6dUE%N2nj7arUrL>Jw_QX;45(-FAt z%7bEw1haOBWJFI8-WLegYqB=_8S{E1<5G}90ZCycwjz3f_dREeS(~# z#)%qW^WaZH)PsXVupElELy54h&cZD5`=d7)_UvRckj9T?sN9J=Tz=T zPi{kJ>ohophLF#RoEGKL8INl$i81*y5GN!|8xs>1pBxb$6(2JrG9lgq!R_z0Yst4@ z*?0t{45A1^VG-7;>FN4(j$u)zo@1bqpl~I~p5=rr$X;StlwsUicBfry7;4|rvkT&6 zHUMZ8mXfn2Yod8xw`rlA4-}~_{DIm4&&~#_+$g|vrU3_&kQ*8^Fg0o%oX00)Mu_p$ zR^!AIYOrY~a9kH|objYj8fP5LW?eVhHY)7aP>S{wKJK!Nf7(YdUQbXrBYa%6BwfGE zNbm*0BW>t2*Yf)5xrUUK6fAA#$3sJ<#S(mD4_?~XR4Z>gckSdi#l`)6otjc}BJJCn z>D9+?J)-3F~9Kt>6NOyRc^RyR+OJ-&A*-DHCS5T5itDn(Yx-p z?^CbvBIt*s)ID7jR0mypYMxhB{#N)wpG?!v&{X}XbNskz?XO8^WpC_n!{Cf64|Gr? z=3Lk1O}~ESRP&0LGjBFmSF{iBrIqj4&CWmeqKUE-Xwt{si>X}4wAcmCr-Nqi44uF_ z(=ANi*Wto_mwf5c&6CT6&GE&KUCD;y#BN8@SuHo*P~|H=$Zxl^<6x2n}t^cDWVc*ExOW>?(SA zr)*#K%pKOdE`_|Q+4Ic$2PAk?>ilT?)X0KeSX1kr;oB<@z1$j>e16;O2{pI6i_~|P zo0U(oSi1d*UxnG9Es344K0I*fjG4ydY@}G__Ac)}{8eIo?c%~43y-BeJ+S4HZ{6>E zj(JoH;wF06n*~4iJ(tl_Y@UBiRAH6dSK_IzY~MV$MA6x}tgUzd>d7y4XD`2IEU&}q zeLs54;|b(K?NZu;&iag}U8$RWtnK`$X{zSn?bm+t-B4>CB@Fc3)B0Uzh1co{D{A9& zgF4;}2-mNie>JRM_ZmJv^f^=_Ek*Q?KbGA$f3^97_m)AcK>GThbJMP7b(`yDrP~(F z{a5qwHGk2K_ROr-dqs-uGpO-q&5yAKCC6?=3mW8ed_L)7Gp5VwCv^=s36*eY;kZ&w zvcOA@OVPg4gy>%99!i7zIu}sxek=Y{X*Z80n)AM@Bct`y+WY(CXIaj%?e~vs?oRc# zZhGJt&qRre*!(v`=+#MX!YG;`VKA#PLlbN5?lls$ITuWz@yS>S{Tk{l5zzAIk2U z;viJogNv&NmVOtaTsuMU#ssmO6ibnS}`?7!=X$?8`5-->;bulN?mFN}FA1H%2(qNn%2L^sQ!hiy&0t1Y5{ej_@ ze`{PYCCCeGRSvLOPJ@mhM_K}L1x!r{{;Ophr`=?ZSRVqRGJm20!G<8GFP0MZOC6yK zPlz`|@VsuguX2VQ85{i>%4HgyiXkAx*zi`SMD-vKPC}2s&fs}y2@D0Npm!iqo`hb8 zRIb?gaJrl+R(hlz-(2f+h1mpGLP^biJm6DEd4 zqt;*ui5q9eMv%ETgkc@S zvUQRPNSLcPkZA5i>9Dr^M23m_8N6QC>Ahv(QpTj}mI>!NQR8Axt2vD*u z3SCB!pT#O4JNm zR60DGi@-Ck1g1}M1$h`7Yvn>xm=?2gha+JH*l+H@4cFpc9tiC9lt5j$63g_2Kf<-x zQBP1r6kzAQ;8=tfH}^)MkS77zR3)~~8&*x#Vwb$(%G3hvJrBYowfGc10w)C$xE!g( z&hUY*)?&B-=BW#?Qv&#f`1>FL_o!LKrD9_%d>}nqi=XvDAj3}rPokArurCNST5OFk z6lw~vdLayGwD^D!f!!hrteB?6a{Qoanif0m2bM7fSe8G06Qji&{1KQVkpL~$)u`|+ zEdyI90+u!os~15A@p&bJ(^`U#hRp~NBM2#waG^dmoeZ2&bPG}x(*+6DO~6-(5%^xp pB1CY7G94T16T=bR9LyjAi?~> Date: Tue, 12 Jun 2012 14:17:15 +0200 Subject: [PATCH 022/159] improve handling of exceptions --- .../scm/repository/api/BlameCommandBuilder.java | 6 ++++++ .../repository/api/BrowseCommandBuilder.java | 6 ++++++ .../scm/repository/api/CatCommandBuilder.java | 15 ++++++++++++++- .../scm/repository/api/DiffCommandBuilder.java | 15 ++++++++++++++- .../scm/repository/api/LogCommandBuilder.java | 10 ++++++++++ .../sonia/scm/repository/spi/BlameCommand.java | 11 ++++++++++- .../sonia/scm/repository/spi/BrowseCommand.java | 11 ++++++++++- .../sonia/scm/repository/spi/CatCommand.java | 11 ++++++++++- .../sonia/scm/repository/spi/DiffCommand.java | 12 +++++++++++- .../sonia/scm/repository/spi/LogCommand.java | 17 +++++++++++++++-- 10 files changed, 106 insertions(+), 8 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index a6916754ce..abd519efe9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -43,11 +43,13 @@ import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BlameResult; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.BlameCommand; import sonia.scm.repository.spi.BlameCommandRequest; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; import java.io.Serializable; /** @@ -105,8 +107,12 @@ public final class BlameCommandBuilder * @return changeset informations by line for the given file * * @throws IllegalArgumentException if the path is null or empty + * + * @throws IOException + * @throws RepositoryException */ public BlameResult getBlameResult(String path) + throws IOException, RepositoryException { Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "path is required"); diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 73aeb4f611..c365682134 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -41,11 +41,13 @@ import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BrowserResult; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.BrowseCommand; import sonia.scm.repository.spi.BrowseCommandRequest; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; import java.io.Serializable; /** @@ -103,8 +105,12 @@ public final class BrowseCommandBuilder * * * @return files for the given parameters + * + * @throws IOException + * @throws RepositoryException */ public BrowserResult getBrowserResult() + throws IOException, RepositoryException { BrowserResult result = null; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java index e066e38357..7a26592b94 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java @@ -40,12 +40,14 @@ import com.google.common.base.Strings; import com.google.common.io.Closeables; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.CatCommand; import sonia.scm.repository.spi.CatCommandRequest; //~--- JDK imports ------------------------------------------------------------ import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.OutputStream; /** @@ -89,9 +91,13 @@ public final class CatCommandBuilder * @param path file path * * @return {@code this} + * + * @throws IOException + * @throws RepositoryException */ public CatCommandBuilder retriveContent(OutputStream outputStream, String path) + throws IOException, RepositoryException { getCatResult(outputStream, path); @@ -105,8 +111,11 @@ public final class CatCommandBuilder * * @param path file path * @return content of the file + * + * @throws IOException + * @throws RepositoryException */ - public String getContent(String path) + public String getContent(String path) throws IOException, RepositoryException { String content = null; ByteArrayOutputStream baos = null; @@ -150,8 +159,12 @@ public final class CatCommandBuilder * * @param outputStream the outputstream for the content * @param path path of the file + * + * @throws IOException + * @throws RepositoryException */ private void getCatResult(OutputStream outputStream, String path) + throws IOException, RepositoryException { Preconditions.checkNotNull(outputStream, "OutputStream is required"); Preconditions.checkArgument(!Strings.isNullOrEmpty(path), diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java index e1f54ef7e5..c277ecb124 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java @@ -38,12 +38,14 @@ package sonia.scm.repository.api; import com.google.common.base.Preconditions; import com.google.common.io.Closeables; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.DiffCommand; import sonia.scm.repository.spi.DiffCommandRequest; //~--- JDK imports ------------------------------------------------------------ import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.OutputStream; /** @@ -80,8 +82,12 @@ public final class DiffCommandBuilder * @param outputStream outputstream for the difference * * @return {@code this} + * + * @throws IOException + * @throws RepositoryException */ public DiffCommandBuilder retriveContent(OutputStream outputStream) + throws IOException, RepositoryException { getDiffResult(outputStream); @@ -94,8 +100,11 @@ public final class DiffCommandBuilder * Returns the content of the difference as string. * * @return content of the difference + * + * @throws IOException + * @throws RepositoryException */ - public String getContent() + public String getContent() throws IOException, RepositoryException { String content = null; ByteArrayOutputStream baos = null; @@ -154,8 +163,12 @@ public final class DiffCommandBuilder * * @param outputStream * @param path + * + * @throws IOException + * @throws RepositoryException */ private void getDiffResult(OutputStream outputStream) + throws IOException, RepositoryException { Preconditions.checkNotNull(outputStream, "OutputStream is required"); Preconditions.checkArgument(request.isValid(), diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index af483b202c..2572b3076f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -43,11 +43,13 @@ import sonia.scm.cache.CacheManager; import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.LogCommand; import sonia.scm.repository.spi.LogCommandRequest; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; import java.io.Serializable; /** @@ -160,8 +162,12 @@ public final class LogCommandBuilder * @param id id of the {@link Changeset} * * @return the {@link Changeset} with the given id or null + * + * @throws IOException + * @throws RepositoryException */ public Changeset getChangeset(String id) + throws IOException, RepositoryException { Changeset changeset = null; @@ -198,8 +204,12 @@ public final class LogCommandBuilder * * * @return all changesets with the given parameters + * + * @throws IOException + * @throws RepositoryException */ public ChangesetPagingResult getChangesets() + throws IOException, RepositoryException { ChangesetPagingResult cpr = null; diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java index 9908a3c35a..80c155a534 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java @@ -36,6 +36,11 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import sonia.scm.repository.BlameResult; +import sonia.scm.repository.RepositoryException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; /** * @@ -52,6 +57,10 @@ public interface BlameCommand * @param request * * @return + * + * @throws IOException + * @throws RepositoryException */ - public BlameResult getBlameResult(BlameCommandRequest request); + public BlameResult getBlameResult(BlameCommandRequest request) + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java index 5b6677e3b1..4afc02b125 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java @@ -36,6 +36,11 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.RepositoryException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; /** * @@ -52,6 +57,10 @@ public interface BrowseCommand * @param request * * @return + * + * @throws IOException + * @throws RepositoryException */ - public BrowserResult getBrowserResult(BrowseCommandRequest request); + public BrowserResult getBrowserResult(BrowseCommandRequest request) + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java index 83d9f8c5da..b9a6f52ab0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java @@ -33,8 +33,13 @@ package sonia.scm.repository.spi; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.RepositoryException; + //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; import java.io.OutputStream; /** @@ -51,6 +56,10 @@ public interface CatCommand * * @param request * @param output + * + * @throws IOException + * @throws RepositoryException */ - public void getCatResult(CatCommandRequest request, OutputStream output); + public void getCatResult(CatCommandRequest request, OutputStream output) + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java index c5197a1860..a4d0c24444 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java @@ -33,8 +33,13 @@ package sonia.scm.repository.spi; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.RepositoryException; + //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; import java.io.OutputStream; /** @@ -51,6 +56,11 @@ public interface DiffCommand * * @param request * @param output + * + * @throws IOException + * @throws RuntimeException + * @throws RepositoryException */ - public void getDiffResult(DiffCommandRequest request, OutputStream output); + public void getDiffResult(DiffCommandRequest request, OutputStream output) + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java index 419cecb93e..168c279c19 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java @@ -37,6 +37,11 @@ package sonia.scm.repository.spi; import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.RepositoryException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; /** * @@ -53,8 +58,12 @@ public interface LogCommand * @param id * * @return + * + * @throws IOException + * @throws RepositoryException */ - public Changeset getChangeset(String id); + public Changeset getChangeset(String id) + throws IOException, RepositoryException; /** * Method description @@ -63,6 +72,10 @@ public interface LogCommand * @param request * * @return + * + * @throws IOException + * @throws RepositoryException */ - public ChangesetPagingResult getChangesets(LogCommandRequest request); + public ChangesetPagingResult getChangesets(LogCommandRequest request) + throws IOException, RepositoryException; } From 776ea53310ed0a4d20719d16591b484aa6160772 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 14:27:16 +0200 Subject: [PATCH 023/159] improve logging and exception handling of git commands --- .../scm/repository/spi/GitBlameCommand.java | 33 ++++++++++++++----- .../scm/repository/spi/GitBrowseCommand.java | 9 +++-- .../scm/repository/spi/GitCatCommand.java | 16 +++++---- .../scm/repository/spi/GitDiffCommand.java | 1 + .../scm/repository/spi/GitLogCommand.java | 19 ++++++++--- 5 files changed, 54 insertions(+), 24 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java index cbb5bb150a..e210a51d18 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java @@ -33,6 +33,9 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; + import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; @@ -46,7 +49,7 @@ import sonia.scm.repository.BlameResult; import sonia.scm.repository.GitUtil; import sonia.scm.repository.Person; import sonia.scm.repository.Repository; -import sonia.scm.util.AssertUtil; +import sonia.scm.repository.RepositoryException; //~--- JDK imports ------------------------------------------------------------ @@ -92,23 +95,31 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand * @param request * * @return + * + * @throws IOException + * @throws RepositoryException */ @Override public BlameResult getBlameResult(BlameCommandRequest request) + throws IOException, RepositoryException { - AssertUtil.assertIsNotEmpty(request.getPath()); + if (logger.isDebugEnabled()) + { + logger.debug("try to create blame for {}", request); + } + + Preconditions.checkArgument(!Strings.isNullOrEmpty(request.getPath()), + "path is empty or null"); org.eclipse.jgit.blame.BlameResult gitBlameResult = null; sonia.scm.repository.BlameResult blameResult = null; org.eclipse.jgit.lib.Repository gr = null; - Git git = null; try { gr = open(); - git = new Git(gr); - org.eclipse.jgit.api.BlameCommand blame = git.blame(); + org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame(); blame.setFilePath(request.getPath()); @@ -116,7 +127,13 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand blame.setStartCommit(revId); gitBlameResult = blame.call(); - AssertUtil.assertIsNotNull(gitBlameResult); + + if (gitBlameResult == null) + { + throw new RepositoryException( + "could not create blame result for path ".concat( + request.getPath())); + } List blameLines = new ArrayList(); int total = gitBlameResult.getResultContents().size(); @@ -153,9 +170,9 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand blameResult = new sonia.scm.repository.BlameResult(i, blameLines); } - catch (IOException ex) + finally { - logger.error("could not open repository", ex); + GitUtil.close(gr); } return blameResult; diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java index d127c3d5cb..0663eb6067 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java @@ -111,8 +111,11 @@ public class GitBrowseCommand extends AbstractGitCommand * @return */ @Override - public BrowserResult getBrowserResult(BrowseCommandRequest request) + public BrowserResult getBrowserResult(BrowseCommandRequest request) throws IOException, RepositoryException { + if ( logger.isDebugEnabled() ){ + logger.debug("try to create browse result for {}", request); + } BrowserResult result = null; org.eclipse.jgit.lib.Repository repo = null; @@ -150,10 +153,6 @@ public class GitBrowseCommand extends AbstractGitCommand new ArrayList()); } } - catch (Exception ex) - { - logger.error("could not fetch browser result", ex); - } finally { GitUtil.close(repo); diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java index f8fd7c4777..d4028f9d79 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java @@ -92,10 +92,19 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand * * @param request * @param output + * + * @throws IOException + * @throws RepositoryException */ @Override public void getCatResult(CatCommandRequest request, OutputStream output) + throws IOException, RepositoryException { + if (logger.isDebugEnabled()) + { + logger.debug("try to read content for {}", request); + } + org.eclipse.jgit.lib.Repository repo = null; try @@ -106,11 +115,6 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand getContent(repo, revId, request.getPath(), output); } - catch (Exception ex) - { - //TODO throw - logger.error("could not fetch content", ex); - } finally { GitUtil.close(repo); @@ -132,7 +136,7 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand * @throws RepositoryException */ void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, - String path, OutputStream output) + String path, OutputStream output) throws IOException, RepositoryException { TreeWalk treeWalk = null; diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java index 170db0a68e..27e5dc4183 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java @@ -155,6 +155,7 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand } catch (Exception ex) { + // TODO throw exception logger.error("could not create diff", ex); } finally diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 1fa98e23b2..51d4748b6e 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -57,6 +57,7 @@ import sonia.scm.util.IOUtil; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; /** @@ -150,9 +151,12 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand * @param request * * @return + * + * @throws IOException */ @Override public ChangesetPagingResult getChangesets(LogCommandRequest request) + throws IOException { if (logger.isDebugEnabled()) { @@ -242,11 +246,16 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand } catch (NoHeadException ex) { - logger.error("could not read changesets", ex); - } - catch (IOException ex) - { - logger.error("could not open repository", ex); + if (logger.isTraceEnabled()) + { + logger.trace("repository seems to be empty", ex); + } + else if (logger.isWarnEnabled()) + { + logger.warn("repository seems to be empty"); + } + + changesets = new ChangesetPagingResult(0, new ArrayList()); } finally { From 293e585d47b1d2ea690d397c645584d0ddb5152d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 14:30:25 +0200 Subject: [PATCH 024/159] fix unit tests for git commands --- .../repository/spi/GitBrowseCommandTest.java | 28 +++++++++++-------- .../scm/repository/spi/GitCatCommandTest.java | 17 +++++++++-- .../scm/repository/spi/GitLogCommandTest.java | 20 ++++++++++--- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java index 9ffe865e97..faa6b4b041 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java @@ -37,11 +37,14 @@ import org.junit.Test; import sonia.scm.repository.BrowserResult; import sonia.scm.repository.FileObject; +import sonia.scm.repository.RepositoryException; import static org.junit.Assert.*; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; + import java.util.List; /** @@ -54,9 +57,12 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException + * @throws RepositoryException */ @Test - public void testBrowse() + public void testBrowse() throws IOException, RepositoryException { BrowserResult result = new GitBrowseCommand( repository, @@ -98,21 +104,23 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase assertEquals("c", c.getName()); assertEquals("c", c.getPath()); } - + /** * Method description * + * + * @throws IOException + * @throws RepositoryException */ @Test - public void testBrowseSubDirectory() + public void testBrowseSubDirectory() throws IOException, RepositoryException { BrowseCommandRequest request = new BrowseCommandRequest(); + request.setPath("c"); - - BrowserResult result = new GitBrowseCommand( - repository, - repositoryDirectory).getBrowserResult( - request); + + BrowserResult result = new GitBrowseCommand(repository, + repositoryDirectory).getBrowserResult(request); assertNotNull(result); @@ -134,7 +142,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase else if ("e.txt".equals(f.getName())) { e = f; - } + } } assertNotNull(d); @@ -144,7 +152,6 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase assertEquals("added file d and e in folder c", d.getDescription()); assertTrue(d.getLength() > 0); checkDate(d.getLastModified()); - assertNotNull(e); assertFalse(e.isDirectory()); assertEquals("e.txt", e.getName()); @@ -153,5 +160,4 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase assertTrue(e.getLength() > 0); checkDate(e.getLastModified()); } - } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java index 154e9d0a36..431051aeac 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java @@ -35,11 +35,14 @@ package sonia.scm.repository.spi; import org.junit.Test; +import sonia.scm.repository.RepositoryException; + import static org.junit.Assert.*; //~--- JDK imports ------------------------------------------------------------ import java.io.ByteArrayOutputStream; +import java.io.IOException; /** * TODO add not found test @@ -52,9 +55,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException + * @throws RepositoryException */ @Test - public void testCat() + public void testCat() throws IOException, RepositoryException { CatCommandRequest request = new CatCommandRequest(); @@ -66,9 +72,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException + * @throws RepositoryException */ @Test - public void testSimpleCat() + public void testSimpleCat() throws IOException, RepositoryException { CatCommandRequest request = new CatCommandRequest(); @@ -83,8 +92,12 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase * @param request * * @return + * + * @throws IOException + * @throws RepositoryException */ private String execute(CatCommandRequest request) + throws IOException, RepositoryException { String content = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 5945c38203..0d8ccaa9ff 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -43,6 +43,10 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + /** * * @author Sebastian Sdorra @@ -53,9 +57,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException */ @Test - public void testGetAll() + public void testGetAll() throws IOException { ChangesetPagingResult result = new GitLogCommand( repository, @@ -70,9 +76,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException */ @Test - public void testGetAllByPath() + public void testGetAllByPath() throws IOException { LogCommandRequest request = new LogCommandRequest(); @@ -92,9 +100,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException */ @Test - public void testGetAllWithLimit() + public void testGetAllWithLimit() throws IOException { LogCommandRequest request = new LogCommandRequest(); @@ -149,9 +159,11 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase /** * Method description * + * + * @throws IOException */ @Test - public void testGetRange() + public void testGetRange() throws IOException { LogCommandRequest request = new LogCommandRequest(); From eecaa04f055c65803d394ac0c29c37726088d3ec Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 14:44:08 +0200 Subject: [PATCH 025/159] added unit test for git blame command --- .../repository/spi/GitBlameCommandTest.java | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java new file mode 100644 index 0000000000..8cb1d5d13c --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.BlameLine; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class GitBlameCommandTest extends AbstractGitCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResult() throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + + BlameResult result = new GitBlameCommand(repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + line = result.getLine(1); + assertEquals(2, line.getLineNumber()); + assertEquals("fcd0ef1831e4002ac43ea539f4094334c79ea9ec", + line.getRevision()); + checkDate(line.getWhen()); + assertEquals("line for blame", line.getCode()); + assertEquals("added new line for blame", line.getDescription()); + assertEquals("Zaphod Beeblebrox", line.getAuthor().getName()); + assertEquals("zaphod.beeblebrox@hitchhiker.com", + line.getAuthor().getMail()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResultWithRevision() + throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("86a6645eceefe8b9a247db5eb16e3d89a7e6e6d1"); + + BlameResult result = new GitBlameCommand(repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(1, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + } + + /** + * Method description + * + * + * @param line + */ + private void checkFirstLine(BlameLine line) + { + assertEquals(1, line.getLineNumber()); + assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", + line.getRevision()); + checkDate(line.getWhen()); + assertEquals("a", line.getCode()); + assertEquals("added a and b files", line.getDescription()); + assertEquals("Douglas Adams", line.getAuthor().getName()); + assertEquals("douglas.adams@hitchhiker.com", line.getAuthor().getMail()); + } +} From 18ee133859e057349785cdb58f7e75469696aa46 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 14:55:12 +0200 Subject: [PATCH 026/159] check read permissions in the repository service factory --- .../api/RepositoryServiceFactory.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index 55097b5433..e55bcfce8c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -38,14 +38,19 @@ package sonia.scm.repository.api; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.inject.Inject; +import com.google.inject.Provider; import com.google.inject.Singleton; import sonia.scm.cache.CacheManager; +import sonia.scm.repository.PermissionType; +import sonia.scm.repository.PermissionUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryNotFoundException; import sonia.scm.repository.spi.RepositoryServiceProvider; import sonia.scm.repository.spi.RepositoryServiceResolver; +import sonia.scm.security.ScmSecurityException; +import sonia.scm.web.security.WebSecurityContext; //~--- JDK imports ------------------------------------------------------------ @@ -91,15 +96,18 @@ public final class RepositoryServiceFactory * * @param cacheManager cache manager * @param repositoryManager manager for repositories + * @param securityContextProvider provider for the current security context * @param resolvers a set of {@link RepositoryServiceResolver} */ @Inject - public RepositoryServiceFactory(CacheManager cacheManager, - RepositoryManager repositoryManager, - Set resolvers) + public RepositoryServiceFactory( + CacheManager cacheManager, RepositoryManager repositoryManager, + Provider securityContextProvider, + Set resolvers) { this.cacheManager = cacheManager; this.repositoryManager = repositoryManager; + this.securityContextProvider = securityContextProvider; this.resolvers = resolvers; } @@ -119,6 +127,8 @@ public final class RepositoryServiceFactory * @throws RepositoryServiceNotFoundException if no repository service * implementation for this kind of repository is available * @throws IllegalArgumentException if the repository id is null or empty + * @throws ScmSecurityException if current user has not read permissions + * for that repository */ public RepositoryService create(String repositoryId) throws RepositoryNotFoundException @@ -152,6 +162,8 @@ public final class RepositoryServiceFactory * @throws RepositoryServiceNotFoundException if no repository service * implementation for this kind of repository is available * @throws IllegalArgumentException if one of the parameters is null or empty + * @throws ScmSecurityException if current user has not read permissions + * for that repository */ public RepositoryService create(String type, String name) throws RepositoryNotFoundException @@ -188,11 +200,17 @@ public final class RepositoryServiceFactory * @throws RepositoryServiceNotFoundException if no repository service * implementation for this kind of repository is available * @throws NullPointerException if the repository is null + * @throws ScmSecurityException if current user has not read permissions + * for that repository */ public RepositoryService create(Repository repository) { Preconditions.checkNotNull(repository, "repository is required"); + // check for read permissions of current user + PermissionUtil.assertPermission(repository, securityContextProvider, + PermissionType.READ); + RepositoryService service = null; for (RepositoryServiceResolver resolver : resolvers) @@ -225,4 +243,7 @@ public final class RepositoryServiceFactory /** Field description */ private Set resolvers; + + /** Field description */ + private Provider securityContextProvider; } From d42a3c089e96e2cfeb4aeaa47d1b8089ecc991f7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 15:12:48 +0200 Subject: [PATCH 027/159] start implementation of new repository api for svn --- .../java/sonia/scm/repository/SvnUtil.java | 29 +++++ .../repository/spi/AbstractSvnCommand.java | 89 +++++++++++++ .../scm/repository/spi/SvnCatCommand.java | 119 ++++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 107 ++++++++++++++++ .../spi/SvnRepositoryServiceResolver.java | 94 ++++++++++++++ 5 files changed, 438 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java index 20491121ef..ebd05a6926 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java @@ -89,6 +89,35 @@ public class SvnUtil { appendModification(modifications, entry.getType(), entry.getPath()); } + + /** + * Method description + * + * + * @param revision + * + * @return + * + * @throws RepositoryException + */ + public static long getRevisionNumber(String revision) throws RepositoryException + { + long revisionNumber = -1; + + if (Util.isNotEmpty(revision)) + { + try + { + revisionNumber = Long.parseLong(revision); + } + catch (NumberFormatException ex) + { + throw new RepositoryException("given revision is not a svnrevision"); + } + } + + return revisionNumber; + } /** * Method description diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java new file mode 100644 index 0000000000..27ce9637ec --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.io.SVNRepositoryFactory; + +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractSvnCommand +{ + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + protected AbstractSvnCommand(Repository repository, File repositoryDirectory) + { + this.repository = repository; + this.repositoryDirectory = repositoryDirectory; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @return + * + * @throws SVNException + */ + public SVNRepository open() throws SVNException + { + return SVNRepositoryFactory.create(SVNURL.fromFile(repositoryDirectory)); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + protected Repository repository; + + /** Field description */ + protected File repositoryDirectory; +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java new file mode 100644 index 0000000000..57f01c74dd --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNProperties; +import org.tmatesoft.svn.core.io.SVNRepository; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnCatCommand extends AbstractSvnCommand implements CatCommand +{ + + /** + * the logger for SvnCatCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(SvnCatCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + SvnCatCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public void getCatResult(CatCommandRequest request, OutputStream output) + throws IOException, RepositoryException + { + if (logger.isDebugEnabled()) + { + logger.debug("try to get content for {}", request); + } + + long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision()); + SVNRepository svnRepository = null; + + try + { + svnRepository = open(); + svnRepository.getFile(request.getPath(), revisionNumber, + new SVNProperties(), output); + } + catch (SVNException ex) + { + logger.error("could not open repository", ex); + } + finally + { + SvnUtil.closeSession(svnRepository); + } + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java new file mode 100644 index 0000000000..76ac26dc08 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.ImmutableSet; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.SvnRepositoryHandler; +import sonia.scm.repository.api.Command; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +import java.util.Set; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnRepositoryServiceProvider extends RepositoryServiceProvider +{ + + /** Field description */ + private static final Set COMMANDS = ImmutableSet.of(Command.CAT); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + * @param repository + */ + SvnRepositoryServiceProvider(SvnRepositoryHandler handler, + Repository repository) + { + this.repository = repository; + this.repositoryDirectory = handler.getDirectory(repository); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public SvnCatCommand getCatCommand() + { + return new SvnCatCommand(repository, repositoryDirectory); + } + + /** + * Method description + * + * + * @return + */ + @Override + public Set getSupportedCommands() + { + return COMMANDS; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private Repository repository; + + /** Field description */ + private File repositoryDirectory; +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java new file mode 100644 index 0000000000..c48866cd27 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.inject.Inject; + +import sonia.scm.plugin.ext.Extension; +import sonia.scm.repository.Repository; +import sonia.scm.repository.SvnRepositoryHandler; + +/** + * + * @author Sebastian Sdorra + */ +@Extension +public class SvnRepositoryServiceResolver implements RepositoryServiceResolver +{ + + /** Field description */ + public static final String TYPE = "svn"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + */ + @Inject + public SvnRepositoryServiceResolver(SvnRepositoryHandler handler) + { + this.handler = handler; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public SvnRepositoryServiceProvider reslove(Repository repository) + { + SvnRepositoryServiceProvider provider = null; + + if (TYPE.equalsIgnoreCase(repository.getType())) + { + provider = new SvnRepositoryServiceProvider(handler, repository); + } + + return provider; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private SvnRepositoryHandler handler; +} From 018926632aba5e2f8d1b0e58c623167dbb5c0ce7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 15:42:28 +0200 Subject: [PATCH 028/159] implement browse command for subversion --- .../scm/repository/spi/SvnBrowseCommand.java | 234 ++++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 15 +- 2 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java new file mode 100644 index 0000000000..6b7d6e4d17 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.tmatesoft.svn.core.SVNDirEntry; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNNodeKind; +import org.tmatesoft.svn.core.SVNProperties; +import org.tmatesoft.svn.core.SVNProperty; +import org.tmatesoft.svn.core.io.SVNRepository; + +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.FileObject; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SubRepository; +import sonia.scm.repository.SvnUtil; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBrowseCommand extends AbstractSvnCommand + implements BrowseCommand +{ + + /** + * the logger for SvnBrowseCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(SvnBrowseCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + SvnBrowseCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public BrowserResult getBrowserResult(BrowseCommandRequest request) + throws IOException, RepositoryException + { + String path = request.getPath(); + long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision()); + + if (logger.isDebugEnabled()) + { + logger.debug("browser repository {} in path {} at revision {}", + new Object[] { repository.getName(), + path, revisionNumber }); + } + + BrowserResult result = null; + SVNRepository svnRepository = null; + + try + { + svnRepository = open(); + + Collection entries = + svnRepository.getDir(Util.nonNull(path), revisionNumber, null, + (Collection) null); + List children = new ArrayList(); + String basePath = Util.EMPTY_STRING; + + if (Util.isNotEmpty(path)) + { + basePath = path; + + if (!basePath.endsWith("/")) + { + basePath = basePath.concat("/"); + } + } + + for (SVNDirEntry entry : entries) + { + children.add(createFileObject(svnRepository, revisionNumber, entry, + basePath)); + } + + result = new BrowserResult(); + result.setRevision(String.valueOf(revisionNumber)); + result.setFiles(children); + } + catch (SVNException ex) + { + logger.error("could not open repository", ex); + } + finally + { + SvnUtil.closeSession(svnRepository); + } + + return result; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * + * @param repository + * @param revision + * @param entry + * @param path + * + * @return + */ + private FileObject createFileObject(SVNRepository repository, long revision, + SVNDirEntry entry, String path) + { + FileObject fileObject = new FileObject(); + + fileObject.setName(entry.getName()); + fileObject.setPath(path.concat(entry.getRelativePath())); + fileObject.setDirectory(entry.getKind() == SVNNodeKind.DIR); + + if (entry.getDate() != null) + { + fileObject.setLastModified(entry.getDate().getTime()); + } + + fileObject.setLength(entry.getSize()); + fileObject.setDescription(entry.getCommitMessage()); + + if (fileObject.isDirectory() && entry.hasProperties()) + { + fetchExternalsProperty(repository, revision, entry, fileObject); + } + + return fileObject; + } + + /** + * Method description + * + * + * @param repository + * @param revision + * @param entry + * @param fileObject + */ + private void fetchExternalsProperty(SVNRepository repository, long revision, + SVNDirEntry entry, FileObject fileObject) + { + try + { + SVNProperties properties = new SVNProperties(); + + repository.getFile(entry.getRelativePath(), revision, properties, null); + + String externals = properties.getStringValue(SVNProperty.EXTERNALS); + + if (Util.isNotEmpty(externals)) + { + SubRepository subRepository = new SubRepository(externals); + + fileObject.setSubRepository(subRepository); + } + } + catch (SVNException ex) + { + logger.error("could not fetch file properties"); + } + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index 76ac26dc08..61e2565d42 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -53,7 +53,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.CAT); + private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, + Command.CAT); //~--- constructors --------------------------------------------------------- @@ -73,6 +74,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public SvnBrowseCommand getBrowseCommand() + { + return new SvnBrowseCommand(repository, repositoryDirectory); + } + /** * Method description * From 16665a0b6713d146d24fce43bdf42a9697735673 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 15:48:50 +0200 Subject: [PATCH 029/159] implement diff command for subversion --- .../scm/repository/spi/SvnDiffCommand.java | 154 ++++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 14 +- 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java new file mode 100644 index 0000000000..10053d99fa --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Preconditions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.tmatesoft.svn.core.SVNDepth; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.wc.DefaultSVNDiffGenerator; +import org.tmatesoft.svn.core.wc.ISVNDiffGenerator; +import org.tmatesoft.svn.core.wc.SVNClientManager; +import org.tmatesoft.svn.core.wc.SVNDiffClient; +import org.tmatesoft.svn.core.wc.SVNRevision; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnUtil; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand +{ + + /** + * the logger for SvnDiffCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(SvnDiffCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public SvnDiffCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public void getDiffResult(DiffCommandRequest request, OutputStream output) + throws IOException, RepositoryException + { + if (logger.isDebugEnabled()) + { + logger.debug("create diff for {}", request); + } + + Preconditions.checkNotNull(request, "request is required"); + Preconditions.checkNotNull(output, "outputstream is required"); + + String path = request.getPath(); + SVNClientManager clientManager = null; + + try + { + SVNURL svnurl = SVNURL.fromFile(repositoryDirectory); + + if (Util.isNotEmpty(path)) + { + svnurl = svnurl.appendPath(path, true); + } + + clientManager = SVNClientManager.newInstance(); + + SVNDiffClient diffClient = clientManager.getDiffClient(); + ISVNDiffGenerator diffGenerator = diffClient.getDiffGenerator(); + + if (diffGenerator == null) + { + diffGenerator = new DefaultSVNDiffGenerator(); + } + + diffGenerator.setDiffAdded(true); + diffGenerator.setDiffDeleted(true); + diffClient.setDiffGenerator(diffGenerator); + + long currentRev = SvnUtil.getRevisionNumber(request.getRevision()); + + diffClient.doDiff(svnurl, SVNRevision.HEAD, + SVNRevision.create(currentRev - 1), + SVNRevision.create(currentRev), SVNDepth.INFINITY, + false, output); + } + catch (SVNException ex) + { + throw new RepositoryException("could not create diff", ex); + } + finally + { + SvnUtil.dispose(clientManager); + } + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index 61e2565d42..7ef0d45cd0 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -54,7 +54,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT); + Command.CAT, Command.DIFF); //~--- constructors --------------------------------------------------------- @@ -98,6 +98,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider return new SvnCatCommand(repository, repositoryDirectory); } + /** + * Method description + * + * + * @return + */ + @Override + public SvnDiffCommand getDiffCommand() + { + return new SvnDiffCommand(repository, repositoryDirectory); + } + /** * Method description * From 334401bf18085d2ddb6c6ddff4ced724bd758cb5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 15:58:44 +0200 Subject: [PATCH 030/159] implement blame command for subversion --- .../scm/repository/spi/SvnBlameCommand.java | 139 ++++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 17 ++- 2 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java new file mode 100644 index 0000000000..e7a50d9d52 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.Lists; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +import org.tmatesoft.svn.core.wc.SVNLogClient; +import org.tmatesoft.svn.core.wc.SVNRevision; + +import sonia.scm.repository.BlameLine; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnBlameHandler; +import sonia.scm.repository.SvnUtil; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand +{ + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + public SvnBlameCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public BlameResult getBlameResult(BlameCommandRequest request) + throws IOException, RepositoryException + { + String path = request.getPath(); + String revision = request.getRevision(); + List blameLines = Lists.newArrayList(); + SVNRepository svnRepository = null; + SVNURL svnurl = null; + SVNRevision endRevision = null; + + if (Util.isNotEmpty(revision)) + { + endRevision = SVNRevision.create(Long.parseLong(revision)); + } + else + { + endRevision = SVNRevision.HEAD; + } + + try + { + svnurl = SVNURL.fromFile(new File(repositoryDirectory, path)); + svnRepository = + SVNRepositoryFactory.create(SVNURL.fromFile(repositoryDirectory)); + + ISVNAuthenticationManager svnManager = + svnRepository.getAuthenticationManager(); + SVNLogClient svnLogClient = new SVNLogClient(svnManager, null); + + svnLogClient.doAnnotate(svnurl, SVNRevision.UNDEFINED, + SVNRevision.create(1l), endRevision, + new SvnBlameHandler(svnRepository, path, + blameLines)); + } + catch (SVNException ex) + { + throw new RepositoryException("could not create blame result", ex); + } + finally + { + SvnUtil.closeSession(svnRepository); + } + + return new BlameResult(blameLines.size(), blameLines); + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index 7ef0d45cd0..25d388d2f7 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -53,8 +53,9 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT, Command.DIFF); + private static final Set COMMANDS = ImmutableSet.of(Command.BLAME, + Command.BROWSE, Command.CAT, + Command.DIFF); //~--- constructors --------------------------------------------------------- @@ -74,6 +75,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public SvnBlameCommand getBlameCommand() + { + return new SvnBlameCommand(repository, repositoryDirectory); + } + /** * Method description * From f7ec60bb9d6b1e6a5259279ed995e9c246701395 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 12 Jun 2012 16:06:05 +0200 Subject: [PATCH 031/159] start implementation of log command for subversion --- .../scm/repository/spi/SvnLogCommand.java | 161 ++++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 14 +- 2 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java new file mode 100644 index 0000000000..1381e57e66 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNLogEntry; +import org.tmatesoft.svn.core.io.SVNRepository; + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnUtil; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.Collection; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnLogCommand extends AbstractSvnCommand implements LogCommand +{ + + /** + * the logger for SvnLogCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(SvnLogCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param repository + * @param repositoryDirectory + */ + SvnLogCommand(Repository repository, File repositoryDirectory) + { + super(repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param revision + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public Changeset getChangeset(String revision) + throws IOException, RepositoryException + { + Changeset changeset = null; + + if (logger.isDebugEnabled()) + { + logger.debug("fetch changeset {}", revision); + } + + SVNRepository repository = null; + + try + { + long revisioNumber = Long.parseLong(revision); + + repository = open(); + + Collection entries = repository.log(null, null, + revisioNumber, revisioNumber, true, + true); + + if (Util.isNotEmpty(entries)) + { + changeset = SvnUtil.createChangeset(entries.iterator().next()); + } + } + catch (NumberFormatException ex) + { + if (logger.isWarnEnabled()) + { + logger.warn("could not convert revision", ex); + } + } + catch (SVNException ex) + { + logger.error("could not open repository", ex); + } + finally + { + SvnUtil.closeSession(repository); + } + + return changeset; + } + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public ChangesetPagingResult getChangesets(LogCommandRequest request) + throws IOException, RepositoryException + { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index 25d388d2f7..ddc49b479d 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -55,7 +55,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private static final Set COMMANDS = ImmutableSet.of(Command.BLAME, Command.BROWSE, Command.CAT, - Command.DIFF); + Command.DIFF, Command.LOG); //~--- constructors --------------------------------------------------------- @@ -123,6 +123,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider return new SvnDiffCommand(repository, repositoryDirectory); } + /** + * Method description + * + * + * @return + */ + @Override + public SvnLogCommand getLogCommand() + { + return new SvnLogCommand(repository, repositoryDirectory); + } + /** * Method description * From 75717bfea0f9a712064760bddefef31e56461313 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 10:28:09 +0200 Subject: [PATCH 032/159] improve log command for svn --- .../scm/repository/spi/SvnLogCommand.java | 86 +++++++++++++++++-- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 1381e57e66..7480fbf7bb 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -33,6 +33,9 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Strings; +import com.google.common.collect.Lists; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,6 +56,7 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.List; /** * @@ -124,14 +128,11 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand } catch (NumberFormatException ex) { - if (logger.isWarnEnabled()) - { - logger.warn("could not convert revision", ex); - } + throw new RepositoryException("could not convert revision", ex); } catch (SVNException ex) { - logger.error("could not open repository", ex); + throw new RepositoryException("could not open repository", ex); } finally { @@ -156,6 +157,79 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand public ChangesetPagingResult getChangesets(LogCommandRequest request) throws IOException, RepositoryException { - throw new UnsupportedOperationException("Not supported yet."); + if (logger.isDebugEnabled()) + { + logger.debug("fetch changesets for {}", request); + } + + ChangesetPagingResult changesets = null; + SVNRepository repository = null; + String startRevision = request.getStartChangeset(); + + try + { + repository = open(); + + long startRev = repository.getLatestRevision(); + long endRev = 0; + long maxRev = startRev; + + if (Util.isNotEmpty(startRevision)) + { + maxRev = Long.parseLong(startRevision); + } + + String[] pathArray = null; + + if (!Strings.isNullOrEmpty(request.getPath())) + { + pathArray = new String[] { request.getPath() }; + } + + List changesetList = Lists.newArrayList(); + Collection entries = repository.log(pathArray, null, + startRev, endRev, true, true); + + for (SVNLogEntry entry : entries) + { + if (entry.getRevision() <= maxRev) + { + changesetList.add(SvnUtil.createChangeset(entry)); + } + } + + int total = changesetList.size(); + int start = request.getPagingStart(); + int max = request.getPagingLimit(); + int end = total - start; + + if (end > max) + { + end = max; + } + + if (start < 0) + { + start = 0; + } + + changesetList = changesetList.subList(start, end); + changesets = new ChangesetPagingResult(total, changesetList); + } + catch (NumberFormatException ex) + { + throw new RepositoryException( + "could not parse revision ".concat(startRevision), ex); + } + catch (SVNException ex) + { + throw new RepositoryException("could not open repository", ex); + } + finally + { + SvnUtil.closeSession(repository); + } + + return changesets; } } From f66c81284a18f822fb6a9d9b68bfb1de3949b172 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 10:32:48 +0200 Subject: [PATCH 033/159] create basic test class for zipped repository tests --- .../spi/AbstractGitCommandTestBase.java | 150 +----------- .../spi/ZippedRepositoryTestBase.java | 215 ++++++++++++++++++ 2 files changed, 223 insertions(+), 142 deletions(-) create mode 100644 scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java index 8ccf81affa..32b2ad826d 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java @@ -31,61 +31,23 @@ package sonia.scm.repository.spi; -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.common.io.Closeables; -import com.google.common.io.Resources; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TemporaryFolder; - -import sonia.scm.repository.Repository; -import sonia.scm.repository.RepositoryTestData; -import sonia.scm.util.IOUtil; - -import static org.junit.Assert.*; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import java.net.URL; - -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - /** * * @author Sebastian Sdorra */ -public class AbstractGitCommandTestBase +public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase { /** * Method description * - */ - @Before - public void before() - { - repositoryDirectory = createRepositoryDirectory(); - } - - /** - * Method description * - * - * @param date + * @return */ - protected void checkDate(Long date) + @Override + protected String getType() { - assertNotNull(date); - assertTrue("Date should not be older than current date", - date < System.currentTimeMillis()); + return "git"; } /** @@ -94,105 +56,9 @@ public class AbstractGitCommandTestBase * * @return */ - protected Repository createRepository() + @Override + protected String getZippedRepositoryResource() { - return RepositoryTestData.createHeartOfGold(); + return "sonia/scm/repository/spi/scm-git-spi-test.zip"; } - - /** - * Method description - * - * - * @return - * - * @throws IOException - */ - protected File createRepositoryDirectory() - { - File folder = null; - - try - { - folder = tempFolder.newFolder(); - folder.mkdirs(); - extract(folder); - } - catch (IOException ex) - { - fail(ex.getMessage()); - } - - return folder; - } - - /** - * Method description - * - * - * @param folder - * - * @throws IOException - */ - private void extract(File folder) throws IOException - { - URL url = - Resources.getResource("sonia/scm/repository/spi/scm-git-spi-test.zip"); - ZipInputStream zip = null; - - try - { - zip = new ZipInputStream(url.openStream()); - - ZipEntry entry = zip.getNextEntry(); - - while (entry != null) - { - File file = new File(folder, entry.getName()); - File parent = file.getParentFile(); - - if (!parent.exists()) - { - parent.mkdirs(); - } - - if (entry.isDirectory()) - { - file.mkdirs(); - } - else - { - OutputStream output = null; - - try - { - output = new FileOutputStream(file); - IOUtil.copy(zip, output); - } - finally - { - Closeables.closeQuietly(output); - } - } - - zip.closeEntry(); - entry = zip.getNextEntry(); - } - } - finally - { - Closeables.closeQuietly(zip); - } - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - - /** Field description */ - protected Repository repository = createRepository(); - - /** Field description */ - protected File repositoryDirectory; } diff --git a/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java b/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java new file mode 100644 index 0000000000..ba5b859f77 --- /dev/null +++ b/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java @@ -0,0 +1,215 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.io.Closeables; +import com.google.common.io.Resources; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryTestData; +import sonia.scm.util.IOUtil; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import java.net.URL; + +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * + * @author Sebastian Sdorra + */ +public abstract class ZippedRepositoryTestBase +{ + + /** + * Method description + * + * + * @return + */ + protected abstract String getType(); + + /** + * Method description + * + * + * @return + */ + protected abstract String getZippedRepositoryResource(); + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + */ + @Before + public void before() + { + repositoryDirectory = createRepositoryDirectory(); + } + + /** + * Method description + * + * + * @param date + */ + protected void checkDate(Long date) + { + assertNotNull(date); + assertTrue("Date should not be older than current date", + date < System.currentTimeMillis()); + } + + /** + * Method description + * + * + * @return + */ + protected Repository createRepository() + { + return RepositoryTestData.createHeartOfGold(getType()); + } + + /** + * Method description + * + * + * @return + * + * @throws IOException + */ + protected File createRepositoryDirectory() + { + File folder = null; + + try + { + folder = tempFolder.newFolder(); + folder.mkdirs(); + extract(folder); + } + catch (IOException ex) + { + fail(ex.getMessage()); + } + + return folder; + } + + /** + * Method description + * + * + * @param folder + * + * @throws IOException + */ + private void extract(File folder) throws IOException + { + URL url = Resources.getResource(getZippedRepositoryResource()); + ZipInputStream zip = null; + + try + { + zip = new ZipInputStream(url.openStream()); + + ZipEntry entry = zip.getNextEntry(); + + while (entry != null) + { + File file = new File(folder, entry.getName()); + File parent = file.getParentFile(); + + if (!parent.exists()) + { + parent.mkdirs(); + } + + if (entry.isDirectory()) + { + file.mkdirs(); + } + else + { + OutputStream output = null; + + try + { + output = new FileOutputStream(file); + IOUtil.copy(zip, output); + } + finally + { + Closeables.closeQuietly(output); + } + } + + zip.closeEntry(); + entry = zip.getNextEntry(); + } + } + finally + { + Closeables.closeQuietly(zip); + } + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + + /** Field description */ + protected Repository repository = createRepository(); + + /** Field description */ + protected File repositoryDirectory; +} From 5801e6d084b6146bd29c37383ad2d692b85b23aa Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:20:22 +0200 Subject: [PATCH 034/159] added unit test for svn cat command --- .../spi/AbstractSvnCommandTestBase.java | 64 +++++++++++ .../scm/repository/spi/SvnCatCommandTest.java | 108 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java new file mode 100644 index 0000000000..a4ff8eab88 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractSvnCommandTestBase extends ZippedRepositoryTestBase +{ + + /** + * Method description + * + * + * @return + */ + @Override + protected String getType() + { + return "svn"; + } + + /** + * Method description + * + * + * @return + */ + @Override + protected String getZippedRepositoryResource() + { + return "sonia/scm/repository/spi/scm-svn-spi-test.zip"; + } +} diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java new file mode 100644 index 0000000000..add8d01e65 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ +package sonia.scm.repository.spi; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import org.junit.Test; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnCatCommandTest extends AbstractSvnCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testCat() throws IOException, RepositoryException + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("1"); + assertEquals("a", execute(request)); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testSimpleCat() throws IOException, RepositoryException + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("c/d.txt"); + assertEquals("d", execute(request)); + } + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private String execute(CatCommandRequest request) + throws IOException, RepositoryException + { + String content = null; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try + { + new SvnCatCommand(repository, repositoryDirectory).getCatResult(request, + baos); + } + finally + { + content = baos.toString().trim(); + } + + return content; + } + +} From 3936fd25a3bd9f7a17d64f1c9118814360c60e97 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:24:24 +0200 Subject: [PATCH 035/159] added unit test for svn browse command --- .../repository/spi/SvnBrowseCommandTest.java | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java new file mode 100644 index 0000000000..354fab6501 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ +package sonia.scm.repository.spi; + +import java.io.IOException; +import java.util.List; +import org.junit.Test; +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.FileObject; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase +{ + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testBrowse() throws IOException, RepositoryException + { + BrowserResult result = new SvnBrowseCommand( + repository, + repositoryDirectory).getBrowserResult( + new BrowseCommandRequest()); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(2, foList.size()); + + FileObject a = null; + FileObject c = null; + + for (FileObject f : foList) + { + if ("a.txt".equals(f.getName())) + { + a = f; + } + else if ("c".equals(f.getName())) + { + c = f; + } + } + + assertNotNull(a); + assertFalse(a.isDirectory()); + assertEquals("a.txt", a.getName()); + assertEquals("a.txt", a.getPath()); + assertEquals("added line for blame test", a.getDescription()); + assertTrue(a.getLength() > 0); + checkDate(a.getLastModified()); + assertNotNull(c); + assertTrue(c.isDirectory()); + assertEquals("c", c.getName()); + assertEquals("c", c.getPath()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testBrowseSubDirectory() throws IOException, RepositoryException + { + BrowseCommandRequest request = new BrowseCommandRequest(); + + request.setPath("c"); + + BrowserResult result = new SvnBrowseCommand(repository, + repositoryDirectory).getBrowserResult(request); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(2, foList.size()); + + FileObject d = null; + FileObject e = null; + + for (FileObject f : foList) + { + if ("d.txt".equals(f.getName())) + { + d = f; + } + else if ("e.txt".equals(f.getName())) + { + e = f; + } + } + + assertNotNull(d); + assertFalse(d.isDirectory()); + assertEquals("d.txt", d.getName()); + assertEquals("c/d.txt", d.getPath()); + assertEquals("added d and e in folder c", d.getDescription()); + assertTrue(d.getLength() > 0); + checkDate(d.getLastModified()); + assertNotNull(e); + assertFalse(e.isDirectory()); + assertEquals("e.txt", e.getName()); + assertEquals("c/e.txt", e.getPath()); + assertEquals("added d and e in folder c", e.getDescription()); + assertTrue(e.getLength() > 0); + checkDate(e.getLastModified()); + } +} From 56452e9de7d8ab66a343c31e242ad5b60350603e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:30:29 +0200 Subject: [PATCH 036/159] added unit test for svn blame command --- .../repository/spi/SvnBlameCommandTest.java | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java new file mode 100644 index 0000000000..a4b49baffc --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.BlameLine; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBlameCommandTest extends AbstractSvnCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResult() throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + + BlameResult result = new SvnBlameCommand(repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + line = result.getLine(1); + assertEquals(2, line.getLineNumber()); + assertEquals("5", line.getRevision()); + checkDate(line.getWhen()); + assertEquals("line for blame test", line.getCode()); + assertEquals("added line for blame test", line.getDescription()); + assertEquals("zaphod", line.getAuthor().getName()); + assertNull(line.getAuthor().getMail()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResultWithRevision() + throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("3"); + + BlameResult result = new SvnBlameCommand(repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(1, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + } + + /** + * Method description + * + * + * @param line + */ + private void checkFirstLine(BlameLine line) + { + assertEquals(1, line.getLineNumber()); + assertEquals("3", line.getRevision()); + checkDate(line.getWhen()); + assertEquals("a and b", line.getCode()); + assertEquals("remove b and modified a", line.getDescription()); + assertEquals("perfect", line.getAuthor().getName()); + assertNull(line.getAuthor().getMail()); + } +} From 090dfdaaa9134aeb0f2bf83aa02971b0d217851d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:39:57 +0200 Subject: [PATCH 037/159] remove leading slash from svn modification paths --- .../java/sonia/scm/repository/SvnUtil.java | 66 +++++++++++-------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java index ebd05a6926..7d1c533d2e 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java @@ -89,35 +89,6 @@ public class SvnUtil { appendModification(modifications, entry.getType(), entry.getPath()); } - - /** - * Method description - * - * - * @param revision - * - * @return - * - * @throws RepositoryException - */ - public static long getRevisionNumber(String revision) throws RepositoryException - { - long revisionNumber = -1; - - if (Util.isNotEmpty(revision)) - { - try - { - revisionNumber = Long.parseLong(revision); - } - catch (NumberFormatException ex) - { - throw new RepositoryException("given revision is not a svnrevision"); - } - } - - return revisionNumber; - } /** * Method description @@ -130,6 +101,11 @@ public class SvnUtil public static void appendModification(Modifications modifications, char type, String path) { + if (path.startsWith("/")) + { + path = path.substring(1); + } + switch (type) { case SVNLogEntryPath.TYPE_ADDED : @@ -227,4 +203,36 @@ public class SvnUtil } } } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param revision + * + * @return + * + * @throws RepositoryException + */ + public static long getRevisionNumber(String revision) + throws RepositoryException + { + long revisionNumber = -1; + + if (Util.isNotEmpty(revision)) + { + try + { + revisionNumber = Long.parseLong(revision); + } + catch (NumberFormatException ex) + { + throw new RepositoryException("given revision is not a svnrevision"); + } + } + + return revisionNumber; + } } From c930ad29e97f82d6b374653c110e0761aefe49b1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:46:22 +0200 Subject: [PATCH 038/159] fix wrong start and end revision for svn log command --- .../java/sonia/scm/repository/spi/SvnLogCommand.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 7480fbf7bb..838d0c90b3 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -165,6 +165,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand ChangesetPagingResult changesets = null; SVNRepository repository = null; String startRevision = request.getStartChangeset(); + String endRevision = request.getEndChangeset(); try { @@ -174,9 +175,14 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand long endRev = 0; long maxRev = startRev; - if (Util.isNotEmpty(startRevision)) + if (!Strings.isNullOrEmpty(startRevision)) { - maxRev = Long.parseLong(startRevision); + startRev = Long.parseLong(startRevision); + } + + if (!Strings.isNullOrEmpty(endRevision)) + { + endRev = Long.parseLong(endRevision); } String[] pathArray = null; From 1d6246dad752e0bb6863d3138e00dba4292e17c7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:46:42 +0200 Subject: [PATCH 039/159] added unit test for svn log command --- .../scm/repository/spi/SvnLogCommandTest.java | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java new file mode 100644 index 0000000000..e632bc1be9 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; +import sonia.scm.repository.Changeset; +import sonia.scm.repository.Modifications; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnLogCommandTest extends AbstractSvnCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetAll() throws IOException, RepositoryException + { + ChangesetPagingResult result = new SvnLogCommand( + repository, + repositoryDirectory).getChangesets( + new LogCommandRequest()); + + assertNotNull(result); + assertEquals(6, result.getTotal()); + assertEquals(6, result.getChangesets().size()); + } + + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetAllByPath() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPath("a.txt"); + + ChangesetPagingResult result = + new SvnLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(3, result.getTotal()); + assertEquals(3, result.getChangesets().size()); + assertEquals("5", result.getChangesets().get(0).getId()); + assertEquals("3", result.getChangesets().get(1).getId()); + assertEquals("1", result.getChangesets().get(2).getId()); + } + + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetAllWithLimit() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingLimit(2); + + ChangesetPagingResult result = + new SvnLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(6, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("5", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("4", c2.getId()); + } + + /** + * Method description + * + */ + @Test + public void testGetCommit() throws IOException, RepositoryException + { + SvnLogCommand command = new SvnLogCommand(repository, repositoryDirectory); + Changeset c = command.getChangeset("3"); + + assertNotNull(c); + assertEquals("3", c.getId()); + assertEquals("remove b and modified a", c.getDescription()); + checkDate(c.getDate()); + assertEquals("perfect", c.getAuthor().getName()); + assertNull("douglas.adams@hitchhiker.com", c.getAuthor().getMail()); + + Modifications mods = c.getModifications(); + + assertNotNull(mods); + assertEquals(1, mods.getModified().size()); + assertEquals(1, mods.getRemoved().size()); + assertTrue("added list should be empty", mods.getAdded().isEmpty()); + assertEquals("a.txt", mods.getModified().get(0)); + assertEquals("b.txt", mods.getRemoved().get(0)); + } + + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetRange() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setStartChangeset("2"); + request.setEndChangeset("1"); + + ChangesetPagingResult result = + new SvnLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c1); + assertEquals("2", c1.getId()); + assertNotNull(c2); + assertEquals("1", c2.getId()); + } +} From 1ef88832b2a41e4ce0f769b4645966cb0f2ed88b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 11:46:57 +0200 Subject: [PATCH 040/159] added missing svn test repository --- .../scm/repository/spi/scm-svn-spi-test.zip | Bin 0 -> 25548 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 scm-plugins/scm-svn-plugin/src/test/resources/sonia/scm/repository/spi/scm-svn-spi-test.zip diff --git a/scm-plugins/scm-svn-plugin/src/test/resources/sonia/scm/repository/spi/scm-svn-spi-test.zip b/scm-plugins/scm-svn-plugin/src/test/resources/sonia/scm/repository/spi/scm-svn-spi-test.zip new file mode 100644 index 0000000000000000000000000000000000000000..6e27feef413bef287d9d7a67bd274a94e6114f25 GIT binary patch literal 25548 zcmbTd1yo(hwl$1HaCdhI5C{&z-QC^Y-7UBi2=4Cg9^BpC-Q7Qu?svQUzP^3m|1(B0 z4r8#_p0#$ZS#!c7z+&7{@&8{jZ((0SSN&AS=MbFCjoYs4LGd9uG=SI@y+hdY4u`z#^f=LGO;mcKsy{tNVdmU>o} zhM)d5!5WqSHNl^k|B)n4`vi4#AOHXskl&K@>vA0jdt=vs#rT^fImiuJF44lbJbgs9 zM(7F9TLFeB*wB;(VT@|vp1`LyHZiEo6!FO^=@0aD3yj6HiAme`7(PCx;=qPAQ4tZ! zl^4Hdo9cvLXFub0{OHa-$I)F(5RDHBy7@=;UDq*IWM}q1i5OGDGu`X-s7!P8@LP|IDLrGeTKg~=o zut=JyN*#-=wGyW>$xcO-#&|_wI9fIIL?_jt2M?UwIC1hg)loKzj}^LF{WE{Uk}wZ5 zalc5bj}}ZyQc5+JSrVHv;^k?D438{0KRozWn(j9@&JgyliQJrfJgV7y`V?6iXDkmi>2#7^TGotBA}S%y=&`^tMK#4t%~UA0;cnFVl$Lgverq3y#f5M34xz&OSkuSK&odV+AxM0gf>RSP zEn$|sCvChYf9_ht%KtJY5;I{>%ksdAK8e>AE5kPC`67uIzrb9>tKpi?VS4d{A-+uv zEl`_a=If~kodg91~d+br5B)Q9WaH29EA~ZCgXc;LH*CtwAQh+bJG8(#U&v{XW7LKz4QVJRFC?=6A-ab zje-+f9foB6J#31^(i3mNa$NE&c}R||XalN^xGaWG&N^OFd;+SiR%v*jWfhoLft}mA ziLi~+L0cvL&B?gIcTt#?aWQG8mx1a7`yWO@A*GNLQRk-@qfIuoD3b`2l3B2F0d}Xl zA)=M#Up9|$171D0wV?P+cK5%$e#GKPwCyAfFATWoI~8PI(qR9-UTo}6_xuR+!C%#F z(>+7TdJDHkt`w_vE7=q9uNesGX@ebouPj99_whd&uyeGuGq80up!r#A|CES0MG31d zLFm>eCHT?K584#XP&MR^8+;R4+&&gi<}sQfxW>VCU>IZQ^hC{r<(~#70^=G&PX?+O z+==n$>iF^TJdo+%L)A(ThRJ`cpR5#RzqDyPyYjp?1K!L*r)bzLt z9)3>r#p3~c4l!h?0JA>W)PfgZjLg2UMQuNs3&w4j_U^87C5@baG_RXT5hjlF_)Mp7 z9vlz7=VFUziW)7n{dSu?<3-H}m(|IB6~*H#Hj;L7(ndR1hzd4(%8q0RZEiWP8rkl4 zOd+idOuaH^ymHaE)Ac21GIy|>*uq4dIV&@;aG|0Y*65SL6gpM8t`8Ps=0hsfW1YmR zWjYuTX0LJM@yGt(7dCxlKUm11e`{E0M@@hXkeACrGR_`z9 z3sG0e&Adwl#(-6LwXTVUaCNL`n*+8xq*0(pCCp0T9rm#^&#~Ro@5#!;sbku~{J>#2 zcL6SrRPU#rxC$n9O}bt`I%jRkZ&FRE?uXI%U`j|&Z82?aLyt5~>KDd}N7q{o=OAO{ zRyoo<^JqF-(B%SJK(~R~$dRko@RXK`4`nmqo-(qm%JNRRsY zwU5XParMajZChCkyiAnzN5iUoR!pKjK}huX&X=$`iB}~loH0A8?hbStRK(jIiMvDz&06kC87^0HR7TnZ3oNgN$*n9(;U)XlV! zgSR<7!A0fR=sO9|V<_DK)+Hem@`&L(2@1T%lI>My%Y*(CvzLquo#lxc-u@SH1(GXiQ*7}iwc(TJ34EW-Pnq;!GX9nM2P&~?UN zOp{9~Dhl{Rvk! zJ}7N*Gr?jmGN)Ro5H>Cjm92XvrgU?otL-E5Cs_`m+OCwwAK}H0=)8bXu5u5kessQ> zwpO@}kH;SUpn(k>25LvMvb_}BYE$!~o1xcc8Zf9%=^&yfg+89=aR3Vib|K;OI z+Rb|X1wj#N=uJZ9hUwfd6T+r+ptf$Ky2|o} zrVl_T9lAo9?O&b2(M9HzSr|2KB=ZdY+x&ntkreMSi+J-#XU{p?M`NsmZ+%tC31Sk> zVUBoaQM=Nhh9a<+GMVJZ8<#&py%^`M&{$cV56kuJcKA09&@Ib0e%g2m#Cxo`FI<-p z*U8g!%9Zq8eY+75263Y;YXDg5V0Q_A8`ko?KYi+H|3kL)zl*a!%NF2wX4KdHO|&#f z%uD?T(ej(-`FXJtD+lnqW&!v)ek!~7i}f6AZ4E4cQ+7XN{EcW~g!}`-Pkl)6nPngK zJ;KlN;kPJ;R<;&8|0oX`AkB4LtQ_p|?TmG7^$qm#>1b(b|1B^(tPmjRd(fZbcX)<& z)b=jc2LHtNhIWQ_zXJUs&Ws*s0ULk;0P?{B0HA+I`2Ju2b>nbQ7>d|pf^Qj9Vptce zs^GX#2O8G3>Lhd<0K1^Fg|N-Y`QAe%0O=mK&_Ww4|)aeGKq{UKOX^b*~8uD26zbTNV+$1nZ}<$jH4b7cO+K&rh7g zksmjS!U-m^vohAVmX+Q7RU!e8NQ7swXpEA{N*i*Ow;`383vQya7$(&|)FJ174 z-ASY*ivMVyrDuJLqwwDggaHYqV0PID#!2&Be)Decy4pCmXIbaoX4PM9jeg|5+6i~S z+pOAaA8BFv-gdJ(rLb$pGlQO8Lk4%*<%Tm~Y$K3f2N=S1eYLkWbXA`2<+iXkR6Uw2 zgoQIN1;%|JJ2srQyIBPaImG2GBd!ahlYj0sevVoaj7IzqDJ)Xj+! zltlLJ4Bq&2xq6?4TwUAP_0CX!ddy)zb zr$8y*vqXt)^}tW&Da{=p+PQ5%)A)-XNcayBgI@ZGcS@vNXuS}VhMETue;u7L1Y-se zj-TAth;&AO6VmF3+&v|XWg%JOk%u2aKxYBlq!X#TR)v~A!{^PTtOz|0OW8*6B);}Q z&~v5ZOv=_f$cd0Hv-JL0l@*kSXm=E9?X+QE^-5eJeqP?5g~Mx8?er=mL(z8^7}V;4MFB=#m6T!iR?wSn zhNk`;v<+a}ab!NG*p$aoIP~_?C&P^b_I@!7D*pxT+6}EZ#Vbd_?_16i^UMlgGk^%7 zE0XVVb-7o~WfWO!X2}zkG8BbiS}M@|gnIToqo;Q0NV{{WwjI?BqF>CN7OS!~JDWYQ+P5`5skcDN3otURC$tqO|Ht7vZ z-YhF{_#{*uA7Tp2kxSNTXJ-J4Dl151j(}ZMR9HK1za6S89pfC-01;dPM}p;cFW(%T z-kRGz{D~re@)P2SsOSH%9MW&qZ((9d?OI+TUGRKW zTiumb$jF(&mVUCtjs=u`o{AqWj*Ov_9R12W!Pl#;7lNfal;(BNU|DbuS>#L5xHFz} z$R2v$_TtH1z1rO;Fh;x^F1CfoAcPPgfv$t#ze;xreJ%UoIhc*-;_WE`%<=4Mh2zDi z;~e}$?D+xAL!c*p{l(MTEPDo$6MMwo1_Fr%1KlEE4(d54x!#TSpcc=`w#r$&4uXJ> z11CoFwMppq)}!UnzW?fU)Uw%)J8cJiNt4dUDf__KUEJ~3^alj=52(}Xini!_Aco7Tse@!bt{LDLN2atrzaDVtd0mxJYX-da)%Td-Bl3qDBIFiPE#C z6!sQJmg-j|xJ8KTizt=ACLZ0A=VA1E;XD4agCw6(UK5O~F{<{9V8{n>#$v=tP-78Z zL585K+hno|GF2!6I_B;X-4zHE99k-dnd`w2PtA7=@}g`^poKGlCgqVa*G%rQJTwVW zAhL55Dq|CMmyM4K$aO8C;u@9Fp@PNb5t#Ter=QH)zBY?PCd#gV7Lz+Hp&>@oriY&u zK3JpOjjhVUSQXrP*1{J*M{^J0@<(&NvwG_Z30doBIxRPczmaVzVw@Je7)+B6QF8Q? zZK;C$((zKOfV0m2*B$nKvHk1k_xv-#-^`hZvd%?|Ct%`GcDa`YFZ|0 zI(m6p7B)I2HhN|nW@aV^Mix~_0ZINpZRCRQQ;=7gwA6XOt;yfsn(o)FbKd9hH>%}I zk(Obdl4ht{l!|(w|I;R<9PN&%xX3W|?xkV{fLIRk_Z%Sq@ZrWVXy|Zzm|=UEa6V|N z5@_nuFqrFM=;5$o>MZY~k`oSZyz;=?%kSnI~eMr*)dcG7PwA@Pn> z%YScD>m8->-y;3|3u)EgBgGl4gyp7%2N-{8%i`ib6|G^TXQT`6RBR03q1*@>n^V?G zQ~GMnG2pLOxAj$Iri1Q-vw_zhK3y?WMzp<;1kX&+tcksRT<4*^9Crsc#3i z3UzJ^(93uy_#d6M+&j+LHVb33cZ^Pdi{M#()Z9axestg8T!gJA{6^AF6b@0ihp^878{@w)ykW`GO%sxbi}Q0i7l z=6|66S$-cca@Z~35j+1aYQ|rvf7ajMtX-VJKcmJ5mW)f3j7xwAPL75VfP^sx2F}m7 ze|ft>hu9rUxYh{#+=&6&_J|q66M5n)Ui>MQh!)gRIH`g|COJVaYDDrYkp?P`QtHr4 zI_`EJ)G{%+a*f%i9(Li~Gy zpbZ0*u$des6ob+4Z#a?%(YqP87**ZF^uw2?i$(AU3e?1coEshkz^TTD@5G1SS(3o() z9dbb-9WM!~mRoU4rZkorMUHXfu3(mUuW2#4s99_lvbtVwL?=H^OD%R*6#p_ZtpYe; zo5O>JPh9ej8O{9dZ0Z;X#z*fJ!-occGWm1*vuMU^Pp8G)-LieBC_ZTx$8krSgaTdq z>kBPBwNTl+NR4q$lU)ANMEP_SRv@f&6D@T!)MPBVySVbhh-74-q7{uchVC3%z?LuFSkt11_jZ*>`|Y@1R4sRK z4l8qHnsA&H5Q08T_F{-V@qu`K@z{>xjo7OSo`FuTYCz&~E{h6-ci{WlEt9pmN>-+> zzsP?O4jWLT2-a9nFf$nqGg`nu892Y+%MyT8;t0}K`{2<_$vm>BzFHT5>U_*q4XIt7 z#8tYH_@QFXc}SXfOsS%>uNSv@Y^D8KsCfSMa~tU7^4G35zq-)7g5~W)O#lu^?$X2- z*q%jlq=CS7L=sDqMQsq$WN64!TuCnn$CnrN?nD?J+nwPRiYk4$^b1WuZUVh!hJ_)f1g{8$Q9Ec-0*_MN{;Een%vdZ$;XzqWc$C?>QWUK z5@rQy&c}VM>&j*((@I)ew6(rr)?ev`z@{~NPw~Fa7Ywe5HZs&>PH(-Tn@xj89f<;O zDVtuS)?wSx&BAQRLqnmGqk~V~;>Np6U7U*ERFiZTiDgi*U@d&OEw#qc6;a0g7?AnC z6gV-EAdr028r<3D=dnX<`$=k&s+ea3@JjN?gDUWH(XB*Rso{7i`i`iPbgd_n9!q(V z*q?iuiXWzuIQTjPoS_Ql6YnL7A68gleWZ7@(34(Gog?@|28%OVK0s3O6kWxx?)l1% zFJqO76NHsA?v7F*Yi768z4hT_=zjJaV`8{5c^txg0_L%B(z2fsm$2cPfHxM34mccd zvR@fD7y!{vtj7Bz>4on}r&%-)E_qLQz`HB)S3dh~`||wzr2EJGIxiAHa_TEzhnwHD z79{R#2Dr^K)&{YNE+vTJo933rDgz>3@^mRAFT%-(^NvMz!cWT{nt8lE3V*b1Z)|Hy z8sSubOEIWjE#WLbn?BSama7>Ov)HSl4JBfvE_{8!7t?Tr%bI+>aBH6yyt$NL%LxaY zR17r$Aur>m8b@Jjt3amVr^|qmfdZ%6AD}nb*cPVc^QDRkmiXM}Kqwp1%gVH*n9Dck zrFKZl=rX}|bF9azKI;4%PYDC+|v=2}=_+ zT7Ny?2h&?NExr@7{s8xG!BR>FKYP}%A9`J}*2e?5WRPQg%p{)}IuT`A_LO$`2P#U& zRW=&Jb+AQwXh2X0oDZPm#O320jP(?H*3p@XW0Awu!}6e)l_rkpY%E&xMUe(GsW@30 zfOE$_pfZT=#oEEe*O}N7cL8a)rnHr4`#`d}_^Ef*UIGsQT`{Nb9x;hsQV#H%y7+r3 za~mPLKM$qDFh7sx#5GJ5vwI|N)V9FV2OyAba#HG1hsuDCHhz|zN)T|{dx)GwkxayN z3NPO>xbKQyl;cFVh}@_H@?M6`MLvi5S#p1vo$t!wUqA4_NeFve9ZNeMJ$n-?%ijgf zKZub(BK_Gm{k@U0cebSd|6!f}3()(A->r#1MWQyh(lh&|3;)9z`+uGw!tWD&hxOhj z+FSh+OTR+>*BSn7@%D2c%}L%d{T$%Gg>rB(`Nz{neFj5A17_CG)CTWHE;R!!Gb^>O zt|2|O0iDigRy`(N26}qBfAe?$JbRem?&4%?VsG&OVctK%{`ql$y@&bl=JTH&Y_@l4 z{%0URBN$s*nf<;XqTUtxfAG=&P^Wvj-lqfaOy2nJFQfkJdTT2?dulx^3kwr_8hZ#vPq*UEnB1$%7%er7Km*q_k~q6jis&jtRE6;VhOj8;jeAM(@B?m8;%q8vAbW^1_cZ^ zQh>9a#)=?}Ek!UY4VACb2fuV29Qp)wXqr|$(wepqq$D}ZW0A0Rzd{Y~ElTgNz@p}N zgpykj9^n_XT6N&h)LsCKGQ@WQtTkNGOer!!AIXSA1%2Lghz7~$jZlYy3C(6eY}Mm% zxj+U~HtK#xi66E~8py&$KT>YS?0_UZN#WyoFb&x%2{Xk3zl|8^1A}a1Nqid^`a`ql z%zQbROth`C9Xf>Am&OxEdvmt4zqiGf?}r1ns|JOh=9(;)p4MI?5en1Na$O4DnkXUn zc9Majpoe3?7_`B>6Py0GELjBw>>u(c$9GsBZ<7@rBPa4C-yT0<;h)y+dlX8u zqqHF|c&&JD zaKCa4PM5mBuxwPeH)f074|D(?^tigqiu}d43|ZC z{kT9CCcYeMAJ!1JRanNbDQhAc7mjaG9oztkq!cw|EW{0m?F!))P>0jFea)_<5=SN} zGc88^RKO@=nHaUPUwTu@{UmM8&4eN;(L>X-r%pA|9?7-8M7Ce?_-OOy>(|)5i}>wK z2FTA>gwsBhbNc|i^_0^i`y!q%ssG2wH&|#wfnEF>G-j1(#!Yn+)6RfbGhIx15W2=l z86b~{k;~NZtd-aD_V#i0;EGr0^4qOP6Oq*gSiH8!&pCyiLOFAk8`RqtG1~%&0n~$g0XG9>E(4P; z%n_WIwa15P$`%+zfv_JXqX0V>ZpHR~AXM?_%zAhefUn!#cJF^_e^VgT&yDV)N=xmz z2}{y15lMy6sw(wo){^&+0XM>~uTu-Z{_3tZiHbN?Opg|#!C(H#PIp~t5VB}D>%$jk z)gt<}NSMtlh%7{Y|7ZhGwQDfoal>TdN-N1+>0){2WgtK9ZgM^peb~Qk` zUM!(XUl4s#BHg9qNi~*^uqklB-eb3D$4Xf1EpAD*>izzW@w%C!A+Ck9fT1g-k&E|& z-XvG&a6cn!LLX9bfh2{08x(j!?$dH|U|zIm!3hA9r3glR=bMfTA2Zb!8*SUzH<49s zyu35Ke53{O`#XlXmo`0!-nh?-{QY#;a%opl(0wE-qtBGCc5R@-xCyAh^b8wU{8_9e zM`i8FZDZPU&jBCpwN8BlQh%*VneV7|SJROrcAmPsvL+Bb!G%hmYk@4eI4@qoe!Q zQ~3715B@!E)p=_2;p6OIdlQ7BU~^7Kh-UHYaH%0O#&W(10(*tc;z491z>4z2WR+E> z@tK)6#v$udO&5&owSqK28ALMmE@t4|2dwKQ#qj777COcHWjHC;&^pA$rKSUO>Y%ic zqm24IBHnVJx!0!npi<8wr?yY(oJHyCFDlg!8QhN zX+g6h9$;f^ zZ_`S#?zNH}Kr+y~9D}QPY-&{1;*#=&-aNZfNDD~y8Vj@;b6I_;|03begy>lR;OLMV z(xCMMeE#Y|HC6EVbsh?3Q=e@Edty}#kj@fA=Cwmq`l#<#FkBXgR|WY7kdhC0rv=|0 zCT@Ju8Ic4;11sDPXhYjQCXKT+5=8JN+*Pmftfo??ELkc4D|Z3y_vmKLk8Gm^&V|Hs zCK)_4fCe386QbdMMGU7}4oOX_-*nakze}ydMu4zJcEq-$gaA{P_=T6y*6d$c#6_-V zrjf5k-1HVKa!+CsoQ8XBBa?)WlOpd;Teh@2^3y*a^gi9^?Dw}VWdC^upr3oJ)KEM~2xJ5x0;ugT74M*073h5?) z?4#JEPXe4(G~SqbG!Zy<|Ed&&e|swY&nb3X?4YR}<_KFE1zPiUw9j8A zt^&1Y1tVTkf$!mQ#-Z_({BCSh*x`8dLNZ5_4rF{ni6APTv6xBk$DjkuWj6KFX*iAG z)ZAP>jIS70CN5zYG$9G2Xl|6lQ#bwI5iES)6Eg(}Zz|%`*20Bme1o#cjNB<8Rhh*m zf{QwHE1L;D6(H)Vm+5NGx6}K4kBiki8&M0Lm8?nHffO)KN~yGb4OCD+b*zz{af zq~VT|VQ48{U)#il&%wMrG7L;|@Q$UEsm#XE29=(kn}?@&ZEJv}bO*Y<_Gv$Recjvx zVes)K;nP3`Mn`EJdHvI=%un4gaU+^a`mP)B-gU#jH53k(|5xQ;wM6?T0oLyW*qv4^NZJ}0Thtuqv zG`cprdOTM?KXTszH zWq+3r@q99*aY6l!M-gF556oM2G1$*c1tFv|;BxsG7ikXPrWY^6xF!5ytwhH1$v5SD zKsC}P8gmAE!A-@ohj8`usGzU}f{Pc6y5&qIV#?p&@xGXSRP68|XURx|T*}jp-?Xqy z*q^(xa&7a&RFX>9I=!HcUS2l5lRoEa*8Ve#e1CUwx34aCMFaVxnX4wZJ-ZP{Iu4_mDSHLaG7j3QohGbe>v)S zzp>>W@R^Zi0H8)R$iH7=@QNoxK@td%xH6}N1L45LH^&JxJJ?7+03%D3%0mxImA!+EBHFj*2%QgULmkoe#*`c10 z#vO*#xiwaGxz`$nmiG~mmk5#3)DUiKNN(4`Zd5~=1YqY=Wg2O&_%&_;0^M(NcK>0%#*c$wwyLhD~%lG%iJnr7Rc&Kj8`$=kP zWQhqNoR@{v~sA+4Y`?(3kr(0unWoC;1L;^I$vYT}Q*q!)lkz;pHTC| zK}^UoFd^+^3*QpMX|J=a3uH%b5#t`ZY>H}7$*tqrV9Z$}Ew-7j9|nw6dhsEt$v~=p z;9O9}R?}g~_;vLpu7QSk1j4c_oB~ACERa(tR%PHH35MeLA+Z%ybeV}@71wf{ugoe; z0!lVml;nPR{S4~8e^-xppkveSnzE`@YIUyN9T2V!l6+=eRjCPj6tQJ~*(0R-X3N~# z+@t~TKq?-8Ou90}gXkabLkH;+G1Jg|WApNIc}nD=tkIrcrgVnp6nVWXQ8iQN?z`}f zAKPD#a@Fr%lK{q?!HnR0@-x;tDMVZrteF8Zj9W##SAq^H%eGY<1Cua58Fb`0zNaAW zJZ$t4zWXP8a_HR)DNA92AHoEKuvv%=SviGG+{Qcahoq=9DANeRqR48K9a8wS#-1~X znYLsp>-qF8uqb*pB-u%P}Kh7 zoVzfT*Z!QL9;GTD%*`ohe& z9Q))=ZOqqzeY7?+<1q^>>x#FSjcuFMO3~tL+Ej=M0%*%Uog12Rm+QY(@*J`mpjk7E%vsK2j1IH(i9O zMuAlC_V(;muuuAU=)N^N5e@O~88J$$Snql$9mA6qS>!S`eo&)DmLT!vR%Pic&}$&6m1?3y5;nITfh;1yTq4)9Ych=` z%I^&gH=o+04xf|;s%^TV=c$3|jI=dz#O!reJ79HXHukViijrH>09XPh=C+9=4!T;w zRtX~-$R=fWvK;l3lg5_v65Q7a>?#Z}>T*XYsUdo%_5RFIl z4OM6SQN8or134m`(tmcZx&|t<@Uj5aGliW|BVqMYz+3p*xowv;$+RKjHX0&%tk|0* z`fF}!oTcb((z%fVrQ3Nv=a)riQO2<$uOifASI#j=!1n0lSNaC8PF3}Ddw&;#7D^EX z*_;5waPUi&7_Fd9R@69uX`4n0zw5#{TS$U_sNwKw>KeMR;h&;Of60kGV#kC=8YW4LO{_gz%*QJgIpW7~ z*i!WYUNinYg3uzKt6jJCb{!pvv|&e7J!-j%nZOA_BeZTgkQl=$jc;=r5FCTM@*Cds@ut#I>xeb<~-AaD>@n>*e1$;MuFQRGMAy%%rqt@`!%GWF)t~I9 zt2^K{>m5IMVH)3KehIk$mH=~r^g`!7Yq5a^JGGsf{z)mVy z&<`$BKXdvKN=6BSde_H;;;Cb1gPo&@oZR-g+|^S;x+gI+0uEQB<6G&%X{o z{&1*KVy=Bx-&@{{55FBW{N`|5zi(~-CpDR>uw;qF4DYd4o?!X43`Dq?4Gr0P9hHZW zK>+b%Md~hr1J>!OFkuU!LX4R}>$BTfRI!-scCII_BJtkv`EX(v_?q}fi#*Rb1GxQ@ z8S_im*JqU0lrb#>xC+~9-9?tPn!2{^xLT(i4ih`8vxdwNv{^a|zUM+q_VTmDO`a13 zRdz+6=FDtc2OK1)1|oO5^Y|QoIH;(7z%iYI^o&-G~s%`)5jd&tPmjc0hLH3vY( z%aI;6Nol6;bX+>_yQy zD4DYO*sgF%Y~VBf!47-C)a*O4ABO38x^HXriJU7R3Oe?=*vOk4XP<(uRhpG&j9WDA zT+kx|(2C4}ElNWvEo-*ea3u}wkezWpqAIfcL0B|ke5>~e;IQ&EXs#m|GfvPE_L@3W z4RjVjA!-2|$~z%VQRs&6Dj zc2Tst29V_74e0wBhW}dE(LullzJryk;gMe#s@uv%Jx3 zkjo1Q{6(d6CbUvKM;VFt(a9|j40H3 z0*u#mBNh9(Pig?!+JWw6Yv(LFr=Mt9MLxhKLjf2`3WF8Q$w ziIwAH`=@l`s#6K5&(-PNlLG20S#JwB#{!R_&BLEB&erzMK6TFb@ucG$jDSZkW8?8! zNP10`W28RAfFy*h?aHpQqOi~cu#|D0#OFW$re--rX`gMx9jY4NYFD3RC2HtzF} zf4LSWj*u$(65>&DU|?pD|2UST$)i>eeh+X9jbXR zQwH0;LiN#_8^YmwxgP6VENkk^`AHX*qV@L|s6V=ZpND}dccE#N?_W9Dc|Y()|4SF} zS99>!abD!#zp$68xMcb63wq2ciN|Hc0Ba;Ig@z-;Bi1sh4h6Um@T~`uu*RU0It8!f z>fao>8OArUIBH>{0}7m`u+rP@Mp=1c7%hgq6ivDC&0QT>bGEjpX=%Wl<|5?=hqWcJh#YS2;UozC@TLh#tlx`qat@ibgwwpJX0)!fx=oLp7MOan~AMoFVCM^ ztQin|oMzsJKz+HYa2~`9bBX_Y>jiiue@=uBJF)$*F8M$uPC4z;iLhE2JiLxcd2 zcsuR(O}D?z4?}FQLdPGr9sv(;|J0Dp3wOfVQI=*wU^}$Ut-G%u0>LPucVg4s6(8fy z+?JJN{dlw{kpmntfk@KgdJjCwy|uL=38#8qD0>oQJo$QZ-Yve>@frC$gBQb zbMlfES~dTH=Oyz*vlCtE#t5Ke=^!a=q2j7ujaeyqZ#dzgKoQ5FAsLeAWM@9>Bk9<} zQ)e3nJ3(=i;no~)^>l$ok`ceHfxakR z)!tlQcNZ=rPdsKE58iVQrNty5fVVf?<7WH__4UsLnq4{eWNY_%&0AZiC=r)!gq$E= zl=+l&=`7koH4i?w%~SpmM#!Ot3a&w2y3y?`gVyhXX4zO;vDcHCB)$_lJ$Az;WCV;BF`%S6w95(mTFbU_bZ}Ufy=q z%{EdFb*ZTOOQQ|U#r0hl%!|Df0|^4YE_nA>x%vPSQt6OLg+(F23~iMBMbuXM$!trn zxx5OjcB}hYrtJyDF!H3Wu~Y8`B~v^D%IhqV)=TJ z?JVgo9huBe0+V2JGao`nRN2k8Q++++>%c16$l9~DTLOvS0O&75R5hJL_)|6Iu-})`ozs^%5s} z$YbQ{d?zcP-6vsv9c8t^c&@il6Rm#ojB>0EUG#*{OzVK{>U#qs#3|oi$_u}f=_HJR z2?Awe&%dFBV`Y7YgnlR z&o~97+!n*v0Wbn_K5E5hd~3&CdKd|ZgF7uQ01@pqr`JEd=lRq3#2Legp?K%s&3Ep_ z`3LU(?*}tK30N5Voq(-ZbPdqj7+PD1_kjeDEPPj3eC!VRq64G(m;8k3e+>6W+#SVl z3)fBQYt=zOs$k;c#smtvUM&$%8E(#rT!NLMRZr+TdbKt*;d*eSkG7Ak|0LjT7>;HQ zqG?zmSmt*ECfE8{&8w{T1hMGHg!L2zs^3rp%LAA?rKtw&j;S$^0G28z;L`(7skWb+ zcQwo7Ljp$C3&1Q<$3rGlMu+<&iIAADE)=6i1tCIrJWdYf+T+w7C%{`OftkmE1l9*q z)>7z>mlM}p24zP?%U0?`p_I8!^Xvl~soEi;KPgDbp)4piv`#TFm!R@uRgKyvcMX)i zGA&xYDJ4T^x@a5HtAm|m@2ON1 zdN=3}TA`H1{V_P&7gskMMlQq3$UIRZZZ?Un`Kh5AoaZRAbWgFZV{nakdTZAhCdz#} zSOYj)6;btD0zMXu3x|H^-zj5eRiEx~&>g~AnyLeRUn#bG7NNCmR#&cN=4_;@A~S|p z=ql0*`S^@3n`PO9DguMMaK>z}@r6#PpdVSxCdQe)CzD@@Vm@}s#q>{GiHpF=8T-;O zDhNJykSUlT!NCI{ocpMuhg$AE>elP-aOH(Q^gKUNFyu`~+9!>&4Sd>hY_@lCvcvN6 znOXBe;D*YdppSzlK=hU^#wT7XlOH|IF1or1%F0h+mp6_S+VAK{vDrg?{-t$`2HASL#h-Iw2bir;<+~< zmt`F05QnJ9idsTRjT8Tqe+7Q=uZSV^P-QlejEF_9XL>+lrFNnyyV#8w;#`bgM3YIO`@gPc41gD@qn(|D&>2OMYnZVLbhX*=Bm(~FQz5@yzCFgeKb+wH>C z1YeixsPhim@ESBuvg+{o<)yfVy7J#JzOrjx)JtHU33O6LP$NJYv*q9PV^(ipE(+hB z|6*W#rXDjJw#4yf?UHu}wlQBZCCn!s{6yx7$42nZz(}eqlTs{mI$wr0Ll z3w9O6BHLFxVrM5Jku+xqn|z-(%3+!w=f#@NKp$@k@e)u;BoZ9n>TkPE?Fn&K7|EmN3e>`>ye>Vz#I^cUs;wafwfPI=q z%;Zr5s^(7N646Ys$2m_G?_X_Ys0$j;;gPjj9%^?Ah&|2`@OdPV79L4yOtG`SoN16Y zJT@bcTzBN;Xl;M6xqZbfGpshV;Wct%{4u*>qE|zWmr-{M7z=KIdjhN|y*|hWVgisZ zy5f8j1g|BZ=KJxwbAdyV$Xh_}OV+zBZXJFBZz_s3h4K_DnaC&%RBcAa%)Q~E#a0W$ zHyCb!q@QU6AzxN{=v>L_Y{{n=^Re#V%O+5m?659@~7cPsqX z581Zv>+Q}pdjL6-O(X(7)DnoK0)7rth3Qm_=8qR$Hm}6Ii~Xhz+YR?#8H?d$lI4-I zeCAKOn~FfxBQ@NCJ2f(UV)ve$9!@JV8C-z1zQEWw$}F*PV;9Cyi$pD$*afm1qD*WZ zqfPgQx!B(;g;pW^E{eo362N1t=#Vp^75UDYPNCqS&ucC0L2-eV{rG)L6>}k7#~ca) za_#qp5FP{NjdSGCBBUtqYYf+7NnE+UAdij*zOM03fQZIaaYCtyDM|a5QXCEmBBoPz#QOi5IrDg`(m#&dOO!qPzPsuonQ*6(WV<1* zN)$?_F@?e)lhGwxma;RrWGS-d+QLXpMY0SjWT|W+MncHa?;OYF99Ng-uiy3Za_=AB z=leY0@AKSqp6B^|Do?gYTSf-7R>j#9bMM~|=`5L!#G{A)NxeOEB3|mU4Q=yZ%;-Z! zc2}&M1)^#SMr)d;X-yK+GwnR(Lq2{v{orVN%a@tmEut5)`ly>%nxOcx;J$;wR8^x0ycYXDpPn30o}wNiZZ{;l_B;^u8! zJyjhl_+Lb|^iF3Kx!8Ek&;?7UI%>bq9M$2=@njXw?0W8AaNGX+lgWc$8Y6P)_?sPx zMnAO7#aJ@kv?f{#;IvsVY0Qh)tmrUvQ~MPA9yF9zGSv+E3Q78R-sngj-}kk-!QMY# zs$4Oer@y`WSVK5lI(w>?-~eGPVnGt`w&)~Uqq!d^S?#o^^qRa+zeVU?Q=Sf{3U-ua zXmQl5rq|ob2ekbPw7qy72%iTR(bhLkd`imL<6v_K<9XOEHlpE`iUL-g?q-!3hTmyR zE8jccs&G?+K_XGPWZy+yE7Z?sV>fJgy+V{?ugp!w1=Mhi|FHU04&E6aj}U0&0`3eu zfjdL)l{-Ucm(xz0KVu8p06}ML6RGY|V;x+ZuseTD>)>R3ZSVa!Na(tNOki=~k+don z_1&MVr?<d}P*0 zBo<8)M*if>s$)3DTa@)Cz1dG}>y+ptDOGimOB zB=}Ljr9UC~mx!-Hr?+t{AFL^SbJrujD?2J$AU|28!%%!sHTbjK1zg+ttfDTW^9R16 zn}rwS+w?i+kBS8jjy*r;QE|D{OHL^Fc!|3Lc6OU~etTd<;*^}3TkN?Amd44cp@Fc_ zq_bjTi}A_7{v4VT6RPz#gJy2av4&gzGc$*i@`QoqqPbp&-`pm&_DGpp;N068V?+u+ z;TiJ|Nz0`lJ)%_I<78JkP5njyo5Q6!t7WOLq@vrxhpEHWdi6{n9S$|78YzmRHWs%L zpFTNzz!v>HX{W^Dzpbdk1>F^L_WB<5&o0_O*(B=NY$DRU0?S3leX%(QX<=g~s|4lYK(^N>qmZ^ceI}mdUDxg+5sJZk^mpUn#kFcw1+c zRPTaT`jJyC^gK@up0Zaz><_yjUF3btP#MelUg2%zLzY4=_1Wl_?lOr=ZPgRbOdO~| ziKbKu^d~coF{gX}bc)s8LjD@zj!DFrUyQ^>dknM8>FI92x^@7UO4#pz6N_>3osj!& z2j_rIy^U>{-7}lJ#jIh0&0Z;TN?E)v)bUU1 z-6c~mhFjySb@YE_X%Zcm|BCC!sZBHJT7`H>dVT!I^>a{9k>-2e_KVgUct!4>u6cdh zs5_2t{{2yM$UUM4`{;)E-x9Sgq`9NYu_J8$O``}JPlx9B#gQ%T7}sqz$6 zM-Q;=op27u#kleYk6X@9js+ijqdN>$CdOc{bj3jRrkb%Spzc{->Gd5Y3HLF zM=aPghds-x+tsXR(6)T#)6(JonjCsuz0n>Iq-*s>oF`{zWMxXlKlaYD&drNx1Oo7_{Iy=Gb#%_-?O@C6T=|;s#1Xzv8eF=El&M1f<*+peycO~1< z;Az>rUUMxUdcKeWIe|P{bxB>*?qQx!iyw59YaVDArRHLEQt+LMde;BwbOo6Nx0z4s zwHUkQI$A&GH`w9qCy)Cnwtl``^-JZp5~b&QvEuga_2V=TU8b&&ptWkYV6&YoYI%SI zMze$$9dj+k?p7mgW>wy&HG)ODqmCr_{}j;{ks4p0X>_lvwEmWFR)6!@;lNo7M_aqD zpW_U7`C6eDp1JTQ$HquT-dzayJb#>@qA1ZkoyL5kN1*b38sQ<)xyjp4ZAfx5+1`Id8Q-XF5%f6w(E z`Xlk>;w9@4y1Yv|x~}qD$1eAsNlm-T;9Q;{5hN`Al?I$;A!Q3V%dQndfSW@bOMO?j znPxdFo?ieULBKEQ(+2(j*)zZ{(>dqe;3rBVh@*9&%$ZfIY5$#AS`loO7P6kEZULyPme@x@*H+?m^sW`h$S{Rw|$Xg#0LUou!&KWlOA&ET;tGr1Pk)kPd+`c^bNgOsYVYB0B@K5Fe#x{Lqob@ z!b6h;B7}QmZjOg^K!o$~z$v*U9?1`Jb3mk_AROoeJpL>J*VqeE;zE76R_jg+@54ih zz|QNEITru|HCPmqL2k_j5AZbvT2Y&A%mYU@(xi*Tqo$I;ivZCBfss^G8@Ch0A+5Pc zII#9EFXKo?U6gpM1%q_xg7Y4ccq@Kgl!#C!zzC79KX78zj->{ZdjL@aL!pxU|3F}H zsHEXpSeC#@Hy{8Cx&cv0_u7e<8D2LByxEqaD}FDO!i3sS?)E|o6CBMoYlxr^1Hc5m zCpL%@>HI?KQ?Q6w*^yBypaEY7N`XTCN$%+ahX#>B0rLa^3Oc;38z}@Ow_kxn_j0U_ z6tEBgpr9EG1t_^!3LM%+1_iY902Fjip#U`pwi}UVCU9sN&>YA&0&@CMKm*!v018^0 zP=JzqjliKgTx+3#{uqF6BKu&GlU`d9HM+P01#cDr8mL!YH$6-f92qHrgOi(N5M<<;m+!g;Qp5tk zhVw4OH4u9Xn~NWLR3FYBQdnWHJ-EL)H1en<9R2tQIQqN#ocv(XDtHt>hJk~TUA{Ce zfX9qBs6*t|`6@jPe_r$3^zTY2a(4)Ri4QvPOZ Date: Wed, 13 Jun 2012 11:52:50 +0200 Subject: [PATCH 041/159] start implementation of new repository api for mercurial --- .../spi/HgRepositoryServiceProvider.java | 99 +++++++++++++++++++ .../spi/HgRepositoryServiceResolver.java | 94 ++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java new file mode 100644 index 0000000000..6e02fba109 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.ImmutableSet; + +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.api.Command; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +import java.util.Set; + +/** + * + * @author Sebastian Sdorra + */ +public class HgRepositoryServiceProvider extends RepositoryServiceProvider +{ + + /** Field description */ + private static final Set COMMANDS = ImmutableSet.of(); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + * @param repository + */ + HgRepositoryServiceProvider(HgRepositoryHandler handler, + Repository repository) + { + this.handler = handler; + this.repository = repository; + this.repositoryDirectory = handler.getDirectory(repository); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public Set getSupportedCommands() + { + return COMMANDS; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private HgRepositoryHandler handler; + + /** Field description */ + private Repository repository; + + /** Field description */ + private File repositoryDirectory; +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java new file mode 100644 index 0000000000..ecc025056e --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.inject.Inject; + +import sonia.scm.plugin.ext.Extension; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; + +/** + * + * @author Sebastian Sdorra + */ +@Extension +public class HgRepositoryServiceResolver implements RepositoryServiceResolver +{ + + /** Field description */ + private static final String TYPE = "hg"; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + */ + @Inject + public HgRepositoryServiceResolver(HgRepositoryHandler handler) + { + this.handler = handler; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public HgRepositoryServiceProvider reslove(Repository repository) + { + HgRepositoryServiceProvider provider = null; + + if (TYPE.equalsIgnoreCase(repository.getType())) + { + provider = new HgRepositoryServiceProvider(handler, repository); + } + + return provider; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private HgRepositoryHandler handler; +} From 468c17b38cb1f77104005f6a60342f3911333738 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:14:57 +0200 Subject: [PATCH 042/159] remove jaxbcontext from AbstractHgHandler --- .../scm/repository/AbstractHgHandler.java | 152 ++++++++---------- .../sonia/scm/repository/HgBlameViewer.java | 7 +- .../scm/repository/HgChangesetViewer.java | 7 +- .../scm/repository/HgRepositoryBrowser.java | 9 +- .../scm/repository/HgRepositoryHandler.java | 24 ++- .../scm/repository/HgVersionHandler.java | 4 +- 6 files changed, 91 insertions(+), 112 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java index c1f6f60a76..7531e9a5b5 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java @@ -35,10 +35,13 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.Closeables; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.SCMContext; +import sonia.scm.repository.spi.AbstractHgCommand; import sonia.scm.util.IOUtil; import sonia.scm.util.Util; import sonia.scm.web.HgUtil; @@ -57,7 +60,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; /** @@ -68,47 +70,49 @@ public class AbstractHgHandler { /** Field description */ - public static final String ENCODING = "UTF-8"; + protected static final String ENV_NODE = "HG_NODE"; + + /** Field description */ + protected static final String ENV_PAGE_LIMIT = "SCM_PAGE_LIMIT"; + + /** Field description */ + protected static final String ENV_PAGE_START = "SCM_PAGE_START"; + + /** Field description */ + protected static final String ENV_PATH = "SCM_PATH"; + + /** Field description */ + protected static final String ENV_REPOSITORY_PATH = "SCM_REPOSITORY_PATH"; + + /** Field description */ + protected static final String ENV_REVISION = "SCM_REVISION"; + + /** Field description */ + protected static final String ENV_REVISION_END = "SCM_REVISION_END"; + + /** Field description */ + protected static final String ENV_REVISION_START = "SCM_REVISION_START"; + + /** Field description */ + private static final String ENCODING = "UTF-8"; /** mercurial encoding */ - public static final String ENV_HGENCODING = "HGENCODING"; + private static final String ENV_HGENCODING = "HGENCODING"; /** Field description */ - public static final String ENV_NODE = "HG_NODE"; - - /** Field description */ - public static final String ENV_PAGE_LIMIT = "SCM_PAGE_LIMIT"; - - /** Field description */ - public static final String ENV_PAGE_START = "SCM_PAGE_START"; - - /** Field description */ - public static final String ENV_PATH = "SCM_PATH"; - - /** Field description */ - public static final String ENV_PENDING = "HG_PENDING"; + private static final String ENV_PENDING = "HG_PENDING"; /** python encoding */ - public static final String ENV_PYTHONIOENCODING = "PYTHONIOENCODING"; + private static final String ENV_PYTHONIOENCODING = "PYTHONIOENCODING"; /** Field description */ - public static final String ENV_PYTHONPATH = "PYTHONPATH"; + private static final String ENV_PYTHONPATH = "PYTHONPATH"; - /** Field description */ - public static final String ENV_REPOSITORY_PATH = "SCM_REPOSITORY_PATH"; - - /** Field description */ - public static final String ENV_REVISION = "SCM_REVISION"; - - /** Field description */ - public static final String ENV_REVISION_END = "SCM_REVISION_END"; - - /** Field description */ - public static final String ENV_REVISION_START = "SCM_REVISION_START"; - - /** the logger for AbstractHgHandler */ + /** + * the logger for AbstractHgCommand + */ private static final Logger logger = - LoggerFactory.getLogger(AbstractHgHandler.class); + LoggerFactory.getLogger(AbstractHgCommand.class); //~--- constructors --------------------------------------------------------- @@ -116,63 +120,34 @@ public class AbstractHgHandler * Constructs ... * * + * * @param handler * @param context - * @param directory + * @param repository + * @param repositoryDirectory */ - public AbstractHgHandler(HgRepositoryHandler handler, HgContext context, - File directory) + protected AbstractHgHandler(HgRepositoryHandler handler, HgContext context, + Repository repository) { - this(handler, null, context, directory); + this(handler, context, repository, handler.getDirectory(repository)); } /** * Constructs ... * * + * * @param handler * @param context * @param repository + * @param repositoryDirectory */ - public AbstractHgHandler(HgRepositoryHandler handler, HgContext context, - Repository repository) - { - this(handler, null, context, handler.getDirectory(repository)); - } - - /** - * Constructs ... - * - * - * @param handler - * @param jaxbContext - * @param context - * @param directory - */ - public AbstractHgHandler(HgRepositoryHandler handler, - JAXBContext jaxbContext, HgContext context, - File directory) + protected AbstractHgHandler(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) { this.handler = handler; - this.jaxbContext = jaxbContext; - this.context = context; - this.directory = directory; - } - - /** - * Constructs ... - * - * - * @param handler - * @param jaxbContext - * @param context - * @param repository - */ - public AbstractHgHandler(HgRepositoryHandler handler, - JAXBContext jaxbContext, HgContext context, - Repository repository) - { - this(handler, jaxbContext, context, handler.getDirectory(repository)); + this.repository = repository; + this.repositoryDirectory = repositoryDirectory; } //~--- methods -------------------------------------------------------------- @@ -332,7 +307,8 @@ public class AbstractHgHandler { handleErrorStream(p.getErrorStream()); input = p.getInputStream(); - result = (T) jaxbContext.createUnmarshaller().unmarshal(input); + result = + (T) handler.getJaxbContext().createUnmarshaller().unmarshal(input); input.close(); } catch (JAXBException ex) @@ -343,8 +319,8 @@ public class AbstractHgHandler } finally { - IOUtil.close(input); - IOUtil.close(output); + Closeables.closeQuietly(input); + Closeables.closeQuietly(output); } return result; @@ -399,7 +375,7 @@ public class AbstractHgHandler ProcessBuilder pb = new ProcessBuilder(cmdList); - pb.directory(directory); + pb.directory(repositoryDirectory); Map env = pb.environment(); @@ -416,10 +392,11 @@ public class AbstractHgHandler { if (logger.isDebugEnabled()) { - logger.debug("enable hg pending for {}", directory.getAbsolutePath()); + logger.debug("enable hg pending for {}", + repositoryDirectory.getAbsolutePath()); } - env.put(ENV_PENDING, directory.getAbsolutePath()); + env.put(ENV_PENDING, repositoryDirectory.getAbsolutePath()); if (extraEnv.containsKey(ENV_REVISION_START)) { @@ -428,14 +405,15 @@ public class AbstractHgHandler } env.put(ENV_PYTHONPATH, HgUtil.getPythonPath(config)); - env.put(ENV_REPOSITORY_PATH, directory.getAbsolutePath()); + env.put(ENV_REPOSITORY_PATH, repositoryDirectory.getAbsolutePath()); env.putAll(extraEnv); if (logger.isTraceEnabled()) { StringBuilder msg = new StringBuilder("start process in directory '"); - msg.append(directory.getAbsolutePath()).append("' with env: \n"); + msg.append(repositoryDirectory.getAbsolutePath()).append( + "' with env: \n"); for (Map.Entry e : env.entrySet()) { @@ -452,15 +430,15 @@ public class AbstractHgHandler //~--- fields --------------------------------------------------------------- + /** Field description */ + protected Repository repository; + + /** Field description */ + protected File repositoryDirectory; + /** Field description */ private HgContext context; - /** Field description */ - private File directory; - /** Field description */ private HgRepositoryHandler handler; - - /** Field description */ - private JAXBContext jaxbContext; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java index ea192665bc..40dfe0a58d 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java @@ -47,8 +47,6 @@ import java.io.IOException; import java.util.Map; -import javax.xml.bind.JAXBContext; - /** * * @author Sebastian Sdorra @@ -71,11 +69,10 @@ public class HgBlameViewer extends AbstractHgHandler implements BlameViewer * @param repository * @param blameResultContext */ - public HgBlameViewer(HgRepositoryHandler handler, - JAXBContext blameResultContext, HgContext context, + public HgBlameViewer(HgRepositoryHandler handler, HgContext context, Repository repository) { - super(handler, blameResultContext, context, repository); + super(handler, context, repository); } //~--- get methods ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java index 5a93eef75f..da62011a63 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java @@ -74,11 +74,10 @@ public class HgChangesetViewer extends AbstractHgHandler * @param context * @param repositoryDirectory */ - public HgChangesetViewer(HgRepositoryHandler handler, - JAXBContext jaxbContext, HgContext context, + public HgChangesetViewer(HgRepositoryHandler handler, HgContext context, File repositoryDirectory) { - super(handler, jaxbContext, context, repositoryDirectory); + super(handler, context, null, repositoryDirectory); } /** @@ -95,7 +94,7 @@ public class HgChangesetViewer extends AbstractHgHandler JAXBContext jaxbContext, HgContext context, Repository repository) { - super(handler, jaxbContext, context, repository); + super(handler, context, repository); } //~--- get methods ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryBrowser.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryBrowser.java index 947e2d26b8..4a7c292087 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryBrowser.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryBrowser.java @@ -47,8 +47,6 @@ import java.io.OutputStream; import java.util.Map; -import javax.xml.bind.JAXBContext; - /** * * @author Sebastian Sdorra @@ -66,11 +64,10 @@ public class HgRepositoryBrowser extends AbstractHgHandler * @param repository * @param browserResultContext */ - public HgRepositoryBrowser(HgRepositoryHandler handler, - JAXBContext browserResultContext, - HgContext context, Repository repository) + public HgRepositoryBrowser(HgRepositoryHandler handler, HgContext context, + Repository repository) { - super(handler, browserResultContext, context, repository); + super(handler, context, repository); } //~--- get methods ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java index 045f540af6..bba0f0ad76 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java @@ -222,8 +222,8 @@ public class HgRepositoryHandler if (TYPE_NAME.equals(type)) { - blameViewer = new HgBlameViewer(this, jaxbContext, - hgContextProvider.get(), repository); + blameViewer = new HgBlameViewer(this, hgContextProvider.get(), + repository); } else { @@ -311,6 +311,17 @@ public class HgRepositoryHandler return new HgImportHandler(this); } + /** + * Method description + * + * + * @return + */ + public JAXBContext getJaxbContext() + { + return jaxbContext; + } + /** * Method description * @@ -322,8 +333,7 @@ public class HgRepositoryHandler @Override public RepositoryBrowser getRepositoryBrowser(Repository repository) { - return new HgRepositoryBrowser(this, jaxbContext, hgContextProvider.get(), - repository); + return new HgRepositoryBrowser(this, hgContextProvider.get(), repository); } /** @@ -353,8 +363,7 @@ public class HgRepositoryHandler try { JAXBContext context = JAXBContext.newInstance(HgVersion.class); - HgVersion hgVersion = new HgVersionHandler(this, context, - hgContextProvider.get(), + HgVersion hgVersion = new HgVersionHandler(this, hgContextProvider.get(), baseDirectory).getVersion(); if (hgVersion != null) @@ -470,8 +479,7 @@ public class HgRepositoryHandler throw new IllegalStateException("directory not found"); } - return new HgChangesetViewer(this, jaxbContext, context, - repositoryDirectory); + return new HgChangesetViewer(this, context, repositoryDirectory); } //~--- set methods ---------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java index 722b09fab4..7641b9f112 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java @@ -54,10 +54,10 @@ public class HgVersionHandler extends AbstractHgHandler * @param context * @param directory */ - public HgVersionHandler(HgRepositoryHandler handler, JAXBContext jaxbContext, + public HgVersionHandler(HgRepositoryHandler handler, HgContext context, File directory) { - super(handler, jaxbContext, context, directory); + super(handler, context, null, directory); } //~--- get methods ---------------------------------------------------------- From 88dfaf8467c64b450d34b9894ed01ec00a0f6f4e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:16:01 +0200 Subject: [PATCH 043/159] fix compile error --- .../src/main/java/sonia/scm/repository/AbstractHgHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java index 7531e9a5b5..cee94b1e21 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java @@ -41,7 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.SCMContext; -import sonia.scm.repository.spi.AbstractHgCommand; import sonia.scm.util.IOUtil; import sonia.scm.util.Util; import sonia.scm.web.HgUtil; @@ -112,7 +111,7 @@ public class AbstractHgHandler * the logger for AbstractHgCommand */ private static final Logger logger = - LoggerFactory.getLogger(AbstractHgCommand.class); + LoggerFactory.getLogger(AbstractHgHandler.class); //~--- constructors --------------------------------------------------------- From 9b4afc647a8c2c5b6066377ac38cb9d87aa33e44 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:16:18 +0200 Subject: [PATCH 044/159] implement cat command for mercurial --- .../scm/repository/spi/HgCatCommand.java | 108 ++++++++++++++++++ .../spi/HgRepositoryServiceProvider.java | 24 +++- .../spi/HgRepositoryServiceResolver.java | 13 ++- 3 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java new file mode 100644 index 0000000000..2e6ebc37c9 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.io.ByteStreams; +import com.google.common.io.Closeables; + +import sonia.scm.repository.AbstractHgHandler; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.util.Util; +import sonia.scm.web.HgUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class HgCatCommand extends AbstractHgHandler implements CatCommand +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + HgCatCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public void getCatResult(CatCommandRequest request, OutputStream output) + throws IOException, RepositoryException + { + String revision = HgUtil.getRevision(request.getRevision()); + Process p = createHgProcess("cat", "-r", revision, + Util.nonNull(request.getPath())); + InputStream input = null; + + try + { + handleErrorStream(p.getErrorStream()); + input = p.getInputStream(); + ByteStreams.copy(input, output); + } + finally + { + Closeables.closeQuietly(input); + } + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index 6e02fba109..bbaf584674 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -34,7 +34,9 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import com.google.common.collect.ImmutableSet; +import com.google.inject.Provider; +import sonia.scm.repository.HgContext; import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.Repository; import sonia.scm.repository.api.Command; @@ -53,7 +55,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(); + private static final Set COMMANDS = ImmutableSet.of(Command.CAT); //~--- constructors --------------------------------------------------------- @@ -61,12 +63,16 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider * Constructs ... * * + * + * @param hgContextProvider * @param handler * @param repository */ HgRepositoryServiceProvider(HgRepositoryHandler handler, + Provider hgContextProvider, Repository repository) { + this.hgContextProvider = hgContextProvider; this.handler = handler; this.repository = repository; this.repositoryDirectory = handler.getDirectory(repository); @@ -74,6 +80,19 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public HgCatCommand getCatCommand() + { + return new HgCatCommand(handler, hgContextProvider.get(), repository, + repositoryDirectory); + } + /** * Method description * @@ -91,6 +110,9 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private HgRepositoryHandler handler; + /** Field description */ + private Provider hgContextProvider; + /** Field description */ private Repository repository; diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java index ecc025056e..00981a2195 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java @@ -34,8 +34,10 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import com.google.inject.Inject; +import com.google.inject.Provider; import sonia.scm.plugin.ext.Extension; +import sonia.scm.repository.HgContext; import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.Repository; @@ -57,11 +59,14 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver * * * @param handler + * @param hgContextProvider */ @Inject - public HgRepositoryServiceResolver(HgRepositoryHandler handler) + public HgRepositoryServiceResolver(HgRepositoryHandler handler, + Provider hgContextProvider) { this.handler = handler; + this.hgContextProvider = hgContextProvider; } //~--- methods -------------------------------------------------------------- @@ -81,7 +86,8 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver if (TYPE.equalsIgnoreCase(repository.getType())) { - provider = new HgRepositoryServiceProvider(handler, repository); + provider = new HgRepositoryServiceProvider(handler, hgContextProvider, + repository); } return provider; @@ -91,4 +97,7 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver /** Field description */ private HgRepositoryHandler handler; + + /** Field description */ + private Provider hgContextProvider; } From dc913d3df603dc4a5edf2376df885d7a5d0ade9a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:20:55 +0200 Subject: [PATCH 045/159] implement browse command for mercurial --- .../scm/repository/spi/AbstractHgCommand.java | 87 +++++++++++++++++ .../scm/repository/spi/HgBrowseCommand.java | 97 +++++++++++++++++++ .../scm/repository/spi/HgCatCommand.java | 3 +- 3 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java new file mode 100644 index 0000000000..d758cad95a --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.AbstractHgHandler; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractHgCommand extends AbstractHgHandler +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + protected AbstractHgCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param revision + * @param path + * + * @param request + * + * @return + */ + protected Map createEnvironment(FileBaseCommandRequest request) + { + return createEnvironment(request.getRevision(), request.getPath()); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java new file mode 100644 index 0000000000..91106c206d --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgPythonScript; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + */ +public class HgBrowseCommand extends AbstractHgCommand implements BrowseCommand +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + public HgBrowseCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param revision + * @param path + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public BrowserResult getBrowserResult(BrowseCommandRequest request) + throws IOException, RepositoryException + { + Map env = createEnvironment(request); + + return getResultFromScript(BrowserResult.class, HgPythonScript.FILELOG, + env); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java index 2e6ebc37c9..955278f49e 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java @@ -36,7 +36,6 @@ package sonia.scm.repository.spi; import com.google.common.io.ByteStreams; import com.google.common.io.Closeables; -import sonia.scm.repository.AbstractHgHandler; import sonia.scm.repository.HgContext; import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.Repository; @@ -55,7 +54,7 @@ import java.io.OutputStream; * * @author Sebastian Sdorra */ -public class HgCatCommand extends AbstractHgHandler implements CatCommand +public class HgCatCommand extends AbstractHgCommand implements CatCommand { /** From 67c6eef808ff44a839b513a0f5ae8197c1ca3bf9 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:22:00 +0200 Subject: [PATCH 046/159] register hg browse command --- .../spi/HgRepositoryServiceProvider.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index bbaf584674..b6d0675923 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -55,7 +55,8 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.CAT); + private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, + Command.CAT); //~--- constructors --------------------------------------------------------- @@ -80,6 +81,19 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public HgBrowseCommand getBrowseCommand() + { + return new HgBrowseCommand(handler, hgContextProvider.get(), repository, + repositoryDirectory); + } + /** * Method description * From b1fcfa5328fb69d7690548c1ada37e274464f074 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:25:19 +0200 Subject: [PATCH 047/159] implement diff command for mercurial --- .../scm/repository/spi/HgDiffCommand.java | 105 ++++++++++++++++++ .../spi/HgRepositoryServiceProvider.java | 15 ++- 2 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java new file mode 100644 index 0000000000..fb29820aee --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.io.ByteStreams; +import com.google.common.io.Closeables; + +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class HgDiffCommand extends AbstractHgCommand implements DiffCommand +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + public HgDiffCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * @param output + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public void getDiffResult(DiffCommandRequest request, OutputStream output) + throws IOException, RepositoryException + { + Process p = createHgProcess("diff", "-c", request.getRevision(), + Util.nonNull(request.getPath())); + InputStream input = null; + + try + { + handleErrorStream(p.getErrorStream()); + input = p.getInputStream(); + ByteStreams.copy(input, output); + } + finally + { + Closeables.closeQuietly(input); + } + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index b6d0675923..025041f67c 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -56,7 +56,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT); + Command.CAT, Command.DIFF); //~--- constructors --------------------------------------------------------- @@ -107,6 +107,19 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider repositoryDirectory); } + /** + * Method description + * + * + * @return + */ + @Override + public HgDiffCommand getDiffCommand() + { + return new HgDiffCommand(handler, hgContextProvider.get(), repository, + repositoryDirectory); + } + /** * Method description * From 0c5e8c944bd5809335e73f643bd6a6ee65f03cc1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:28:11 +0200 Subject: [PATCH 048/159] implement blame command for mercurial --- .../scm/repository/spi/HgBlameCommand.java | 109 ++++++++++++++++++ .../spi/HgRepositoryServiceProvider.java | 18 ++- 2 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java new file mode 100644 index 0000000000..8e0f5c57c9 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgPythonScript; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + */ +public class HgBlameCommand extends AbstractHgCommand implements BlameCommand +{ + + /** + * the logger for HgBlameCommand + */ + private static final Logger logger = + LoggerFactory.getLogger(HgBlameCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + public HgBlameCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public BlameResult getBlameResult(BlameCommandRequest request) + throws IOException, RepositoryException + { + if (logger.isDebugEnabled()) + { + logger.debug("get blame result for {}", request); + } + + Map env = createEnvironment(request); + + return getResultFromScript(BlameResult.class, HgPythonScript.BLAME, env); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index 025041f67c..492c785b57 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -55,8 +55,9 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - private static final Set COMMANDS = ImmutableSet.of(Command.BROWSE, - Command.CAT, Command.DIFF); + private static final Set COMMANDS = ImmutableSet.of(Command.BLAME, + Command.BROWSE, Command.CAT, + Command.DIFF); //~--- constructors --------------------------------------------------------- @@ -81,6 +82,19 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider //~--- get methods ---------------------------------------------------------- + /** + * Method description + * + * + * @return + */ + @Override + public HgBlameCommand getBlameCommand() + { + return new HgBlameCommand(handler, hgContextProvider.get(), repository, + repositoryDirectory); + } + /** * Method description * From 89d0b305d7d59ad2138e144e87f1d65b861848cb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 12:33:03 +0200 Subject: [PATCH 049/159] implement mercurial log command --- .../scm/repository/spi/HgLogCommand.java | 135 ++++++++++++++++++ .../spi/HgRepositoryServiceProvider.java | 15 +- 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java new file mode 100644 index 0000000000..219f6cb851 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Strings; +import com.google.common.collect.Maps; + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.HgPythonScript; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.util.Util; +import sonia.scm.web.HgUtil; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + */ +public class HgLogCommand extends AbstractHgCommand implements LogCommand +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + * @param repositoryDirectory + */ + public HgLogCommand(HgRepositoryHandler handler, HgContext context, + Repository repository, File repositoryDirectory) + { + super(handler, context, repository, repositoryDirectory); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param id + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public Changeset getChangeset(String id) + throws IOException, RepositoryException + { + Map env = Maps.newHashMap(); + + env.put(ENV_REVISION, HgUtil.getRevision(id)); + env.put(ENV_PATH, Util.EMPTY_STRING); + env.put(ENV_PAGE_START, Util.EMPTY_STRING); + env.put(ENV_PAGE_LIMIT, Util.EMPTY_STRING); + env.put(ENV_REVISION_START, Util.EMPTY_STRING); + env.put(ENV_REVISION_END, Util.EMPTY_STRING); + + return getResultFromScript(Changeset.class, HgPythonScript.CHANGELOG, env); + } + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public ChangesetPagingResult getChangesets(LogCommandRequest request) + throws IOException, RepositoryException + { + Map env = Maps.newHashMap(); + + env.put(ENV_REVISION, Util.EMPTY_STRING); + env.put(ENV_PATH, Strings.nullToEmpty(request.getPath())); + env.put(ENV_PAGE_START, String.valueOf(request.getPagingStart())); + env.put(ENV_PAGE_LIMIT, String.valueOf(request.getPagingLimit())); + env.put(ENV_REVISION_START, + Strings.nullToEmpty(request.getStartChangeset())); + env.put(ENV_REVISION_END, Strings.nullToEmpty(request.getStartChangeset())); + + return getResultFromScript(ChangesetPagingResult.class, + HgPythonScript.CHANGELOG, env); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index 492c785b57..c30ce79a28 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -57,7 +57,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider /** Field description */ private static final Set COMMANDS = ImmutableSet.of(Command.BLAME, Command.BROWSE, Command.CAT, - Command.DIFF); + Command.DIFF, Command.LOG); //~--- constructors --------------------------------------------------------- @@ -134,6 +134,19 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider repositoryDirectory); } + /** + * Method description + * + * + * @return + */ + @Override + public HgLogCommand getLogCommand() + { + return new HgLogCommand(handler, hgContextProvider.get(), repository, + repositoryDirectory); + } + /** * Method description * From 74045097b68967c5b2789d2782012ad99c19dcb7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 13:36:46 +0200 Subject: [PATCH 050/159] fix nullpointerexception --- .../src/main/java/sonia/scm/repository/AbstractHgHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java index cee94b1e21..431d3c0966 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java @@ -145,6 +145,7 @@ public class AbstractHgHandler Repository repository, File repositoryDirectory) { this.handler = handler; + this.context = context; this.repository = repository; this.repositoryDirectory = repositoryDirectory; } From 354fe0a211afd8b2847c1a3881bde9d888b49432 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 13:37:08 +0200 Subject: [PATCH 051/159] added unit test for hg cat command --- .../scm/repository/HgContextProvider.java | 56 +++++++++ .../repository/HgRepositoryHandlerTest.java | 24 ---- .../spi/AbstractHgCommandTestBase.java | 117 ++++++++++++++++++ .../scm/repository/spi/HgCatCommandTest.java | 117 ++++++++++++++++++ .../scm/repository/spi/scm-hg-spi-test.zip | Bin 0 -> 6972 bytes 5 files changed, 290 insertions(+), 24 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java create mode 100644 scm-plugins/scm-hg-plugin/src/test/resources/sonia/scm/repository/spi/scm-hg-spi-test.zip diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java new file mode 100644 index 0000000000..8c7a5b752d --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.inject.Provider; + +/** + * + * @author Sebastian Sdorra + */ +public class HgContextProvider implements Provider +{ + + /** + * Method description + * + * + * @return + */ + @Override + public HgContext get() + { + return new HgContext(); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java index 21d82f0827..ab052525fe 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java @@ -104,28 +104,4 @@ public class HgRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase return handler; } - - //~--- inner classes -------------------------------------------------------- - - /** - * Dummy {@link Provider} for {@link HgContext} - * - * - * @author Sebastian Sdorra - */ - private static class HgContextProvider implements Provider - { - - /** - * Return context for mercurial - * - * - * @return context for mercurial - */ - @Override - public HgContext get() - { - return new HgContext(); - } - } } diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java new file mode 100644 index 0000000000..53e9101a0d --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Assume; +import org.junit.Before; + +import sonia.scm.SCMContextProvider; +import sonia.scm.io.FileSystem; +import sonia.scm.repository.HgContextProvider; +import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.store.MemoryStoreFactory; +import sonia.scm.util.MockUtil; + +import static org.mockito.Mockito.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractHgCommandTestBase extends ZippedRepositoryTestBase +{ + + /** + * Method description + * + * + * @throws IOException + */ + @Before + public void initHgHandler() throws IOException + { + File folder = tempFolder.newFolder(); + FileSystem fileSystem = mock(FileSystem.class); + + this.handler = new HgRepositoryHandler(new MemoryStoreFactory(), + fileSystem, new HgContextProvider()); + + SCMContextProvider context = MockUtil.getSCMContextProvider(folder); + + this.handler.init(context); + + // skip tests if hg not in path + if (!handler.isConfigured()) + { + System.out.println("WARNING could not find hg, skipping test"); + Assume.assumeTrue(false); + } + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + protected String getType() + { + return "hg"; + } + + /** + * Method description + * + * + * @return + */ + @Override + protected String getZippedRepositoryResource() + { + return "sonia/scm/repository/spi/scm-hg-spi-test.zip"; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + protected HgRepositoryHandler handler; +} diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java new file mode 100644 index 0000000000..35e718bd44 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.HgContext; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class HgCatCommandTest extends AbstractHgCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testCat() throws IOException, RepositoryException + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("a9bacaf1b7fa"); + assertEquals("a", execute(request)); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testSimpleCat() throws IOException, RepositoryException + { + CatCommandRequest request = new CatCommandRequest(); + + request.setPath("b.txt"); + assertEquals("b", execute(request)); + } + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private String execute(CatCommandRequest request) + throws IOException, RepositoryException + { + String content = null; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try + { + new HgCatCommand(handler, new HgContext(), repository, + repositoryDirectory).getCatResult(request, baos); + } + finally + { + content = baos.toString().trim(); + } + + return content; + } +} diff --git a/scm-plugins/scm-hg-plugin/src/test/resources/sonia/scm/repository/spi/scm-hg-spi-test.zip b/scm-plugins/scm-hg-plugin/src/test/resources/sonia/scm/repository/spi/scm-hg-spi-test.zip new file mode 100644 index 0000000000000000000000000000000000000000..4896adc9de0d6189f13702c02e5e48520861ed9a GIT binary patch literal 6972 zcmbuE2{=^y|HsERn5o>PDWw{co6;D~$i>a_q-)<*mW;+MxQvmpl%+!5>Xuu#ZWNVn zRJ2kGX>NqdmO`>?LCT(;@H=PDFlUz3|M^eP*XVgVukUC3e$V^!$<9(j5`_Ri!M~Rq zaem?ckVGgUaNb^;+ni((64s%$w)=qc+3 zk!~eZ6I`{@hqpaNiOZHppSAQDGU|CY-GOo~sx)`jEgR*S06BmVa9}>y1WzW@mq8Bn zWpTD=hSb{HiuMG;SOJ)tcxP1^j$a4_Y6cTX_NRDr7zp5bKVb%yMkfdR1);#GK&%h} zlV(^HGR2z)MHaMW&d7p!sbF@A?F8)k8(53E_CO3zj#b_?G8J+UOq2-IVoP%87vSef z<&hlsL?IM5^b=krTRqu&QpJ9_0+loV%Yk&FXR<~@fDvuJ$GS6Uzmn9K6yj7C$z{|a z)KN~hI-q-ny52SCQ`zoe4%ze}0^@D%Slx*|AMW=IOYn*SbaynUbki2V%pJg5z-MX@ z*$c7}bXi0Sr1Fi$5Xv%=d5_hPA4t_GbosSo)jRr&YSpUJt?t*`Hk#Gy_wRB)@!2lK zv%@51&4gr)r(%z`W=5Z!+eSNf$k@B3hCEZis4Z9C_oqEzMgp+raZRE61hRt2LA2Sb z77?r}()|xojs@X0XKs}IRi-`>YLV79K7v{zO1)cbpfnKL9^J{iQuJxN#Ii8n&n4k z1#Mu^SS+#^4HvX0Xx2P1p8_X^Or_GOSbth5*3ZYEhNUwDv7UZp28~yC;9-2-!IV-4 zb^zCm^MSP8!9IaBC=1{j6ybazEd)5LAzCQ9Kc~V_tRQ9}4Mk-J(flb)Dh*cMf;YxY zb#tEh!FvN_koqLH?~_0v-T`X~Hy{v0`1bfleN%Q(cTo=mV27S&R_ zca(b>CPgrcR8LT&rp}{xMl_4*df&eS)z?z|YknK9fo z;^F3yJW*v(Zuu}P{I~am=(xkB!{$ylBzG<#~(}srS<-yO5@`if#uPEF*n4>o7ARZ-E zqFIrdPGv3MKSj!Y8ak!%fLE*x?dlTsX$NCx9{lL+Nyc#%mrHd+xJ&; zN&oepD_MQNT?uoq=|76g@%Bo?ML74V`_~HB>$kMnp3Y*wd{=&K(f$2*Qkou}j-MPI zo6-No3FQ#FJ7q#jFY8qoVY)!IRqi_BA?B%BT$cNa@=L$D;41Zl^%YI#+HRyIE zo{>J-c0I8%&45t$wO%pdjZJC?e9t+ot&ri;lpJ*}WQ z@zovI_qnQGqTg20RtkIh1wUHD;f7^H}v#S5kIh;(_w`q*yPM&L^|7%-{ievoCgg zseXld3fcYzYH^XD6WfxnK9VJb>xZ`JlnzN93(xEwyXrMw|E6nH^_Heaz?kE~x6SO^ zt9pXVrjm+TL)EWu-(_sIa%8`*iP50TBN_}B9+|kbfG+k5YwCNazCSwc-R91cZ8X#N ze*k|t3zn;vf(EFmTD3hs1y2tpHeUDtMh-|VcpcL!VJsg~94@<7@9POj~7oIR5 zOB(nf-r{ua(*!d(B5QYBP3zEwjg8xN>rZS>W+$QpgE8IXsa;Q2;k=taxz|SMHtqk^ z+tw`qrrXuv^R0-1Y&9!l-*~K#?#-TZ`}(jqtS$RpQ=0d)-jYIdJ2%HP_eh98(bucm zzcEaz!v!t_z~kI=u><8GjzBa63nOrx8DxJSI*k>?)dJvY7V#$Fo@OleuNd$&N7*yG zhI5n?U(03uI#O3W=wK4w))jzMwbL>kt~Sn>Kq+ZR4@*vD%c3sIw^ohg`%m|`){g{# zygu~)p0n55o8G<#8AtYR_loPdVy>n3tfl6$M;h%+xvI-odmH*tLrPI1X;WlQz+kT- zvXfaU7LbL<7b5z_Qnwz*?=Y|Hl5IHmY+zSdMD&%;f9}vUjyZSPxu=AU6MMOQVC?OFVXK6Shpr^_TeGnQq#f9_!U}!)>2~kH7Sem9HHBOUUT! zUYTW(*wVgog-?q~W%q>#CDPk1`)-dk>5$tGc^RI)ZS{AWm|OY+D_4nrlhiX-*paBl z5EJT$ksK6#T5fqHVQ;ysbEIDAz+$8o0!5oNVW0X_{tuHF)dGbAh1D^tj>m|E0%BE) zf@QK(mBN53fnd2hxmDG15!w;$xCNK~G=A4z)RC4gv7Udpunn_&qQ)$Wp14fsbpLaF zd-t|*&5uWyX*^{AtShH4lODm2Pj9Dxd8n|mGazmqx_MBkNMCGXh~!e1=sPvli_7gi zs%IZfl3SvwzplTerr5hbS{K#5D5*6f*Re@kS@~7b=c-$tr3IaFILxPQdJW4idQA0= z3~2ZK`z*A_J;dDT(z`~|bWHAr(<-b@&XSC;r9Ty=?!_pD7xx*(J5@s&0-< zLq07=wx?m@Fg}=_0&ig8l{ov6WB!t=MY_Sn@J zzejtH>c3Bn7_?^Be$F)4bK9&UZXauBR%U5$7QM7kLhaB2=bwI;L6>1qe`={{q~I?S z25Jtq*Up#otMw=wjcSiOU-ro9Q07;aLn-GA8=Y`4HDBygZltDqLs2DET?Bq4aB2hKrpKY5$n6|mACFIvyzZZukXdZBd09(#}W;zK- z5pd#4fl_n?*mh3o{1I>?bn{M?88?;+=bEBPg*jpj5Wyv&xcD5I-jZ)&v!Nlb=r!SI z=4OA_;qHs=!#l)UmYy{7K`ns=5!^j4*8J|AyK~eYw?uwycjJ)pb0a${+6?a8aO+$} zOe^|Rz1rIV3}YJF8IV43ecSU4!142MwUe&-1mKUL zT??BkYDXetCfI57%q|gQ(J;rstttKqRiN~A0v3M;xw?|0aKRl#912Tw4fAT-%Jpe$ zUzN66i0wW#jt3)uAe<`M3LZh~t@P(#%c;7w-H0-4MpUhgMj zJ1s0(*ON>k)3rQx=wv*F=1HfJb+qU-Dv_qGOQUYmC2t~V=@K{UaKtYZU+_&Q-~1(B z3)qwhteIX1+Bn#s%A8BXLmpOhJfz}@T5mVvpIeueT3K#D%AQqRCN6b~AU{y)$of(h zrP7X36THCS9xL({HMlWOz-`dw|G(Q%M=PlL<+;0a_T}%izp*W^O#xXg2+{{>AbjAO zxr!kcuigFzh}&-S^Kh1bNXP;#aLo(=I6NwiMVTujL==U|VE91YJ1@og+e3rQ02bIo z&eSo)6Ko_!L>T>Qs?sO?)BeKfH-{W0?mTO5P(Syw{D4%e7M_R`tF)TZDakoN^i3d{ zZmTKca!#cb1RG zH?aABl7vSpaP$^HVuP+jra}W2fcXRF^3O(Q+y}$?g3IJhO6IbXSCsr?4Y-vwpsxq5 z6drPXpDaAefRjtPWZqx{AbzJl1#d7E-vQbv3E2u=J#U^6dsd?YY*3@laU}?=&KWj%B^(iEgBldTf*MpL77B;30-eEvN3BW}c2VDd>!gri5S4&GQGm3(0z8aB{12|?YI* Date: Wed, 13 Jun 2012 14:03:28 +0200 Subject: [PATCH 052/159] remove trailing slash from path --- .../src/main/resources/sonia/scm/python/filelog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/filelog.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/filelog.py index 6fe5fa1f29..af63e1ca98 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/filelog.py +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/filelog.py @@ -44,6 +44,11 @@ def getName(path): length =- 1 return parts[length - 1] +def removeTrailingSlash(path): + if path.endswith('/'): + path = path[0:-1] + return path + def appendSubRepositoryNode(doc, parentNode, path, subRepositories): if path in subRepositories: subRepository = subRepositories[path] @@ -55,7 +60,7 @@ def appendSubRepositoryNode(doc, parentNode, path, subRepositories): def createBasicFileNode(doc, parentNode, path, directory): fileNode = createChildNode(doc, parentNode, 'file') appendTextNode(doc, fileNode, 'name', getName(path)) - appendTextNode(doc, fileNode, 'path', path) + appendTextNode(doc, fileNode, 'path', removeTrailingSlash(path)) appendTextNode(doc, fileNode, 'directory', directory) return fileNode From 08f87390d465e70eca4bfd416411f8a7b82ef521 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 14:13:42 +0200 Subject: [PATCH 053/159] added unit test for hg browse command --- .../repository/TempSCMContextProvider.java | 142 +++++++++++++++ .../spi/AbstractHgCommandTestBase.java | 12 +- .../repository/spi/HgBrowseCommandTest.java | 165 ++++++++++++++++++ .../services/sonia.scm.SCMContextProvider | 1 + 4 files changed, 315 insertions(+), 5 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java create mode 100644 scm-plugins/scm-hg-plugin/src/test/resources/META-INF/services/sonia.scm.SCMContextProvider diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java new file mode 100644 index 0000000000..f36bf66c83 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.SCMContextProvider; +import sonia.scm.Stage; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class TempSCMContextProvider implements SCMContextProvider +{ + + /** + * Method description + * + * + * @throws IOException + */ + @Override + public void close() throws IOException + { + + // do nothing + } + + /** + * Method description + * + */ + @Override + public void init() + { + + // do nothing + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + @Override + public File getBaseDirectory() + { + return baseDirectory; + } + + /** + * Method description + * + * + * @return + */ + @Override + public Stage getStage() + { + return Stage.DEVELOPMENT; + } + + /** + * Method description + * + * + * @return + */ + @Override + public Throwable getStartupError() + { + return null; + } + + /** + * Method description + * + * + * @return + */ + @Override + public String getVersion() + { + return "UNIT-Test"; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param baseDirectory + */ + public void setBaseDirectory(File baseDirectory) + { + this.baseDirectory = baseDirectory; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private File baseDirectory; +} diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java index 53e9101a0d..3cf98402dd 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java @@ -36,12 +36,12 @@ package sonia.scm.repository.spi; import org.junit.Assume; import org.junit.Before; -import sonia.scm.SCMContextProvider; +import sonia.scm.SCMContext; import sonia.scm.io.FileSystem; import sonia.scm.repository.HgContextProvider; import sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.TempSCMContextProvider; import sonia.scm.store.MemoryStoreFactory; -import sonia.scm.util.MockUtil; import static org.mockito.Mockito.*; @@ -67,13 +67,15 @@ public class AbstractHgCommandTestBase extends ZippedRepositoryTestBase public void initHgHandler() throws IOException { File folder = tempFolder.newFolder(); + TempSCMContextProvider context = + (TempSCMContextProvider) SCMContext.getContext(); + + context.setBaseDirectory(folder); + FileSystem fileSystem = mock(FileSystem.class); this.handler = new HgRepositoryHandler(new MemoryStoreFactory(), fileSystem, new HgContextProvider()); - - SCMContextProvider context = MockUtil.getSCMContextProvider(folder); - this.handler.init(context); // skip tests if hg not in path diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java new file mode 100644 index 0000000000..055d456221 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.FileObject; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class HgBrowseCommandTest extends AbstractHgCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testBrowse() throws IOException, RepositoryException + { + BrowserResult result = new HgBrowseCommand( + handler, new HgContext(), repository, + repositoryDirectory).getBrowserResult( + new BrowseCommandRequest()); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(4, foList.size()); + + FileObject a = null; + FileObject c = null; + + for (FileObject f : foList) + { + if ("a.txt".equals(f.getName())) + { + a = f; + } + else if ("c".equals(f.getName())) + { + c = f; + } + } + + assertNotNull(a); + assertFalse(a.isDirectory()); + assertEquals("a.txt", a.getName()); + assertEquals("a.txt", a.getPath()); + assertEquals("added new line for blame", a.getDescription()); + assertTrue(a.getLength() > 0); + checkDate(a.getLastModified()); + assertNotNull(c); + assertTrue(c.isDirectory()); + assertEquals("c", c.getName()); + assertEquals("c", c.getPath()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testBrowseSubDirectory() throws IOException, RepositoryException + { + BrowseCommandRequest request = new BrowseCommandRequest(); + + request.setPath("c"); + + BrowserResult result = new HgBrowseCommand(handler, new HgContext(), + repository, + repositoryDirectory).getBrowserResult(request); + + assertNotNull(result); + + List foList = result.getFiles(); + + assertNotNull(foList); + assertFalse(foList.isEmpty()); + assertEquals(2, foList.size()); + + FileObject d = null; + FileObject e = null; + + for (FileObject f : foList) + { + if ("d.txt".equals(f.getName())) + { + d = f; + } + else if ("e.txt".equals(f.getName())) + { + e = f; + } + } + + assertNotNull(d); + assertFalse(d.isDirectory()); + assertEquals("d.txt", d.getName()); + assertEquals("c/d.txt", d.getPath()); + assertEquals("added file d and e in folder c", d.getDescription()); + assertTrue(d.getLength() > 0); + checkDate(d.getLastModified()); + assertNotNull(e); + assertFalse(e.isDirectory()); + assertEquals("e.txt", e.getName()); + assertEquals("c/e.txt", e.getPath()); + assertEquals("added file d and e in folder c", e.getDescription()); + assertTrue(e.getLength() > 0); + checkDate(e.getLastModified()); + } +} diff --git a/scm-plugins/scm-hg-plugin/src/test/resources/META-INF/services/sonia.scm.SCMContextProvider b/scm-plugins/scm-hg-plugin/src/test/resources/META-INF/services/sonia.scm.SCMContextProvider new file mode 100644 index 0000000000..64643da7e5 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/resources/META-INF/services/sonia.scm.SCMContextProvider @@ -0,0 +1 @@ +sonia.scm.repository.TempSCMContextProvider \ No newline at end of file From 0bb11a17402a5d39f73ee7e42d8aab9fb04087a8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 14:17:19 +0200 Subject: [PATCH 054/159] added unit test for hg blame command --- .../repository/spi/HgBlameCommandTest.java | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java new file mode 100644 index 0000000000..9e34b36219 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import sonia.scm.repository.BlameLine; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.RepositoryException; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class HgBlameCommandTest extends AbstractHgCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResult() throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + + BlameResult result = new HgBlameCommand(handler, new HgContext(), + repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + line = result.getLine(1); + assertEquals(2, line.getLineNumber()); + assertEquals("4:2baab8e80280", line.getRevision()); + checkDate(line.getWhen()); + assertEquals("line for blame", line.getCode()); + assertEquals("added new line for blame", line.getDescription()); + assertEquals("Zaphod Beeblebrox", line.getAuthor().getName()); + assertEquals("zaphod.beeblebrox@hitchhiker.com", + line.getAuthor().getMail()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetBlameResultWithRevision() + throws IOException, RepositoryException + { + BlameCommandRequest request = new BlameCommandRequest(); + + request.setPath("a.txt"); + request.setRevision("a9bacaf1b7fa"); + + BlameResult result = new HgBlameCommand(handler, new HgContext(), + repository, + repositoryDirectory).getBlameResult(request); + + assertNotNull(result); + assertEquals(1, result.getTotal()); + + BlameLine line = result.getLine(0); + + checkFirstLine(line); + } + + /** + * Method description + * + * + * @param line + */ + private void checkFirstLine(BlameLine line) + { + assertEquals(1, line.getLineNumber()); + assertEquals("0:a9bacaf1b7fa", line.getRevision()); + checkDate(line.getWhen()); + assertEquals("a", line.getCode()); + assertEquals("added a and b files", line.getDescription()); + assertEquals("Douglas Adams", line.getAuthor().getName()); + assertEquals("douglas.adams@hitchhiker.com", line.getAuthor().getMail()); + } +} From 2f2b25aa1fe7d9efca7a4ce6cec6a8539a7fded3 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 14:29:33 +0200 Subject: [PATCH 055/159] added basic unit test for hg log command --- .../scm/repository/spi/HgLogCommandTest.java | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java new file mode 100644 index 0000000000..e9bdddf315 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository.spi; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Ignore; +import org.junit.Test; + +import sonia.scm.repository.Changeset; +import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.HgContext; +import sonia.scm.repository.Modifications; +import sonia.scm.repository.RepositoryException; + +import static org.hamcrest.Matchers.*; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class HgLogCommandTest extends AbstractHgCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetAll() throws IOException, RepositoryException + { + ChangesetPagingResult result = new HgLogCommand( + handler, new HgContext(), repository, + repositoryDirectory).getChangesets( + new LogCommandRequest()); + + assertNotNull(result); + assertEquals(5, result.getTotal()); + assertEquals(5, result.getChangesets().size()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + @Ignore + public void testGetAllByPath() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPath("a.txt"); + + ChangesetPagingResult result = + new HgLogCommand(handler, new HgContext(), repository, + repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(3, result.getTotal()); + assertEquals(3, result.getChangesets().size()); + assertEquals("4:2baab8e80280", result.getChangesets().get(0).getId()); + assertEquals("2:79b6baf49711", result.getChangesets().get(1).getId()); + assertEquals("0:a9bacaf1b7fa", result.getChangesets().get(2).getId()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetAllWithLimit() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingLimit(2); + + ChangesetPagingResult result = + new HgLogCommand(handler, new HgContext(), repository, + repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(5, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("4:2baab8e80280", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("3:542bf4893dd2", c2.getId()); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testGetCommit() throws IOException, RepositoryException + { + HgLogCommand command = new HgLogCommand(handler, new HgContext(), + repository, repositoryDirectory); + Changeset c = command.getChangeset("a9bacaf1b7fa"); + + assertNotNull(c); + assertEquals("0:a9bacaf1b7fa", c.getId()); + assertEquals("added a and b files", c.getDescription()); + checkDate(c.getDate()); + assertEquals("Douglas Adams", c.getAuthor().getName()); + assertEquals("douglas.adams@hitchhiker.com", c.getAuthor().getMail()); + assertEquals("added a and b files", c.getDescription()); + + Modifications mods = c.getModifications(); + + assertNotNull(mods); + assertTrue("modified list should be empty", mods.getModified().isEmpty()); + assertTrue("removed list should be empty", mods.getRemoved().isEmpty()); + assertFalse("added list should not be empty", mods.getAdded().isEmpty()); + assertEquals(2, mods.getAdded().size()); + assertThat(mods.getAdded(), contains("a.txt", "b.txt")); + } + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + @Ignore + public void testGetRange() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setStartChangeset("3049df33fdbb"); + request.setEndChangeset("a9bacaf1b7fa"); + + ChangesetPagingResult result = + new HgLogCommand(handler, new HgContext(), repository, + repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(2, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c1); + assertEquals("1:3049df33fdbb", c1.getId()); + assertNotNull(c2); + assertEquals("0:a9bacaf1b7fa", c2.getId()); + } +} From 402cc9af5a9ee0dab0992441c6c6fd50809b5a11 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 15:39:36 +0200 Subject: [PATCH 056/159] improve hg log command --- .../sonia/scm/repository/HgPythonScript.java | 4 +- .../scm/repository/spi/HgLogCommand.java | 12 +- .../main/resources/sonia/scm/python/log.py | 144 ++++++++++++++++++ 3 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgPythonScript.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgPythonScript.java index 927236d6ea..c0a467f5b1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgPythonScript.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgPythonScript.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- @@ -47,7 +48,8 @@ import java.io.File; public enum HgPythonScript { BLAME("blame.py"), CHANGELOG("changelog.py"), FILELOG("filelog.py"), - UTIL("util.py"), HOOK("scmhooks.py"), HGWEB("hgweb.py"), VERSION("version.py"); + LOG("log.py"), UTIL("util.py"), HOOK("scmhooks.py"), HGWEB("hgweb.py"), + VERSION("version.py"); /** Field description */ private static final String BASE_DIRECTORY = diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java index 219f6cb851..7d39973597 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java @@ -96,12 +96,12 @@ public class HgLogCommand extends AbstractHgCommand implements LogCommand env.put(ENV_REVISION, HgUtil.getRevision(id)); env.put(ENV_PATH, Util.EMPTY_STRING); - env.put(ENV_PAGE_START, Util.EMPTY_STRING); - env.put(ENV_PAGE_LIMIT, Util.EMPTY_STRING); + env.put(ENV_PAGE_START, "0"); + env.put(ENV_PAGE_LIMIT, "1"); env.put(ENV_REVISION_START, Util.EMPTY_STRING); env.put(ENV_REVISION_END, Util.EMPTY_STRING); - return getResultFromScript(Changeset.class, HgPythonScript.CHANGELOG, env); + return getResultFromScript(Changeset.class, HgPythonScript.LOG, env); } /** @@ -127,9 +127,9 @@ public class HgLogCommand extends AbstractHgCommand implements LogCommand env.put(ENV_PAGE_LIMIT, String.valueOf(request.getPagingLimit())); env.put(ENV_REVISION_START, Strings.nullToEmpty(request.getStartChangeset())); - env.put(ENV_REVISION_END, Strings.nullToEmpty(request.getStartChangeset())); + env.put(ENV_REVISION_END, Strings.nullToEmpty(request.getEndChangeset())); - return getResultFromScript(ChangesetPagingResult.class, - HgPythonScript.CHANGELOG, env); + return getResultFromScript(ChangesetPagingResult.class, HgPythonScript.LOG, + env); } } diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py new file mode 100644 index 0000000000..43dc995e39 --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py @@ -0,0 +1,144 @@ +# +# Copyright (c) 2010, Sebastian Sdorra +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# 3. Neither the name of SCM-Manager; nor the names of its +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# http://bitbucket.org/sdorra/scm-manager +# +# + + +import os +from util import * +from xml.dom.minidom import Document + +# changeset methods + +def appendIdNode(doc, parentNode, ctx): + id = getId(ctx) + appendTextNode(doc, parentNode, 'id', id) + +def appendParentNodes(doc, parentNode, ctx): + parents = ctx.parents() + if parents: + for parent in parents: + parentId = getId(parent) + appendTextNode(doc, parentNode, 'parents', parentId) + +def appendBranchesNode(doc, parentNode, ctx): + branch = ctx.branch() + if branch != 'default': + appendTextNode(doc, parentNode, 'branches', branch) + +def appendModifications(doc, parentNode, ctx): + status = repo.status(ctx.p1().node(), ctx.node()) + if status: + modificationsNode = createChildNode(doc, parentNode, 'modifications') + appendWrappedListNodes(doc, modificationsNode, 'added', 'file', status[1]) + appendWrappedListNodes(doc, modificationsNode, 'modified', 'file', status[0]) + appendWrappedListNodes(doc, modificationsNode, 'removed', 'file', status[2]) + +def appendChangesetNode(doc, parentNode, ctx): + changesetNode = createChildNode(doc, parentNode, 'changeset') + appendIdNode(doc, changesetNode, ctx) + appendParentNodes(doc, changesetNode, ctx) + appendTextNode(doc, changesetNode, 'description', ctx.description()) + appendDateNode(doc, changesetNode, 'date', ctx.date()) + appendAuthorNodes(doc, changesetNode, ctx) + appendBranchesNode(doc, changesetNode, ctx) + appendListNodes(doc, changesetNode, 'tags', ctx.tags()) + appendModifications(doc, changesetNode, ctx) + +# changeset methods end + +# change log methods + +def createBasicNodes(doc, ctxs): + rootNode = doc.createElement('changeset-paging') + doc.appendChild(rootNode) + total = str(len(ctxs)) + appendTextNode(doc, rootNode, 'total', total) + return createChildNode(doc, rootNode, 'changesets') + +def collectChangesets(repo, path, startNode, endNode): + start = 'tip' + end = '0' + if len(startNode) > 0: + start = startNode + if len(endNode) > 0: + end = endNode + + ctxs = [] + startRev = repo[start].rev() + endRev = repo[end].rev() - 1 + + onlyWithPath = len(path) > 0 + + for i in range(startRev, endRev, -1): + ctx = repo[i] + if onlyWithPath: + if path in ctx.files(): + ctxs.append(ctx) + else: + ctxs.append(ctx) + + return ctxs + + +def stripChangesets(ctxs, start, limit): + if limit < 0: + ctxs = ctxs[start] + else: + ctxs = ctxs[start:limit] + return ctxs + +# change log methods + +# main method +repo = openRepository() +doc = Document() + +# parameter +path = os.environ['SCM_PATH'] +startNode = os.environ['SCM_REVISION_START'] +endNode = os.environ['SCM_REVISION_END'] +rev = os.environ['SCM_REVISION'] +# paging parameter +start = int(os.environ['SCM_PAGE_START']) +limit = int(os.environ['SCM_PAGE_LIMIT']) + +if len(rev) > 0: + ctx = repo[rev] + appendChangesetNode(doc, doc, ctx) +else: + ctxs = collectChangesets(repo, path, startNode, endNode) + changesetsNode = createBasicNodes(doc, ctxs) + ctxs = stripChangesets(ctxs, start, limit) + for ctx in ctxs: + appendChangesetNode(doc, changesetsNode, ctx) + + +# write document +writeXml(doc) From e56cf1a41d7da88138555a4bddd8f1a82dcba1cb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 15:40:01 +0200 Subject: [PATCH 057/159] enable all unit tests for hg log command --- .../test/java/sonia/scm/repository/spi/HgLogCommandTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java index e9bdddf315..90c504bb80 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java @@ -33,7 +33,6 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- -import org.junit.Ignore; import org.junit.Test; import sonia.scm.repository.Changeset; @@ -85,7 +84,6 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase * @throws RepositoryException */ @Test - @Ignore public void testGetAllByPath() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); @@ -177,7 +175,6 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase * @throws RepositoryException */ @Test - @Ignore public void testGetRange() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); From 44750e0e59bf1224fb9b18bab2ac5a5d45a233bd Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 16:09:34 +0200 Subject: [PATCH 058/159] improve preprocessor api --- .../scm/repository/ChangesetPreProcessor.java | 3 +- .../ChangesetPreProcessorFactory.java | 2 + .../repository/FileObjectPreProcessor.java | 5 +- .../FileObjectPreProcessorFactory.java | 2 + .../sonia/scm/repository/PreProcessor.java | 51 ++++++++++++++++++ .../scm/repository/PreProcessorFactory.java | 53 +++++++++++++++++++ 6 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/PreProcessor.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java index 3e6db77967..43cddee19e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java @@ -42,7 +42,7 @@ import sonia.scm.plugin.ExtensionPoint; * @author Sebastian Sdorra */ @ExtensionPoint -public interface ChangesetPreProcessor +public interface ChangesetPreProcessor extends PreProcessor { /** @@ -51,5 +51,6 @@ public interface ChangesetPreProcessor * * @param changeset */ + @Override public void process(Changeset changeset); } diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java index fc3cc92387..d9c209a4ab 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java @@ -44,6 +44,7 @@ import sonia.scm.plugin.ExtensionPoint; */ @ExtensionPoint public interface ChangesetPreProcessorFactory + extends PreProcessorFactory { /** @@ -54,5 +55,6 @@ public interface ChangesetPreProcessorFactory * * @return */ + @Override public ChangesetPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java index 1f4e2e42ea..3170672ee9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java @@ -33,6 +33,8 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + import sonia.scm.plugin.ExtensionPoint; /** @@ -41,7 +43,7 @@ import sonia.scm.plugin.ExtensionPoint; * @since 1.10 */ @ExtensionPoint -public interface FileObjectPreProcessor +public interface FileObjectPreProcessor extends PreProcessor { /** @@ -50,5 +52,6 @@ public interface FileObjectPreProcessor * * @param fileObject */ + @Override public void process(FileObject fileObject); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java index 2e3dce877c..5584593d7a 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java @@ -44,6 +44,7 @@ import sonia.scm.plugin.ExtensionPoint; */ @ExtensionPoint public interface FileObjectPreProcessorFactory + extends PreProcessorFactory { /** @@ -54,5 +55,6 @@ public interface FileObjectPreProcessorFactory * * @return */ + @Override public FileObjectPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java new file mode 100644 index 0000000000..3431991c5a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + * + * @param + */ +public interface PreProcessor +{ + + /** + * Method description + * + * + * @param item + */ + public void process(T item); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java new file mode 100644 index 0000000000..bd25b578bf --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +/** + * + * @author Sebastian Sdorra + * + * @param + * @since 1.17 + */ +public interface PreProcessorFactory +{ + + /** + * Method description + * + * + * @param repository + * + * @return + */ + public PreProcessor createPreProcessor(Repository repository); +} From 6de86c82c5b075faccbb8ad5c73517d5fb57048d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 16:23:43 +0200 Subject: [PATCH 059/159] added helper class for pre processor handling --- .../scm/repository/PreProcessorUtil.java | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java new file mode 100644 index 0000000000..d697cd5b82 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java @@ -0,0 +1,241 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.inject.Inject; + +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Set; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public class PreProcessorUtil +{ + + /** + * Constructs ... + * + * + * @param changesetPreProcessorSet + * @param changesetPreProcessorFactorySet + * @param fileObjectPreProcessorSet + * @param fileObjectPreProcessorFactorySet + */ + @Inject + public PreProcessorUtil( + Set changesetPreProcessorSet, + Set changesetPreProcessorFactorySet, + Set fileObjectPreProcessorSet, + Set fileObjectPreProcessorFactorySet) + { + this.changesetPreProcessorSet = changesetPreProcessorSet; + this.changesetPreProcessorFactorySet = changesetPreProcessorFactorySet; + this.fileObjectPreProcessorSet = fileObjectPreProcessorSet; + this.fileObjectPreProcessorFactorySet = fileObjectPreProcessorFactorySet; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param repository + * @param changeset + */ + public void prepareForReturn(Repository repository, Changeset changeset) + { + EscapeUtil.escape(changeset); + callPreProcessors(changesetPreProcessorSet, changeset); + callPreProcessorFactories(changesetPreProcessorFactorySet, repository, + changeset); + } + + /** + * Method description + * + * + * @param repository + * @param changeset + * @param result + */ + public void prepareForReturn(Repository repository, BrowserResult result) + { + EscapeUtil.escape(result); + callPreProcessors(fileObjectPreProcessorSet, result); + callPreProcessorFactories(fileObjectPreProcessorFactorySet, repository, + result); + } + + /** + * Method description + * + * + * @param repository + * @param result + */ + public void prepareForReturn(Repository repository, + ChangesetPagingResult result) + { + EscapeUtil.escape(result); + callPreProcessors(changesetPreProcessorSet, result); + callPreProcessorFactories(changesetPreProcessorFactorySet, repository, + result); + } + + /** + * Method description + * + * + * + * + * @param preProcessorFactorySet + * @param repository + * @param changesets + * @param items + * @param + */ + private void callPreProcessorFactories( + Set> preProcessorFactorySet, + Repository repository, Iterable items) + { + if (Util.isNotEmpty(preProcessorFactorySet)) + { + for (PreProcessorFactory factory : preProcessorFactorySet) + { + PreProcessor preProcessor = factory.createPreProcessor(repository); + + if (preProcessor != null) + { + for (T item : items) + { + preProcessor.process(item); + } + } + } + } + } + + /** + * Method description + * + * + * + * @param preProcessorFactorySet + * @param repository + * @param item + * @param + */ + private void callPreProcessorFactories( + Set> preProcessorFactorySet, + Repository repository, T item) + { + if (Util.isNotEmpty(preProcessorFactorySet)) + { + for (PreProcessorFactory factory : preProcessorFactorySet) + { + PreProcessor cpp = factory.createPreProcessor(repository); + + if (cpp != null) + { + cpp.process(item); + } + } + } + } + + /** + * Method description + * + * + * @param changesets + * + * @param preProcessorSet + * @param items + * @param + */ + private void callPreProcessors( + Set> preProcessorSet, Iterable items) + { + if (Util.isNotEmpty(preProcessorSet)) + { + for (T item : items) + { + callPreProcessors(preProcessorSet, item); + } + } + } + + /** + * Method description + * + * + * @param c + * + * @param preProcessorSet + * @param item + * @param + */ + private void callPreProcessors( + Set> preProcessorSet, T item) + { + if (Util.isNotEmpty(preProcessorSet)) + { + for (PreProcessor preProcessor : preProcessorSet) + { + preProcessor.process(item); + } + } + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private Set changesetPreProcessorFactorySet; + + /** Field description */ + private Set changesetPreProcessorSet; + + /** Field description */ + private Set fileObjectPreProcessorFactorySet; + + /** Field description */ + private Set fileObjectPreProcessorSet; +} From 50dc72be50bcfefcc3bacb14c7156b91514f4fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 16:28:19 +0200 Subject: [PATCH 060/159] call pre processors in new repository api --- .../repository/api/BrowseCommandBuilder.java | 13 ++++++++++++- .../scm/repository/api/LogCommandBuilder.java | 18 +++++++++++++++++- .../scm/repository/api/RepositoryService.java | 13 ++++++++++--- .../api/RepositoryServiceFactory.java | 12 ++++++++++-- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index c365682134..1d056c20c0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -40,6 +40,7 @@ import com.google.common.base.Objects; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.BrowseCommand; @@ -73,14 +74,16 @@ public final class BrowseCommandBuilder * @param logCommand implementation of the {@link LogCommand} * @param browseCommand * @param repository repository to query + * @param preProcessorUtil */ BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand, - Repository repository) + Repository repository, PreProcessorUtil preProcessorUtil) { this.cache = cacheManager.getCache(CacheKey.class, BrowserResult.class, CACHE_NAME); this.browseCommand = browseCommand; this.repository = repository; + this.preProcessorUtil = preProcessorUtil; } //~--- methods -------------------------------------------------------------- @@ -130,6 +133,11 @@ public final class BrowseCommandBuilder } } + if (result != null) + { + preProcessorUtil.prepareForReturn(repository, result); + } + return result; } @@ -268,6 +276,9 @@ public final class BrowseCommandBuilder /** disables the cache */ private boolean disableCache; + /** Field description */ + private PreProcessorUtil preProcessorUtil; + /** the repsitory */ private Repository repository; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index 2572b3076f..605804fd22 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -42,6 +42,7 @@ import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; +import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.LogCommand; @@ -112,14 +113,16 @@ public final class LogCommandBuilder * @param cacheManager cache manager * @param logCommand implementation of the {@link LogCommand} * @param repository repository to query + * @param preProcessorUtil */ LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand, - Repository repository) + Repository repository, PreProcessorUtil preProcessorUtil) { this.cache = cacheManager.getCache(CacheKey.class, ChangesetPagingResult.class, CACHE_NAME); this.logCommand = logCommand; this.repository = repository; + this.preProcessorUtil = preProcessorUtil; } //~--- methods -------------------------------------------------------------- @@ -196,6 +199,11 @@ public final class LogCommandBuilder } } + if (changeset != null) + { + preProcessorUtil.prepareForReturn(repository, changeset); + } + return changeset; } @@ -234,6 +242,11 @@ public final class LogCommandBuilder } } + if (cpr != null) + { + preProcessorUtil.prepareForReturn(repository, cpr); + } + return cpr; } @@ -453,6 +466,9 @@ public final class LogCommandBuilder /** Implementation of the log command */ private LogCommand logCommand; + /** Field description */ + private PreProcessorUtil preProcessorUtil; + /** repository to query */ private Repository repository; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 53207c7406..bfa79da066 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -36,6 +36,7 @@ package sonia.scm.repository.api; //~--- non-JDK imports -------------------------------------------------------- import sonia.scm.cache.CacheManager; +import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.spi.RepositoryServiceProvider; @@ -64,13 +65,16 @@ public final class RepositoryService * @param cacheManager cache manager * @param provider implementation for {@link RepositoryServiceProvider} * @param repository the repository + * @param preProcessorUtil */ RepositoryService(CacheManager cacheManager, - RepositoryServiceProvider provider, Repository repository) + RepositoryServiceProvider provider, Repository repository, + PreProcessorUtil preProcessorUtil) { this.cacheManager = cacheManager; this.provider = provider; this.repository = repository; + this.preProcessorUtil = preProcessorUtil; } //~--- get methods ---------------------------------------------------------- @@ -98,7 +102,7 @@ public final class RepositoryService public BrowseCommandBuilder getBrowseCommand() { return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(), - repository); + repository, preProcessorUtil); } /** @@ -136,7 +140,7 @@ public final class RepositoryService public LogCommandBuilder getLogCommand() { return new LogCommandBuilder(cacheManager, provider.getLogCommand(), - repository); + repository, preProcessorUtil); } /** @@ -157,6 +161,9 @@ public final class RepositoryService /** cache manager */ private CacheManager cacheManager; + /** Field description */ + private PreProcessorUtil preProcessorUtil; + /** implementation of the repository service provider */ private RepositoryServiceProvider provider; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index e55bcfce8c..4da2d1d7f3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -44,6 +44,7 @@ import com.google.inject.Singleton; import sonia.scm.cache.CacheManager; import sonia.scm.repository.PermissionType; import sonia.scm.repository.PermissionUtil; +import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryNotFoundException; @@ -98,17 +99,20 @@ public final class RepositoryServiceFactory * @param repositoryManager manager for repositories * @param securityContextProvider provider for the current security context * @param resolvers a set of {@link RepositoryServiceResolver} + * @param preProcessorUtil helper object for pre processor handling */ @Inject public RepositoryServiceFactory( CacheManager cacheManager, RepositoryManager repositoryManager, Provider securityContextProvider, - Set resolvers) + Set resolvers, + PreProcessorUtil preProcessorUtil) { this.cacheManager = cacheManager; this.repositoryManager = repositoryManager; this.securityContextProvider = securityContextProvider; this.resolvers = resolvers; + this.preProcessorUtil = preProcessorUtil; } //~--- methods -------------------------------------------------------------- @@ -219,7 +223,8 @@ public final class RepositoryServiceFactory if (provider != null) { - service = new RepositoryService(cacheManager, provider, repository); + service = new RepositoryService(cacheManager, provider, repository, + preProcessorUtil); break; } @@ -238,6 +243,9 @@ public final class RepositoryServiceFactory /** Field description */ private CacheManager cacheManager; + /** Field description */ + private PreProcessorUtil preProcessorUtil; + /** Field description */ private RepositoryManager repositoryManager; From c3fb8c04cae5093735458a1df160f6b8c6cf6b48 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 13 Jun 2012 16:31:38 +0200 Subject: [PATCH 061/159] added option to disable pre processor execution --- .../repository/api/BrowseCommandBuilder.java | 23 +++++++++++++++-- .../scm/repository/api/LogCommandBuilder.java | 25 ++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 1d056c20c0..6ec29a7264 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -133,7 +133,7 @@ public final class BrowseCommandBuilder } } - if (result != null) + if (! disablePreProcessors && result != null) { preProcessorUtil.prepareForReturn(repository, result); } @@ -160,6 +160,22 @@ public final class BrowseCommandBuilder return this; } + /** + * Disable the execution of pre processors. + * + * + * @param disablePreProcessors true to disable the pre processors execution + * + * @return {@code this} + */ + public BrowseCommandBuilder setDisablePreProcessors( + boolean disablePreProcessors) + { + this.disablePreProcessors = disablePreProcessors; + + return this; + } + /** * Retrieve only files which are children of the given path. * This path have to be a directory. @@ -274,7 +290,10 @@ public final class BrowseCommandBuilder private Cache cache; /** disables the cache */ - private boolean disableCache; + private boolean disableCache = false; + + /** disables the execution of pre processors */ + private boolean disablePreProcessors = false; /** Field description */ private PreProcessorUtil preProcessorUtil; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index 605804fd22..cd9976de9a 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -199,7 +199,7 @@ public final class LogCommandBuilder } } - if (changeset != null) + if (! disablePreProcessors && changeset != null) { preProcessorUtil.prepareForReturn(repository, changeset); } @@ -242,7 +242,7 @@ public final class LogCommandBuilder } } - if (cpr != null) + if (! disablePreProcessors && cpr != null) { preProcessorUtil.prepareForReturn(repository, cpr); } @@ -284,6 +284,22 @@ public final class LogCommandBuilder return this; } + /** + * Disable the execution of pre processors. + * + * + * @param disablePreProcessors true to disable the pre processors execution + * + * @return {@code this} + */ + public LogCommandBuilder setDisablePreProcessors( + boolean disablePreProcessors) + { + this.disablePreProcessors = disablePreProcessors; + + return this; + } + /** * Retrieve changesets until the given the {@link Changeset} * with the given id. @@ -461,7 +477,10 @@ public final class LogCommandBuilder private Cache cache; /** disable cache */ - private boolean disableCache; + private boolean disableCache = false; + + /** disable the execution of pre processors */ + private boolean disablePreProcessors = false; /** Implementation of the log command */ private LogCommand logCommand; From ebd0bdd92e516dd04140a456fe5b3284a1e5c0f9 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 14 Jun 2012 21:42:49 +0200 Subject: [PATCH 062/159] fix ugly login error message --- .../webapp/resources/js/login/sonia.login.form.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js b/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js index cb8f7e5240..c4ed773987 100644 --- a/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js +++ b/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js @@ -38,6 +38,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ waitTitleText: 'Connecting', WaitMsgText: 'Sending data...', failedMsgText: 'Login failed!', + failedDescriptionText: 'Incorrect username, password or not enough permission. Please Try again.', initComponent: function(){ @@ -88,7 +89,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ }] }; - this.addEvents('cancel'); + this.addEvents('cancel', 'failure'); Ext.apply(this, Ext.apply(this.initialConfig, config)); Sonia.login.Form.superclass.initComponent.apply(this, arguments); @@ -118,7 +119,13 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{ if ( debug ){ console.debug( 'login failed' ); } - Ext.Msg.alert(this.failedMsgText); + this.fireEvent('failure'); + Ext.Msg.show({ + title: this.failedMsgText, + msg: this.failedDescriptionText, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.WARNING + }); form.reset(); } }); From bc99edb176f8223ce32883aeddc0e3b39c958a1f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 14 Jun 2012 21:46:12 +0200 Subject: [PATCH 063/159] german localization for failedDescriptionText --- scm-webapp/src/main/webapp/resources/js/i18n/de.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/webapp/resources/js/i18n/de.js b/scm-webapp/src/main/webapp/resources/js/i18n/de.js index e93addef4e..a98f58afad 100644 --- a/scm-webapp/src/main/webapp/resources/js/i18n/de.js +++ b/scm-webapp/src/main/webapp/resources/js/i18n/de.js @@ -86,7 +86,9 @@ if (Sonia.login.Form){ cancelText: 'Abbrechen', waitTitleText: 'Verbinden', WaitMsgText: 'Übertrage Daten...', - failedMsgText: 'Anmeldung fehlgeschlagen!' + failedMsgText: 'Anmeldung fehlgeschlagen!', + failedDescriptionText: 'Falscher Benutzername, Passwort oder sie haben nicht\n\ + genug Berechtigungen. Bitte versuchen sie es erneut.' }); } From 54e6c564d6d79024a9cf90aed158ff0fdb0669e4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 16:00:09 +0200 Subject: [PATCH 064/159] added warning message if javascript is disabled --- scm-webapp/src/main/webapp/index.html | 11 ++++++++++- .../src/main/webapp/resources/css/style.css | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index ae9ff6a176..05483ea295 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -211,6 +211,15 @@ - + + \ No newline at end of file diff --git a/scm-webapp/src/main/webapp/resources/css/style.css b/scm-webapp/src/main/webapp/resources/css/style.css index 05ee6d9971..0adbcadd9f 100644 --- a/scm-webapp/src/main/webapp/resources/css/style.css +++ b/scm-webapp/src/main/webapp/resources/css/style.css @@ -183,3 +183,22 @@ li.scm-removed { background-image: url(../images/delete.png); } + +div.noscript-container { + background-color: #ffffff; + margin: 10px; + color: #202020; + font-family: Verdana,Helvetica,Arial,sans-serif; + font-size: 12px; + margin: 1em; +} + +div.noscript-container h1 { + font-size: 18px; + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + font-weight: bold; + margin: 0.5em 0em; + padding: 0px; + color: #D20005; + border-bottom: 1px solid #AFAFAF; +} From 394a01c4edb70f413e38484103ca532d4c0cf00c Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 16:03:37 +0200 Subject: [PATCH 065/159] close branch issue-183 From 0ec4f5793b5f6a81ad9f5fb7caf0eb32edc11e1b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 16:04:57 +0200 Subject: [PATCH 066/159] close branch issue-178 From 659130a1723e2111b90c9ae66a62d5ffcabec483 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 16:33:10 +0200 Subject: [PATCH 067/159] added compatibility modes for svn 1.7 --- .../sonia/scm/repository/Compatibility.java | 42 +++++++++++++++++-- .../scm/repository/SvnRepositoryHandler.java | 7 +++- .../main/resources/sonia/scm/svn.config.js | 12 ++++++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java index 3ff8438725..69ba6e2904 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java @@ -39,8 +39,11 @@ package sonia.scm.repository; */ public enum Compatibility { - NONE(false, false, false), PRE14(true, true, true), PRE15(false, true, true), - PRE16(false, false, true); + NONE(false, false, false, false, false), + PRE14(true, true, true, true, false), PRE15(false, true, true, true, false), + PRE16(false, false, true, true, false), + PRE17(false, false, false, true, false), + WITH17(false, false, false, false, true); /** * Field description @@ -48,13 +51,18 @@ public enum Compatibility * @param pre14Compatible * @param pre15Compatible * @param pre16Compatible + * @param pre17Compatible + * @param with17Compatible */ private Compatibility(boolean pre14Compatible, boolean pre15Compatible, - boolean pre16Compatible) + boolean pre16Compatible, boolean pre17Compatible, + boolean with17Compatible) { this.pre14Compatible = pre14Compatible; this.pre15Compatible = pre15Compatible; this.pre16Compatible = pre16Compatible; + this.pre17Compatible = pre17Compatible; + this.with17Compatible = with17Compatible; } //~--- get methods ---------------------------------------------------------- @@ -92,6 +100,28 @@ public enum Compatibility return pre16Compatible; } + /** + * Method description + * + * + * @return + */ + public boolean isPre17Compatible() + { + return pre17Compatible; + } + + /** + * Method description + * + * + * @return + */ + public boolean isWith17Compatible() + { + return with17Compatible; + } + //~--- fields --------------------------------------------------------------- /** Field description */ @@ -102,4 +132,10 @@ public enum Compatibility /** Field description */ private boolean pre16Compatible; + + /** Field description */ + private boolean pre17Compatible; + + /** Field description */ + private boolean with17Compatible; } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java index 2254e94941..a33c8613e9 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java @@ -293,7 +293,9 @@ public class SvnRepositoryHandler log.append(directory.getName()).append("\": pre14Compatible="); log.append(comp.isPre14Compatible()).append(", pre15Compatible="); log.append(comp.isPre15Compatible()).append(", pre16Compatible="); - log.append(comp.isPre16Compatible()); + log.append(comp.isPre16Compatible()).append(", pre17Compatible="); + log.append(comp.isPre17Compatible()).append(", with17Compatible="); + log.append(comp.isWith17Compatible()); logger.debug(log.toString()); } @@ -303,7 +305,8 @@ public class SvnRepositoryHandler { SVNURL url = SVNRepositoryFactory.createLocalRepository(directory, null, true, false, comp.isPre14Compatible(), - comp.isPre15Compatible(), comp.isPre16Compatible()); + comp.isPre15Compatible(), comp.isPre16Compatible(), + comp.isPre17Compatible(), comp.isWith17Compatible()); svnRepository = SVNRepositoryFactory.create(url); diff --git a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js index 5cc3339c78..1359b71696 100644 --- a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js +++ b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js @@ -40,6 +40,8 @@ Sonia.svn.ConfigPanel = Ext.extend(Sonia.config.SimpleConfigForm, { pre14CompatibleText: 'Pre 1.4 Compatible', pre15CompatibleText: 'Pre 1.5 Compatible', pre16CompatibleText: 'Pre 1.6 Compatible', + pre17CompatibleText: 'Pre 1.7 Compatible', + with17CompatibleText: 'With 1.7 Compatible', enableGZipText: 'Enable GZip Encoding', disabledText: 'Disabled', @@ -80,6 +82,14 @@ Sonia.svn.ConfigPanel = Ext.extend(Sonia.config.SimpleConfigForm, { boxLabel: this.pre16CompatibleText, inputValue: 'PRE16', name: 'compatibility' + },{ + boxLabel: this.pre17CompatibleText, + inputValue: 'PRE17', + name: 'compatibility' + },{ + boxLabel: this.with17CompatibleText, + inputValue: 'WITH17', + name: 'compatibility' }] },{ xtype: 'checkbox', @@ -117,6 +127,8 @@ if ( i18n != null && i18n.country == 'de' ){ pre14CompatibleText: 'Mit Versionen vor 1.4 kompatibel', pre15CompatibleText: 'Mit Versionen vor 1.5 kompatibel', pre16CompatibleText: 'Mit Versionen vor 1.6 kompatibel', + pre17CompatibleText: 'Mit Versionen vor 1.7 kompatibel', + with17CompatibleText: 'Mit Version 1.7 kompatibel', disabledText: 'Deaktivieren', // helpTexts From 71f8e9c846528b852a09b33df6f96f822e4e9a57 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 16:35:05 +0200 Subject: [PATCH 068/159] close branch issue-182 From 2e8481e63f834307e8db49f758c53dbf77d0edec Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 18:30:34 +0200 Subject: [PATCH 069/159] mark url of repository as deprecated --- .../java/sonia/scm/repository/Repository.java | 25 +++++++- .../sonia/scm/repository/RepositoryTest.java | 61 +++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java diff --git a/scm-core/src/main/java/sonia/scm/repository/Repository.java b/scm-core/src/main/java/sonia/scm/repository/Repository.java index 965f601d65..ea022d4538 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Repository.java +++ b/scm-core/src/main/java/sonia/scm/repository/Repository.java @@ -39,6 +39,7 @@ import com.google.common.base.Objects; import sonia.scm.BasicPropertiesAware; import sonia.scm.ModelObject; +import sonia.scm.util.HttpUtil; import sonia.scm.util.Util; import sonia.scm.util.ValidationUtil; @@ -164,6 +165,22 @@ public class Repository extends BasicPropertiesAware implements ModelObject repository.setArchived(archived); } + /** + * Creates the url of the repository. + * + * + * @param baseUrl base url of the server including the context path + * + * @return url of the repository + * @since 1.17 + */ + public String createUrl(String baseUrl) + { + String url = HttpUtil.append(baseUrl, type); + + return HttpUtil.append(url, name); + } + /** * Returns true if the {@link Repository} is the same as the obj argument. * @@ -343,7 +360,9 @@ public class Repository extends BasicPropertiesAware implements ModelObject * * * @return base url + * @deprecated use {@link #createUrl(String)} */ + @Deprecated public String getUrl() { return url; @@ -511,7 +530,9 @@ public class Repository extends BasicPropertiesAware implements ModelObject * * * @param url base url + * @deprecated */ + @Deprecated public void setUrl(String url) { this.url = url; @@ -550,6 +571,8 @@ public class Repository extends BasicPropertiesAware implements ModelObject /** Field description */ private String type; - /** Field description */ + /** + * @deprecated use {@link #createUrl(java.lang.String)} instead + */ private String url; } diff --git a/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java b/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java new file mode 100644 index 0000000000..5a7ac8c4fb --- /dev/null +++ b/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * + * @author Sebastian Sdorra + */ +public class RepositoryTest +{ + + /** + * Method description + * + */ + @Test + public void testCreateUrl() + { + Repository repository = new Repository("123", "hg", "test/repo"); + + assertEquals("http://localhost:8080/scm/hg/test/repo", + repository.createUrl("http://localhost:8080/scm")); + assertEquals("http://localhost:8080/scm/hg/test/repo", + repository.createUrl("http://localhost:8080/scm/")); + } +} From b95a275cb86fc3e253faf0973510abf65a27ff17 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 18:37:45 +0200 Subject: [PATCH 070/159] use createUrl instead of deprecated getUrl --- .../cli/cmd/CreateRepositorySubCommand.java | 2 +- .../scm/cli/cmd/GetRepositorySubCommand.java | 2 +- .../cli/cmd/ListRepositoriesSubCommand.java | 2 +- .../cli/cmd/ModifyRepositorySubCommand.java | 2 +- .../scm/cli/cmd/PermissionSubCommand.java | 2 +- .../scm/cli/wrapper/RepositoryWrapper.java | 23 +++++++++++++++++-- .../sonia/scm/cli/wrapper/WrapperUtil.java | 9 ++++++-- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/CreateRepositorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/CreateRepositorySubCommand.java index 79e8c5a96f..52828eba25 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/CreateRepositorySubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/CreateRepositorySubCommand.java @@ -170,7 +170,7 @@ public class CreateRepositorySubCommand extends TemplateSubCommand Map env = new HashMap(); - env.put("repository", new RepositoryWrapper(repository)); + env.put("repository", new RepositoryWrapper(config, repository)); renderTemplate(env, GetRepositorySubCommand.TEMPLATE); } diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/GetRepositorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/GetRepositorySubCommand.java index 9e9c0fbe29..c7c497bacf 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/GetRepositorySubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/GetRepositorySubCommand.java @@ -104,7 +104,7 @@ public class GetRepositorySubCommand extends TemplateSubCommand { Map env = new HashMap(); - env.put("repository", new RepositoryWrapper(repository)); + env.put("repository", new RepositoryWrapper(config, repository)); renderTemplate(env, TEMPLATE); } else diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ListRepositoriesSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ListRepositoriesSubCommand.java index 518bd062d5..2235781791 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ListRepositoriesSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ListRepositoriesSubCommand.java @@ -74,7 +74,7 @@ public class ListRepositoriesSubCommand extends TemplateSubCommand List repositories = session.getRepositoryHandler().getAll(); Map env = new HashMap(); - env.put("repositories", WrapperUtil.wrapRepositories(repositories)); + env.put("repositories", WrapperUtil.wrapRepositories(config, repositories)); renderTemplate(env, TEMPLATE); } } diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ModifyRepositorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ModifyRepositorySubCommand.java index 1f991fa746..5ec4c59519 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ModifyRepositorySubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ModifyRepositorySubCommand.java @@ -214,7 +214,7 @@ public class ModifyRepositorySubCommand extends TemplateSubCommand Map env = new HashMap(); - env.put("repository", new RepositoryWrapper(repository)); + env.put("repository", new RepositoryWrapper(config, repository)); renderTemplate(env, GetRepositorySubCommand.TEMPLATE); } else diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/PermissionSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/PermissionSubCommand.java index c701a45808..a6b5eba2f5 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/PermissionSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/PermissionSubCommand.java @@ -120,7 +120,7 @@ public abstract class PermissionSubCommand extends TemplateSubCommand Map env = new HashMap(); - env.put("repository", new RepositoryWrapper(repository)); + env.put("repository", new RepositoryWrapper(config, repository)); renderTemplate(env, GetRepositorySubCommand.TEMPLATE); } else diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/RepositoryWrapper.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/RepositoryWrapper.java index 68d5131cbc..216afde624 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/RepositoryWrapper.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/RepositoryWrapper.java @@ -35,6 +35,7 @@ package sonia.scm.cli.wrapper; //~--- non-JDK imports -------------------------------------------------------- +import sonia.scm.cli.config.ServerConfig; import sonia.scm.repository.Permission; import sonia.scm.repository.Repository; @@ -54,10 +55,25 @@ public class RepositoryWrapper extends AbstractWrapper * Constructs ... * * + * @param config * @param repository */ - public RepositoryWrapper(Repository repository) + public RepositoryWrapper(ServerConfig config, Repository repository) { + this(config.getServerUrl(), repository); + } + + /** + * Constructs ... + * + * + * + * @param baseUrl + * @param repository + */ + public RepositoryWrapper(String baseUrl, Repository repository) + { + this.baseUrl = baseUrl; this.repository = repository; } @@ -159,7 +175,7 @@ public class RepositoryWrapper extends AbstractWrapper */ public String getUrl() { - return repository.getUrl(); + return repository.createUrl(baseUrl); } /** @@ -186,6 +202,9 @@ public class RepositoryWrapper extends AbstractWrapper //~--- fields --------------------------------------------------------------- + /** Field description */ + private String baseUrl; + /** Field description */ private Repository repository; } diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/WrapperUtil.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/WrapperUtil.java index dce0bef3fc..f508b45039 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/WrapperUtil.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/wrapper/WrapperUtil.java @@ -35,6 +35,7 @@ package sonia.scm.cli.wrapper; //~--- non-JDK imports -------------------------------------------------------- +import sonia.scm.cli.config.ServerConfig; import sonia.scm.group.Group; import sonia.scm.repository.Repository; import sonia.scm.user.User; @@ -76,18 +77,22 @@ public class WrapperUtil * Method description * * + * + * @param baseUrl + * + * @param config * @param repositories * * @return */ - public static List wrapRepositories( + public static List wrapRepositories(ServerConfig config, Collection repositories) { List wrappers = new ArrayList(); for (Repository r : repositories) { - wrappers.add(new RepositoryWrapper(r)); + wrappers.add(new RepositoryWrapper(config.getServerUrl(), r)); } return wrappers; From 48eaca73ef620897b9c7be6f831f30155ce22ecf Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 15 Jun 2012 18:58:26 +0200 Subject: [PATCH 071/159] create repository url from repository type and name --- .../js/repository/sonia.repository.grid.js | 14 ++++++++++---- .../js/repository/sonia.repository.infopanel.js | 4 ++-- .../resources/js/repository/sonia.repository.js | 10 ++++++++++ .../main/webapp/resources/js/util/sonia.util.js | 15 +++++++++++++++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js index 4d157f0dcb..a9428d2413 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js @@ -86,8 +86,6 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { name: 'description' },{ name: 'creationDate' - },{ - name:'url' },{ name: 'public' },{ @@ -150,8 +148,9 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { },{ id: 'Url', header: this.colUrlText, - dataIndex: 'url', - renderer: this.renderUrl, + dataIndex: 'name', + renderer: this.renderRepositoryUrl, + scope: this, width: 250 },{ id: 'Archive', @@ -219,6 +218,13 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { } }, + renderRepositoryUrl: function(name, meta, record){ + var type = record.get('type'); + return this.renderUrl( + Sonia.repository.createUrl(type, name) + ); + }, + renderArchive: function(v){ return v ? ' + v + ' : ''; }, diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js index 20c40c62a7..01f4bdffa9 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js @@ -74,7 +74,7 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { text: this.urlText },{ xtype: 'box', - html: String.format(this.linkTemplate, this.item.url) + html: String.format(this.linkTemplate, Sonia.repository.createUrlFromObject(this.item)) }]; var config = { @@ -105,7 +105,7 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { }, getRepositoryUrlWithUsername: function(){ - var uri = this.item.url; + var uri = Sonia.repository.createUrlFromObject(this.item); if ( state.user.name != 'anonymous' ){ var index = uri.indexOf("://"); if ( index > 0 ){ diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index 13d1d1af56..0c3dad29f8 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -78,6 +78,16 @@ Sonia.repository.setEditPanel = function(panels){ editPanel.doLayout(); } +Sonia.repository.createUrl = function(type, name){ + return Sonia.util.getBaseUrl() + '/' + type + '/' + name +} + +Sonia.repository.createUrlFromObject = function(repository){ + var url = Sonia.repository.createUrl(repository.type, repository.name); + console.debug(url); + return url; +} + /** * default panel */ diff --git a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js index 450ba16a57..4f80ed7b09 100644 --- a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js +++ b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js @@ -59,6 +59,21 @@ Sonia.util.getContextPath = function(){ return path; } +Sonia.util.getBaseUrl = function(){ + var url = location.href; + var i = url.indexOf('#'); + if ( i > 0 ){ + url = url.substring(0, i); + } + + if ( url.endsWith('/index.html') ){ + url = url.substring(0, url.length - '/index.html'.length); + } else if ( url.endsWith('/') ){ + url = url.substring(0, url.length -1); + } + return url; +} + Sonia.util.getName = function(path){ var name = path; var index = path.lastIndexOf('/'); From 2a08fa803e93836c94320282f2458db9fee38e5a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 11:54:04 +0200 Subject: [PATCH 072/159] bind repository service resolver --- .../java/sonia/scm/BindingExtensionProcessor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java b/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java index c3195ff97c..07df184863 100644 --- a/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java +++ b/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java @@ -54,6 +54,7 @@ import sonia.scm.repository.RepositoryHandler; import sonia.scm.repository.RepositoryHook; import sonia.scm.repository.RepositoryListener; import sonia.scm.repository.RepositoryRequestListener; +import sonia.scm.repository.spi.RepositoryServiceResolver; import sonia.scm.resources.ResourceHandler; import sonia.scm.security.EncryptionHandler; import sonia.scm.user.UserListener; @@ -124,6 +125,10 @@ public class BindingExtensionProcessor implements ExtensionProcessor Multibinder fileObjectPreProcessorFactoryBinder = Multibinder.newSetBinder(binder, FileObjectPreProcessorFactory.class); + // repository service resolver + Multibinder repositoryServiceResolverBinder = + Multibinder.newSetBinder(binder, RepositoryServiceResolver.class); + // listeners Multibinder repositoryListenerBinder = Multibinder.newSetBinder(binder, RepositoryListener.class); @@ -297,6 +302,16 @@ public class BindingExtensionProcessor implements ExtensionProcessor servletContextListenerBinder.addBinding().to(extensionClass); } + else if (RepositoryServiceResolver.class.isAssignableFrom(extensionClass)) + { + if (logger.isInfoEnabled()) + { + logger.info("bind RepositoryServiceResolver {}", + extensionClass.getName()); + } + + repositoryServiceResolverBinder.addBinding().to(extensionClass); + } else { if (logger.isInfoEnabled()) From f9cb3e02799e574849045d650c45e01f90af7868 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 11:55:21 +0200 Subject: [PATCH 073/159] bind repository service factory --- scm-webapp/src/main/java/sonia/scm/ScmServletModule.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java b/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java index 8c9847746e..135f5113cf 100644 --- a/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java +++ b/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java @@ -71,6 +71,7 @@ import sonia.scm.repository.RepositoryBrowserUtil; import sonia.scm.repository.RepositoryDAO; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryProvider; +import sonia.scm.repository.api.RepositoryServiceFactory; import sonia.scm.repository.xml.XmlRepositoryDAO; import sonia.scm.resources.DefaultResourceManager; import sonia.scm.resources.DevelopmentResourceManager; @@ -299,6 +300,9 @@ public class ScmServletModule extends ServletModule Names.named(UrlProviderFactory.TYPE_WUI)).toProvider( WebUIUrlProvider.class); + // bind repository service factory + bind(RepositoryServiceFactory.class); + /* * filter(PATTERN_PAGE, * PATTERN_STATIC_RESOURCES).through(StaticResourceFilter.class); From be877b1d1678a77de19c2e18b4ea1fd3111353e1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:16:09 +0200 Subject: [PATCH 074/159] added get method for the repository --- .../sonia/scm/repository/api/RepositoryService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index bfa79da066..67355e5768 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -143,6 +143,19 @@ public final class RepositoryService repository, preProcessorUtil); } + /** + * Returns the repository of this service. + * + * + * @param repository repository of this service + * + * @return repository of this service + */ + public Repository getRepository() + { + return repository; + } + /** * Returns true if the command is supported by the repository service. * From 6b1a00bffc780f7aeecbb1eb8b60f1b7dcdf0038 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:22:51 +0200 Subject: [PATCH 075/159] added logging to repository service and repository service factory --- .../scm/repository/api/RepositoryService.java | 41 +++++++++++++++++++ .../api/RepositoryServiceFactory.java | 18 ++++++++ 2 files changed, 59 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 67355e5768..8c824a1f5f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -35,6 +35,9 @@ package sonia.scm.repository.api; //~--- non-JDK imports -------------------------------------------------------- +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.cache.CacheManager; import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; @@ -58,6 +61,14 @@ import sonia.scm.repository.spi.RepositoryServiceProvider; public final class RepositoryService { + /** + * the logger for RepositoryService + */ + private static final Logger logger = + LoggerFactory.getLogger(RepositoryService.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs a new {@link RepositoryService}. This constructor should only * be called from the {@link RepositoryServiceFactory}. @@ -88,6 +99,12 @@ public final class RepositoryService */ public BlameCommandBuilder getBlameCommand() { + if (logger.isDebugEnabled()) + { + logger.debug("create blame command for repository {}", + repository.getName()); + } + return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(), repository); } @@ -101,6 +118,12 @@ public final class RepositoryService */ public BrowseCommandBuilder getBrowseCommand() { + if (logger.isDebugEnabled()) + { + logger.debug("create browse command for repository {}", + repository.getName()); + } + return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(), repository, preProcessorUtil); } @@ -114,6 +137,12 @@ public final class RepositoryService */ public CatCommandBuilder getCatCommand() { + if (logger.isDebugEnabled()) + { + logger.debug("create cat command for repository {}", + repository.getName()); + } + return new CatCommandBuilder(provider.getCatCommand()); } @@ -127,6 +156,12 @@ public final class RepositoryService */ public DiffCommandBuilder getDiffCommand() { + if (logger.isDebugEnabled()) + { + logger.debug("create diff command for repository {}", + repository.getName()); + } + return new DiffCommandBuilder(provider.getDiffCommand()); } @@ -139,6 +174,12 @@ public final class RepositoryService */ public LogCommandBuilder getLogCommand() { + if (logger.isDebugEnabled()) + { + logger.debug("create log command for repository {}", + repository.getName()); + } + return new LogCommandBuilder(cacheManager, provider.getLogCommand(), repository, preProcessorUtil); } diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index 4da2d1d7f3..fd5904b1ec 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -41,6 +41,9 @@ import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.cache.CacheManager; import sonia.scm.repository.PermissionType; import sonia.scm.repository.PermissionUtil; @@ -90,6 +93,14 @@ import java.util.Set; public final class RepositoryServiceFactory { + /** + * the logger for RepositoryServiceFactory + */ + private static final Logger logger = + LoggerFactory.getLogger(RepositoryServiceFactory.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs a new {@link RepositoryServiceFactory}. This constructor * should not be called manually, it should only be used by the injection @@ -223,6 +234,13 @@ public final class RepositoryServiceFactory if (provider != null) { + if (logger.isDebugEnabled()) + { + logger.debug( + "create new repository service for repository {} of type {}", + repository.getName(), repository.getType()); + } + service = new RepositoryService(cacheManager, provider, repository, preProcessorUtil); From 2f461531b1f70c0c9e2410c65055de8884b6ee99 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:27:31 +0200 Subject: [PATCH 076/159] added logging to blame command builder --- .../repository/api/BlameCommandBuilder.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index abd519efe9..9376bc9e24 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -39,6 +39,9 @@ import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BlameResult; @@ -65,6 +68,12 @@ public final class BlameCommandBuilder /** name of the cache */ private static final String CACHE_NAME = "sonia.scm.cache.blame"; + /** + * the logger for BlameCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(BlameCommandBuilder.class); + //~--- constructors --------------------------------------------------------- /** @@ -125,6 +134,11 @@ public final class BlameCommandBuilder if (disableCache) { + if (logger.isDebugEnabled()) + { + logger.debug("create blame for {} with disabled cache", requestClone); + } + result = blameCommand.getBlameResult(requestClone); } else @@ -135,6 +149,11 @@ public final class BlameCommandBuilder if (result == null) { + if (logger.isDebugEnabled()) + { + logger.debug("create blame for {}", requestClone); + } + result = blameCommand.getBlameResult(requestClone); if (result != null) @@ -142,6 +161,10 @@ public final class BlameCommandBuilder cache.put(key, result); } } + else if (logger.isDebugEnabled()) + { + logger.debug("retrive blame from cache for {}", requestClone); + } } return result; From 66887db4476a798bea2aaeb78c1e12dfaa3b7ee1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:27:48 +0200 Subject: [PATCH 077/159] added logging to browse command builder --- .../repository/api/BrowseCommandBuilder.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 6ec29a7264..c46b9a9b8e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -37,6 +37,9 @@ package sonia.scm.repository.api; import com.google.common.base.Objects; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BrowserResult; @@ -64,6 +67,12 @@ public final class BrowseCommandBuilder /** Name of the cache */ private static final String CACHE_NAME = "sonia.scm.cache.browse"; + /** + * the logger for BrowseCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(BrowseCommandBuilder.class); + //~--- constructors --------------------------------------------------------- /** @@ -119,6 +128,12 @@ public final class BrowseCommandBuilder if (disableCache) { + if (logger.isDebugEnabled()) + { + logger.debug("create browser result for {} with disabled cache", + request); + } + result = browseCommand.getBrowserResult(request); } else @@ -127,13 +142,27 @@ public final class BrowseCommandBuilder result = cache.get(key); - if (result != null) + if (result == null) { - cache.put(key, result); + if (logger.isDebugEnabled()) + { + logger.debug("create browser result for {}", request); + } + + result = browseCommand.getBrowserResult(request); + + if (result != null) + { + cache.put(key, result); + } + } + else if (logger.isDebugEnabled()) + { + logger.debug("retrive browser result from cache for {}", request); } } - if (! disablePreProcessors && result != null) + if (!disablePreProcessors && (result != null)) { preProcessorUtil.prepareForReturn(repository, result); } From fea36b5fd8be21f301c41d4741240acb0d7a795f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:28:47 +0200 Subject: [PATCH 078/159] added logging to cat command builder --- .../scm/repository/api/CatCommandBuilder.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java index 7a26592b94..dc98c713a1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java @@ -39,6 +39,9 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.io.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.CatCommand; @@ -59,6 +62,14 @@ import java.io.OutputStream; public final class CatCommandBuilder { + /** + * the logger for CatCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(CatCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs a new {@link CatCommandBuilder}, this constructor should * only be called from the {@link RepositoryService}. @@ -173,6 +184,12 @@ public final class CatCommandBuilder CatCommandRequest requestClone = request.clone(); requestClone.setPath(path); + + if (logger.isDebugEnabled()) + { + logger.debug("create cat for {}", requestClone); + } + catCommand.getCatResult(requestClone, outputStream); } From f7cdf7aa07dbd8531db24ab6fe1adc82c701bd9e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:29:25 +0200 Subject: [PATCH 079/159] added logging to diff command builder --- .../scm/repository/api/DiffCommandBuilder.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java index c277ecb124..35ef6b0359 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java @@ -38,6 +38,9 @@ package sonia.scm.repository.api; import com.google.common.base.Preconditions; import com.google.common.io.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.DiffCommand; import sonia.scm.repository.spi.DiffCommandRequest; @@ -60,6 +63,14 @@ import java.io.OutputStream; public final class DiffCommandBuilder { + /** + * the logger for DiffCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(DiffCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs a new {@link DiffCommandBuilder}, this constructor should * only be called from the {@link RepositoryService}. @@ -173,6 +184,12 @@ public final class DiffCommandBuilder Preconditions.checkNotNull(outputStream, "OutputStream is required"); Preconditions.checkArgument(request.isValid(), "path and/or revision is required"); + + if (logger.isDebugEnabled()) + { + logger.debug("create diff for {}", request); + } + diffCommand.getDiffResult(request, outputStream); } From f992b498a30782b4a5012b235f5d90d2e882a751 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:32:22 +0200 Subject: [PATCH 080/159] added logging to log command builder --- .../scm/repository/api/LogCommandBuilder.java | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index cd9976de9a..ad0ef37d11 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -38,6 +38,9 @@ package sonia.scm.repository.api; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.Changeset; @@ -104,6 +107,12 @@ public final class LogCommandBuilder /** name of the cache */ private static final String CACHE_NAME = "sonia.scm.cache.log"; + /** + * the logger for LogCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(LogCommandBuilder.class); + //~--- constructors --------------------------------------------------------- /** @@ -176,6 +185,11 @@ public final class LogCommandBuilder if (disableCache) { + if (logger.isDebugEnabled()) + { + logger.debug("get changeset for {} with disabled cache", id); + } + changeset = logCommand.getChangeset(id); } else @@ -185,6 +199,11 @@ public final class LogCommandBuilder if (cpr == null) { + if (logger.isDebugEnabled()) + { + logger.debug("get changeset for {}", id); + } + changeset = logCommand.getChangeset(id); if (changeset != null) @@ -195,11 +214,16 @@ public final class LogCommandBuilder } else { + if (logger.isDebugEnabled()) + { + logger.debug("get changeset {} from cache", id); + } + changeset = cpr.iterator().next(); } } - if (! disablePreProcessors && changeset != null) + if (!disablePreProcessors && (changeset != null)) { preProcessorUtil.prepareForReturn(repository, changeset); } @@ -223,6 +247,11 @@ public final class LogCommandBuilder if (disableCache) { + if (logger.isDebugEnabled()) + { + logger.debug("get changesets for {} with disabled cache", request); + } + cpr = logCommand.getChangesets(request); } else @@ -233,6 +262,11 @@ public final class LogCommandBuilder if (cpr == null) { + if (logger.isDebugEnabled()) + { + logger.debug("get changesets for {}", request); + } + cpr = logCommand.getChangesets(request); if (cpr != null) @@ -240,9 +274,13 @@ public final class LogCommandBuilder cache.put(key, cpr); } } + else if (logger.isDebugEnabled()) + { + logger.debug("get changesets from cache for {}", request); + } } - if (! disablePreProcessors && cpr != null) + if (!disablePreProcessors && (cpr != null)) { preProcessorUtil.prepareForReturn(repository, cpr); } @@ -292,8 +330,7 @@ public final class LogCommandBuilder * * @return {@code this} */ - public LogCommandBuilder setDisablePreProcessors( - boolean disablePreProcessors) + public LogCommandBuilder setDisablePreProcessors(boolean disablePreProcessors) { this.disablePreProcessors = disablePreProcessors; From eb41538beb4b995fa7aa1caaf669f7a15e8b71b1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:34:47 +0200 Subject: [PATCH 081/159] added logging to pre processor util --- .../scm/repository/PreProcessorUtil.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java index d697cd5b82..44b13b2294 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java @@ -35,6 +35,9 @@ package sonia.scm.repository; import com.google.inject.Inject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ @@ -49,6 +52,14 @@ import java.util.Set; public class PreProcessorUtil { + /** + * the logger for PreProcessorUtil + */ + private static final Logger logger = + LoggerFactory.getLogger(PreProcessorUtil.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -82,6 +93,12 @@ public class PreProcessorUtil */ public void prepareForReturn(Repository repository, Changeset changeset) { + if (logger.isTraceEnabled()) + { + logger.trace("prepare changeset {} of repository {} for return", + changeset.getId(), repository.getName()); + } + EscapeUtil.escape(changeset); callPreProcessors(changesetPreProcessorSet, changeset); callPreProcessorFactories(changesetPreProcessorFactorySet, repository, @@ -98,6 +115,12 @@ public class PreProcessorUtil */ public void prepareForReturn(Repository repository, BrowserResult result) { + if (logger.isTraceEnabled()) + { + logger.trace("prepare browser result of repository {} for return", + repository.getName()); + } + EscapeUtil.escape(result); callPreProcessors(fileObjectPreProcessorSet, result); callPreProcessorFactories(fileObjectPreProcessorFactorySet, repository, @@ -114,6 +137,12 @@ public class PreProcessorUtil public void prepareForReturn(Repository repository, ChangesetPagingResult result) { + if (logger.isTraceEnabled()) + { + logger.trace("prepare changesets of repository {} for return", + repository.getName()); + } + EscapeUtil.escape(result); callPreProcessors(changesetPreProcessorSet, result); callPreProcessorFactories(changesetPreProcessorFactorySet, repository, From 4a5fd4fb8caa985784a452164f72a7c68339082c Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 12:54:04 +0200 Subject: [PATCH 082/159] added unit test for git get all with paging --- .../scm/repository/spi/GitLogCommandTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 0d8ccaa9ff..5acaca69cc 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -128,6 +128,38 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase assertEquals("86a6645eceefe8b9a247", c2.getId()); } + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetAllWithPaging() throws IOException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingStart(1); + request.setPagingLimit(2); + + ChangesetPagingResult result = + new GitLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(5, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("86a6645eceefe8b9a247", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("3f76a12f08a6ba0dc988", c2.getId()); + } + /** * Method description * From fce97704931b92a47042f4f3897387bb0b6abd11 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 13:11:39 +0200 Subject: [PATCH 083/159] fix bug in paging of svn log command --- .../src/main/java/sonia/scm/repository/spi/SvnLogCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 838d0c90b3..c26ef9eaff 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -206,7 +206,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand int total = changesetList.size(); int start = request.getPagingStart(); - int max = request.getPagingLimit(); + int max = request.getPagingLimit() + start; int end = total - start; if (end > max) From 6567b9319bad59409f4c3b58127f74547742016b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 13:12:14 +0200 Subject: [PATCH 084/159] added unit test for svn log command paging --- .../scm/repository/spi/SvnLogCommandTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java index e632bc1be9..62824c3081 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java @@ -128,6 +128,38 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase assertEquals("4", c2.getId()); } + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetAllWithPaging() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingStart(1); + request.setPagingLimit(2); + + ChangesetPagingResult result = + new SvnLogCommand(repository, repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(6, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("4", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("3", c2.getId()); + } + /** * Method description * From e2889a6fee345ac8c9a67489fed9f355b70266e2 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 13:30:05 +0200 Subject: [PATCH 085/159] fix paging of mercurial log command --- .../src/main/resources/sonia/scm/python/log.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py index 43dc995e39..4db781321b 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/log.py @@ -106,12 +106,15 @@ def collectChangesets(repo, path, startNode, endNode): return ctxs - def stripChangesets(ctxs, start, limit): if limit < 0: - ctxs = ctxs[start] + ctxs = ctxs[start:] else: - ctxs = ctxs[start:limit] + limit = limit + start + if limit > len(ctxs): + ctxs = ctxs[start:] + else: + ctxs = ctxs[start:limit] return ctxs # change log methods From e58025f3b89f8ab67a71c8e50f4aec435c952bcb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 13:30:21 +0200 Subject: [PATCH 086/159] added unit test for mercurial log command paging --- .../scm/repository/spi/HgLogCommandTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java index 90c504bb80..a822d2ad01 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java @@ -102,6 +102,40 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase assertEquals("0:a9bacaf1b7fa", result.getChangesets().get(2).getId()); } + + /** + * Method description + * + * + * @throws IOException + */ + @Test + public void testGetAllWithPaging() throws IOException, RepositoryException + { + LogCommandRequest request = new LogCommandRequest(); + + request.setPagingStart(1); + request.setPagingLimit(2); + + ChangesetPagingResult result = + new HgLogCommand(handler, new HgContext(), repository, + repositoryDirectory).getChangesets(request); + + assertNotNull(result); + assertEquals(5, result.getTotal()); + assertEquals(2, result.getChangesets().size()); + + Changeset c1 = result.getChangesets().get(0); + + assertNotNull(c1); + assertEquals("3:542bf4893dd2", c1.getId()); + + Changeset c2 = result.getChangesets().get(1); + + assertNotNull(c2); + assertEquals("2:79b6baf49711", c2.getId()); + } + /** * Method description * From bf86dc97e791ec8b8b9c0f961ab3f1203fe3e890 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 14:01:56 +0200 Subject: [PATCH 087/159] fix internal not cloneable error --- .../spi/FileBaseCommandRequest.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java index 609ab8d82f..83491a4b22 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java @@ -46,7 +46,8 @@ import java.io.Serializable; * @author Sebastian Sdorra * @since 1.17 */ -public abstract class FileBaseCommandRequest implements Resetable, Serializable +public abstract class FileBaseCommandRequest + implements Resetable, Serializable, Cloneable { /** @@ -164,6 +165,36 @@ public abstract class FileBaseCommandRequest implements Resetable, Serializable return revision; } + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @return + * + * @throws CloneNotSupportedException + */ + @Override + protected FileBaseCommandRequest clone() throws CloneNotSupportedException + { + FileBaseCommandRequest clone = null; + + try + { + clone = (FileBaseCommandRequest) super.clone(); + } + catch (CloneNotSupportedException e) + { + + // this shouldn't happen, since we are Cloneable + throw new InternalError( + "FileBaseCommandRequest seems not to be cloneable"); + } + + return clone; + } + //~--- fields --------------------------------------------------------------- /** Field description */ From c5789e869116564a1f141f9040839f4d3bd77c78 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 14:11:36 +0200 Subject: [PATCH 088/159] fix another svn paging bug --- .../src/main/java/sonia/scm/repository/spi/SvnLogCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index c26ef9eaff..9167c63388 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -207,7 +207,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand int total = changesetList.size(); int start = request.getPagingStart(); int max = request.getPagingLimit() + start; - int end = total - start; + int end = total; if (end > max) { From 8d6d7d1b448a320216d34c3944cee8bbbe2b1930 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 14:12:58 +0200 Subject: [PATCH 089/159] use new repository service api for repository rest resource --- .../resources/BrowserStreamingOutput.java | 17 +- .../rest/resources/DiffStreamingOutput.java | 25 +-- .../rest/resources/RepositoryResource.java | 188 ++++++++++-------- 3 files changed, 120 insertions(+), 110 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/BrowserStreamingOutput.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/BrowserStreamingOutput.java index c9f9f5f680..5b2dcfa50b 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/BrowserStreamingOutput.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/BrowserStreamingOutput.java @@ -39,9 +39,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.repository.PathNotFoundException; -import sonia.scm.repository.RepositoryBrowser; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RevisionNotFoundException; +import sonia.scm.repository.api.CatCommandBuilder; //~--- JDK imports ------------------------------------------------------------ @@ -71,13 +71,13 @@ public class BrowserStreamingOutput implements StreamingOutput * * @param browser * @param revision + * + * @param builder * @param path */ - public BrowserStreamingOutput(RepositoryBrowser browser, String revision, - String path) + public BrowserStreamingOutput(CatCommandBuilder builder, String path) { - this.browser = browser; - this.revision = revision; + this.builder = builder; this.path = path; } @@ -98,7 +98,7 @@ public class BrowserStreamingOutput implements StreamingOutput { try { - browser.getContent(revision, path, output); + builder.retriveContent(output, path); } catch (PathNotFoundException ex) { @@ -130,11 +130,8 @@ public class BrowserStreamingOutput implements StreamingOutput //~--- fields --------------------------------------------------------------- /** Field description */ - private RepositoryBrowser browser; + private CatCommandBuilder builder; /** Field description */ private String path; - - /** Field description */ - private String revision; } diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/DiffStreamingOutput.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/DiffStreamingOutput.java index a8f7c93ef4..ad55889c0d 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/DiffStreamingOutput.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/DiffStreamingOutput.java @@ -38,10 +38,10 @@ package sonia.scm.api.rest.resources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sonia.scm.repository.DiffViewer; import sonia.scm.repository.PathNotFoundException; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RevisionNotFoundException; +import sonia.scm.repository.api.DiffCommandBuilder; //~--- JDK imports ------------------------------------------------------------ @@ -66,19 +66,14 @@ public class DiffStreamingOutput implements StreamingOutput //~--- constructors --------------------------------------------------------- /** - * Constructs ... + * Constructs ... * * - * @param diffViewer - * @param revision - * @param path + * @param builder */ - public DiffStreamingOutput(DiffViewer diffViewer, String revision, - String path) + public DiffStreamingOutput(DiffCommandBuilder builder) { - this.diffViewer = diffViewer; - this.revision = revision; - this.path = path; + this.builder = builder; } //~--- methods -------------------------------------------------------------- @@ -98,7 +93,7 @@ public class DiffStreamingOutput implements StreamingOutput { try { - diffViewer.getDiff(revision, path, output); + builder.retriveContent(output); } catch (PathNotFoundException ex) { @@ -130,11 +125,5 @@ public class DiffStreamingOutput implements StreamingOutput //~--- fields --------------------------------------------------------------- /** Field description */ - private DiffViewer diffViewer; - - /** Field description */ - private String path; - - /** Field description */ - private String revision; + private DiffCommandBuilder builder; } diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java index 8880bc6a70..ca577885a9 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java @@ -35,6 +35,7 @@ package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Strings; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; @@ -45,30 +46,30 @@ import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sonia.scm.NotSupportedFeatuerException; import sonia.scm.config.ScmConfiguration; import sonia.scm.repository.BlameResult; -import sonia.scm.repository.BlameViewerUtil; import sonia.scm.repository.BrowserResult; import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; -import sonia.scm.repository.ChangesetViewerUtil; -import sonia.scm.repository.DiffViewer; import sonia.scm.repository.Permission; import sonia.scm.repository.PermissionType; import sonia.scm.repository.PermissionUtil; import sonia.scm.repository.Repository; -import sonia.scm.repository.RepositoryBrowser; -import sonia.scm.repository.RepositoryBrowserUtil; import sonia.scm.repository.RepositoryException; -import sonia.scm.repository.RepositoryHandler; import sonia.scm.repository.RepositoryIsNotArchivedException; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryNotFoundException; import sonia.scm.repository.RepositoryUtil; +import sonia.scm.repository.api.BlameCommandBuilder; +import sonia.scm.repository.api.BrowseCommandBuilder; +import sonia.scm.repository.api.CatCommandBuilder; +import sonia.scm.repository.api.CommandNotSupportedException; +import sonia.scm.repository.api.DiffCommandBuilder; +import sonia.scm.repository.api.LogCommandBuilder; +import sonia.scm.repository.api.RepositoryService; +import sonia.scm.repository.api.RepositoryServiceFactory; import sonia.scm.security.ScmSecurityException; import sonia.scm.util.AssertUtil; -import sonia.scm.util.HttpUtil; import sonia.scm.util.Util; import sonia.scm.web.security.WebSecurityContext; @@ -125,6 +126,7 @@ public class RepositoryResource * @param configuration * @param repositoryManager * @param securityContextProvider + * @param servicefactory * @param changesetViewerUtil * @param repositoryBrowserUtil * @param blameViewerUtil @@ -133,17 +135,13 @@ public class RepositoryResource public RepositoryResource( ScmConfiguration configuration, RepositoryManager repositoryManager, Provider securityContextProvider, - ChangesetViewerUtil changesetViewerUtil, - RepositoryBrowserUtil repositoryBrowserUtil, - BlameViewerUtil blameViewerUtil) + RepositoryServiceFactory servicefactory) { super(repositoryManager); this.configuration = configuration; this.repositoryManager = repositoryManager; + this.servicefactory = servicefactory; this.securityContextProvider = securityContextProvider; - this.changesetViewerUtil = changesetViewerUtil; - this.repositoryBrowserUtil = repositoryBrowserUtil; - this.blameViewerUtil = blameViewerUtil; setDisableCache(false); } @@ -354,8 +352,15 @@ public class RepositoryResource { AssertUtil.assertIsNotNull(path); - BlameResult blamePagingResult = blameViewerUtil.getBlame(id, revision, - path); + RepositoryService service = servicefactory.create(id); + BlameCommandBuilder builder = service.getBlameCommand(); + + if (!Strings.isNullOrEmpty(revision)) + { + builder.setRevision(revision); + } + + BlameResult blamePagingResult = builder.getBlameResult(path); if (blamePagingResult != null) { @@ -374,7 +379,7 @@ public class RepositoryResource { response = Response.status(Response.Status.NOT_FOUND).build(); } - catch (NotSupportedFeatuerException ex) + catch (CommandNotSupportedException ex) { response = Response.status(Response.Status.BAD_REQUEST).build(); } @@ -416,8 +421,20 @@ public class RepositoryResource try { - BrowserResult result = repositoryBrowserUtil.getResult(id, revision, - path); + RepositoryService service = servicefactory.create(id); + BrowseCommandBuilder builder = service.getBrowseCommand(); + + if (!Strings.isNullOrEmpty(revision)) + { + builder.setRevision(revision); + } + + if (!Strings.isNullOrEmpty(path)) + { + builder.setPath(path); + } + + BrowserResult result = builder.getBrowserResult(); if (result != null) { @@ -432,7 +449,7 @@ public class RepositoryResource { response = Response.status(Response.Status.NOT_FOUND).build(); } - catch (NotSupportedFeatuerException ex) + catch (CommandNotSupportedException ex) { response = Response.status(Response.Status.BAD_REQUEST).build(); } @@ -513,7 +530,8 @@ public class RepositoryResource { try { - Changeset changeset = changesetViewerUtil.getChangeset(id, revision); + RepositoryService service = servicefactory.create(id); + Changeset changeset = service.getLogCommand().getChangeset(revision); if (changeset != null) { @@ -528,7 +546,7 @@ public class RepositoryResource { response = Response.status(Response.Status.NOT_FOUND).build(); } - catch (NotSupportedFeatuerException ex) + catch (CommandNotSupportedException ex) { response = Response.status(Response.Status.BAD_REQUEST).build(); } @@ -585,17 +603,22 @@ public class RepositoryResource try { ChangesetPagingResult changesets = null; + RepositoryService service = servicefactory.create(id); + LogCommandBuilder builder = service.getLogCommand(); - if (Util.isEmpty(path)) + if (!Strings.isNullOrEmpty(path)) { - changesets = changesetViewerUtil.getChangesets(id, start, limit); + builder.setPath(path); } - else + + if (!Strings.isNullOrEmpty(revision)) { - changesets = changesetViewerUtil.getChangesets(id, path, revision, - start, limit); + builder.setStartChangeset(revision); } + changesets = + builder.setPagingStart(start).setPagingLimit(limit).getChangesets(); + if (changesets != null) { response = Response.ok(changesets).build(); @@ -609,7 +632,7 @@ public class RepositoryResource { response = Response.status(Response.Status.NOT_FOUND).build(); } - catch (NotSupportedFeatuerException ex) + catch (CommandNotSupportedException ex) { response = Response.status(Response.Status.BAD_REQUEST).build(); } @@ -645,37 +668,37 @@ public class RepositoryResource { Response response = null; StreamingOutput output = null; - Repository repository = repositoryManager.get(id); - if (repository != null) + try { - try + RepositoryService service = servicefactory.create(id); + CatCommandBuilder builder = service.getCatCommand(); + + if (!Strings.isNullOrEmpty(revision)) { - RepositoryBrowser browser = - repositoryManager.getRepositoryBrowser(repository); - - if (browser != null) - { - output = new BrowserStreamingOutput(browser, revision, path); - - String contentDispositionName = - getContentDispositionNameFromPath(path); - - response = Response.ok(output).header("Content-Disposition", - contentDispositionName).build(); - } - else if (logger.isWarnEnabled()) - { - logger.warn("could not find repository browser for respository {}", - repository.getId()); - response = Response.status(Response.Status.NOT_FOUND).build(); - } - } - catch (Exception ex) - { - logger.error("could not retrive content", ex); - response = createErrorResonse(ex); + builder.setRevision(revision); } + + output = new BrowserStreamingOutput(builder, path); + + String contentDispositionName = getContentDispositionNameFromPath(path); + + response = Response.ok(output).header("Content-Disposition", + contentDispositionName).build(); + } + catch (RepositoryNotFoundException ex) + { + logger.warn("could not find repository browser for respository {}", id); + response = Response.status(Response.Status.NOT_FOUND).build(); + } + catch (CommandNotSupportedException ex) + { + response = Response.status(Response.Status.BAD_REQUEST).build(); + } + catch (Exception ex) + { + logger.error("could not retrive content", ex); + response = createErrorResonse(ex); } return response; @@ -718,32 +741,39 @@ public class RepositoryResource try { - Repository repository = repositoryManager.get(id); + RepositoryService service = servicefactory.create(id); + DiffCommandBuilder builder = service.getDiffCommand(); - if (repository != null) + if (!Strings.isNullOrEmpty(revision)) { - DiffViewer diffViewer = repositoryManager.getDiffViewer(repository); - - if (diffViewer != null) - { - String name = - repository.getName().concat("-").concat(revision).concat(".diff"); - String contentDispositionName = getContentDispositionName(name); - - response = Response.ok(new DiffStreamingOutput(diffViewer, revision, - path)).header("Content-Disposition", - contentDispositionName).build(); - } - else - { - response = Response.status(Response.Status.NOT_FOUND).build(); - } + builder.setRevision(revision); } + + if (!Strings.isNullOrEmpty(path)) + { + builder.setPath(path); + } + + String name = service.getRepository().getName().concat("-").concat( + revision).concat(".diff"); + String contentDispositionName = getContentDispositionName(name); + + response = Response.ok(new DiffStreamingOutput(builder)).header( + "Content-Disposition", contentDispositionName).build(); } catch (RepositoryNotFoundException ex) { response = Response.status(Response.Status.NOT_FOUND).build(); } + catch (CommandNotSupportedException ex) + { + response = Response.status(Response.Status.BAD_REQUEST).build(); + } + catch (Exception ex) + { + logger.error("could not create diff", ex); + response = createErrorResonse(ex); + } return response; } @@ -909,21 +939,15 @@ public class RepositoryResource //~--- fields --------------------------------------------------------------- - /** Field description */ - private BlameViewerUtil blameViewerUtil; - - /** Field description */ - private ChangesetViewerUtil changesetViewerUtil; - /** Field description */ private ScmConfiguration configuration; - /** Field description */ - private RepositoryBrowserUtil repositoryBrowserUtil; - /** Field description */ private RepositoryManager repositoryManager; /** Field description */ private Provider securityContextProvider; + + /** Field description */ + private RepositoryServiceFactory servicefactory; } From 74de3b81ebf8c8ad8cdb835d455dce2f1f548e75 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 14:16:57 +0200 Subject: [PATCH 090/159] fix npe in url http client --- scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java index 5f62f20e49..c2a38223d5 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java +++ b/scm-webapp/src/main/java/sonia/scm/net/URLHttpClient.java @@ -531,6 +531,12 @@ public class URLHttpClient implements HttpClient private HttpURLConnection openConnection(HttpRequest request, URL url) throws IOException { + if (request == null) + { + // TODO improve + request = new HttpRequest(url.toExternalForm()); + } + HttpURLConnection connection = null; if (!request.isIgnoreProxySettings() && configuration.isEnableProxy()) From c7109fe3803e24058fbb5e7afc39da6a5b5d1a7e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 17:30:47 +0200 Subject: [PATCH 091/159] fix abstract method error of plugins which are using a version before 1.17-SNAPSHOT --- .../scm/repository/ChangesetPreProcessor.java | 6 +- .../ChangesetPreProcessorFactory.java | 3 +- .../repository/FileObjectPreProcessor.java | 6 +- .../FileObjectPreProcessorFactory.java | 3 +- .../scm/repository/PreProcessorUtil.java | 487 ++++++++++++++---- 5 files changed, 399 insertions(+), 106 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java index 43cddee19e..26930abcc3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java @@ -38,11 +38,12 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** - * + * TODO for 2.0 extends {@link PreProcessor} interface. + * * @author Sebastian Sdorra */ @ExtensionPoint -public interface ChangesetPreProcessor extends PreProcessor +public interface ChangesetPreProcessor { /** @@ -51,6 +52,5 @@ public interface ChangesetPreProcessor extends PreProcessor * * @param changeset */ - @Override public void process(Changeset changeset); } diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java index d9c209a4ab..7805be8854 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java @@ -38,13 +38,13 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * TODO for 2.0 extends {@link PreProcessorFactory} interface. * * @author Sebastian Sdorra * @since 1.7 */ @ExtensionPoint public interface ChangesetPreProcessorFactory - extends PreProcessorFactory { /** @@ -55,6 +55,5 @@ public interface ChangesetPreProcessorFactory * * @return */ - @Override public ChangesetPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java index 3170672ee9..175020bf6c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java @@ -38,12 +38,13 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** - * + * TODO for 2.0 extends {@link PreProcessor} interface. + * * @author Sebastian Sdorra * @since 1.10 */ @ExtensionPoint -public interface FileObjectPreProcessor extends PreProcessor +public interface FileObjectPreProcessor { /** @@ -52,6 +53,5 @@ public interface FileObjectPreProcessor extends PreProcessor * * @param fileObject */ - @Override public void process(FileObject fileObject); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java index 5584593d7a..0875a092c6 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java @@ -38,13 +38,13 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * TODO for 2.0 extends {@link PreProcessorFactory} interface. * * @author Sebastian Sdorra * @since 1.10 */ @ExtensionPoint public interface FileObjectPreProcessorFactory - extends PreProcessorFactory { /** @@ -55,6 +55,5 @@ public interface FileObjectPreProcessorFactory * * @return */ - @Override public FileObjectPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java index 44b13b2294..f9251e8f38 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java @@ -33,6 +33,8 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Function; +import com.google.common.collect.Collections2; import com.google.inject.Inject; import org.slf4j.Logger; @@ -42,6 +44,7 @@ import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ +import java.util.Collection; import java.util.Set; /** @@ -76,10 +79,52 @@ public class PreProcessorUtil Set fileObjectPreProcessorSet, Set fileObjectPreProcessorFactorySet) { - this.changesetPreProcessorSet = changesetPreProcessorSet; - this.changesetPreProcessorFactorySet = changesetPreProcessorFactorySet; - this.fileObjectPreProcessorSet = fileObjectPreProcessorSet; - this.fileObjectPreProcessorFactorySet = fileObjectPreProcessorFactorySet; + this.changesetPreProcessorSet = + Collections2.transform(changesetPreProcessorSet, + new Function() + { + @Override + public ChangesetPreProcessorWrapper apply(ChangesetPreProcessor input) + { + return new ChangesetPreProcessorWrapper(input); + } + }); + this.changesetPreProcessorFactorySet = + Collections2.transform(changesetPreProcessorFactorySet, + new Function() + { + @Override + public ChangesetPreProcessorFactoryWrapper apply( + ChangesetPreProcessorFactory input) + { + return new ChangesetPreProcessorFactoryWrapper(input); + } + }); + this.fileObjectPreProcessorSet = + Collections2.transform(fileObjectPreProcessorSet, + new Function() + { + @Override + public FileObjectPreProcessorWrapper apply(FileObjectPreProcessor input) + { + return new FileObjectPreProcessorWrapper(input); + } + }); + this.fileObjectPreProcessorFactorySet = + Collections2.transform(fileObjectPreProcessorFactorySet, + new Function() + { + @Override + public FileObjectPreProcessorFactoryWrapper apply( + FileObjectPreProcessorFactory input) + { + return new FileObjectPreProcessorFactoryWrapper(input); + } + }); } //~--- methods -------------------------------------------------------------- @@ -100,9 +145,13 @@ public class PreProcessorUtil } EscapeUtil.escape(changeset); - callPreProcessors(changesetPreProcessorSet, changeset); - callPreProcessorFactories(changesetPreProcessorFactorySet, repository, - changeset); + + PreProcessorHandler handler = + new PreProcessorHandler(changesetPreProcessorFactorySet, + changesetPreProcessorSet, repository); + + handler.callPreProcessors(changeset); + handler.callPreProcessorFactories(changeset); } /** @@ -122,9 +171,13 @@ public class PreProcessorUtil } EscapeUtil.escape(result); - callPreProcessors(fileObjectPreProcessorSet, result); - callPreProcessorFactories(fileObjectPreProcessorFactorySet, repository, - result); + + PreProcessorHandler handler = + new PreProcessorHandler(fileObjectPreProcessorFactorySet, + fileObjectPreProcessorSet, repository); + + handler.callPreProcessors(result); + handler.callPreProcessorFactories(result); } /** @@ -144,127 +197,369 @@ public class PreProcessorUtil } EscapeUtil.escape(result); - callPreProcessors(changesetPreProcessorSet, result); - callPreProcessorFactories(changesetPreProcessorFactorySet, repository, - result); + + PreProcessorHandler handler = + new PreProcessorHandler(changesetPreProcessorFactorySet, + changesetPreProcessorSet, repository); + + handler.callPreProcessors(result); + handler.callPreProcessorFactories(result); } - /** - * Method description - * - * - * - * - * @param preProcessorFactorySet - * @param repository - * @param changesets - * @param items - * @param - */ - private void callPreProcessorFactories( - Set> preProcessorFactorySet, - Repository repository, Iterable items) - { - if (Util.isNotEmpty(preProcessorFactorySet)) - { - for (PreProcessorFactory factory : preProcessorFactorySet) - { - PreProcessor preProcessor = factory.createPreProcessor(repository); + //~--- inner classes -------------------------------------------------------- - if (preProcessor != null) + /** + * Class description + * + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class ChangesetPreProcessorFactoryWrapper + implements PreProcessorFactory + { + + /** + * Constructs ... + * + * + * @param preProcessorFactory + */ + public ChangesetPreProcessorFactoryWrapper( + ChangesetPreProcessorFactory preProcessorFactory) + { + this.preProcessorFactory = preProcessorFactory; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public PreProcessor createPreProcessor(Repository repository) + { + PreProcessor preProcessor = null; + ChangesetPreProcessor changesetPreProcessor = + preProcessorFactory.createPreProcessor(repository); + + if (changesetPreProcessor != null) + { + preProcessor = new ChangesetPreProcessorWrapper(changesetPreProcessor); + } + + return preProcessor; + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private ChangesetPreProcessorFactory preProcessorFactory; + } + + + /** + * Class description + * + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class ChangesetPreProcessorWrapper + implements PreProcessor + { + + /** + * Constructs ... + * + * + * @param preProcessor + */ + public ChangesetPreProcessorWrapper(ChangesetPreProcessor preProcessor) + { + this.preProcessor = preProcessor; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param item + */ + @Override + public void process(Changeset item) + { + preProcessor.process(item); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private ChangesetPreProcessor preProcessor; + } + + + /** + * Class description + * + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class FileObjectPreProcessorFactoryWrapper + implements PreProcessorFactory + { + + /** + * Constructs ... + * + * + * @param preProcessorFactory + */ + public FileObjectPreProcessorFactoryWrapper( + FileObjectPreProcessorFactory preProcessorFactory) + { + this.preProcessorFactory = preProcessorFactory; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public PreProcessor createPreProcessor(Repository repository) + { + PreProcessor preProcessor = null; + FileObjectPreProcessor fileObjectPreProcessor = + preProcessorFactory.createPreProcessor(repository); + + if (fileObjectPreProcessor != null) + { + preProcessor = + new FileObjectPreProcessorWrapper(fileObjectPreProcessor); + } + + return preProcessor; + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private FileObjectPreProcessorFactory preProcessorFactory; + } + + + /** + * Class description + * + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class FileObjectPreProcessorWrapper + implements PreProcessor + { + + /** + * Constructs ... + * + * + * @param preProcessor + */ + public FileObjectPreProcessorWrapper(FileObjectPreProcessor preProcessor) + { + this.preProcessor = preProcessor; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param item + */ + @Override + public void process(FileObject item) + { + preProcessor.process(item); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private FileObjectPreProcessor preProcessor; + } + + + /** + * Class description + * + * + * @param + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class PreProcessorHandler + { + + /** + * Constructs ... + * + * + * @param preProcessorFactorySet + * @param preProcessorSet + * @param repository + */ + public PreProcessorHandler( + Collection> preProcessorFactorySet, + Collection> preProcessorSet, + Repository repository) + { + this.preProcessorFactorySet = preProcessorFactorySet; + this.preProcessorSet = preProcessorSet; + this.repository = repository; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * + * + * @param preProcessorFactorySet + * @param repository + * @param changesets + * @param items + * @param + */ + public void callPreProcessorFactories(Iterable items) + { + if (Util.isNotEmpty(preProcessorFactorySet)) + { + for (PreProcessorFactory factory : preProcessorFactorySet) { - for (T item : items) + PreProcessor preProcessor = factory.createPreProcessor(repository); + + if (preProcessor != null) { - preProcessor.process(item); + for (T item : items) + { + preProcessor.process(item); + } } } } } - } - /** - * Method description - * - * - * - * @param preProcessorFactorySet - * @param repository - * @param item - * @param - */ - private void callPreProcessorFactories( - Set> preProcessorFactorySet, - Repository repository, T item) - { - if (Util.isNotEmpty(preProcessorFactorySet)) + /** + * Method description + * + * + * + * @param preProcessorFactorySet + * @param repository + * @param item + * @param + */ + public void callPreProcessorFactories(T item) { - for (PreProcessorFactory factory : preProcessorFactorySet) + if (Util.isNotEmpty(preProcessorFactorySet)) { - PreProcessor cpp = factory.createPreProcessor(repository); - - if (cpp != null) + for (PreProcessorFactory factory : preProcessorFactorySet) { - cpp.process(item); + PreProcessor cpp = factory.createPreProcessor(repository); + + if (cpp != null) + { + cpp.process(item); + } } } } - } - /** - * Method description - * - * - * @param changesets - * - * @param preProcessorSet - * @param items - * @param - */ - private void callPreProcessors( - Set> preProcessorSet, Iterable items) - { - if (Util.isNotEmpty(preProcessorSet)) + /** + * Method description + * + * + * @param changesets + * + * @param preProcessorSet + * @param items + * @param + */ + public void callPreProcessors(Iterable items) { - for (T item : items) + if (Util.isNotEmpty(preProcessorSet)) { - callPreProcessors(preProcessorSet, item); + for (T item : items) + { + callPreProcessors(item); + } } } - } - /** - * Method description - * - * - * @param c - * - * @param preProcessorSet - * @param item - * @param - */ - private void callPreProcessors( - Set> preProcessorSet, T item) - { - if (Util.isNotEmpty(preProcessorSet)) + /** + * Method description + * + * + * @param c + * + * @param preProcessorSet + * @param item + * @param + */ + public void callPreProcessors(T item) { - for (PreProcessor preProcessor : preProcessorSet) + if (Util.isNotEmpty(preProcessorSet)) { - preProcessor.process(item); + for (PreProcessor preProcessor : preProcessorSet) + { + preProcessor.process(item); + } } } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private Collection> preProcessorFactorySet; + + /** Field description */ + private Collection> preProcessorSet; + + /** Field description */ + private Repository repository; } + //~--- fields --------------------------------------------------------------- /** Field description */ - private Set changesetPreProcessorFactorySet; + private Collection changesetPreProcessorFactorySet; /** Field description */ - private Set changesetPreProcessorSet; + private Collection changesetPreProcessorSet; /** Field description */ - private Set fileObjectPreProcessorFactorySet; + private Collection fileObjectPreProcessorFactorySet; /** Field description */ - private Set fileObjectPreProcessorSet; + private Collection fileObjectPreProcessorSet; } From 3c8a999b0ad3dc0a4df59ba7a40155b3adb66888 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 16 Jun 2012 17:58:27 +0200 Subject: [PATCH 092/159] clear caches after received changes --- .../repository/api/BlameCommandBuilder.java | 17 ++- .../repository/api/BrowseCommandBuilder.java | 17 ++- .../scm/repository/api/LogCommandBuilder.java | 17 ++- .../api/RepositoryServiceFactory.java | 113 ++++++++++++++++++ 4 files changed, 158 insertions(+), 6 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index 9376bc9e24..868cd2e6b4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -66,7 +66,7 @@ public final class BlameCommandBuilder { /** name of the cache */ - private static final String CACHE_NAME = "sonia.scm.cache.blame"; + static final String CACHE_NAME = "sonia.scm.cache.blame"; /** * the logger for BlameCommandBuilder @@ -213,7 +213,7 @@ public final class BlameCommandBuilder * @version Enter version here..., 12/06/05 * @author Enter your name here... */ - private static class CacheKey implements Serializable + static class CacheKey implements Serializable { /** @@ -270,6 +270,19 @@ public final class BlameCommandBuilder return Objects.hashCode(repositoryId, request); } + //~--- get methods -------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + String getRepositoryId() + { + return repositoryId; + } + //~--- fields ------------------------------------------------------------- /** Field description */ diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index c46b9a9b8e..a4df503d27 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -65,7 +65,7 @@ public final class BrowseCommandBuilder { /** Name of the cache */ - private static final String CACHE_NAME = "sonia.scm.cache.browse"; + static final String CACHE_NAME = "sonia.scm.cache.browse"; /** * the logger for BrowseCommandBuilder @@ -243,7 +243,7 @@ public final class BrowseCommandBuilder * @version Enter version here..., 12/06/05 * @author Enter your name here... */ - private static class CacheKey implements Serializable + static class CacheKey implements Serializable { /** @@ -300,6 +300,19 @@ public final class BrowseCommandBuilder return Objects.hashCode(repositoryId, request); } + //~--- get methods -------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + String getRepositoryId() + { + return repositoryId; + } + //~--- fields ------------------------------------------------------------- /** Field description */ diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index ad0ef37d11..a04570002b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -105,7 +105,7 @@ public final class LogCommandBuilder { /** name of the cache */ - private static final String CACHE_NAME = "sonia.scm.cache.log"; + static final String CACHE_NAME = "sonia.scm.cache.log"; /** * the logger for LogCommandBuilder @@ -423,7 +423,7 @@ public final class LogCommandBuilder * @version Enter version here..., 12/06/05 * @author Enter your name here... */ - private static class CacheKey implements Serializable + static class CacheKey implements Serializable { /** @@ -495,6 +495,19 @@ public final class LogCommandBuilder return Objects.hashCode(repositoryId, changesetId, request); } + //~--- get methods -------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + String getRepositoryId() + { + return repositoryId; + } + //~--- fields ------------------------------------------------------------- /** Field description */ diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index fd5904b1ec..7e5bdf2f86 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -44,11 +44,18 @@ import com.google.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import sonia.scm.Filter; +import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; +import sonia.scm.repository.BlameResult; +import sonia.scm.repository.BrowserResult; +import sonia.scm.repository.ChangesetPagingResult; import sonia.scm.repository.PermissionType; import sonia.scm.repository.PermissionUtil; +import sonia.scm.repository.PostReceiveRepositoryHook; import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryHookEvent; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryNotFoundException; import sonia.scm.repository.spi.RepositoryServiceProvider; @@ -124,6 +131,7 @@ public final class RepositoryServiceFactory this.securityContextProvider = securityContextProvider; this.resolvers = resolvers; this.preProcessorUtil = preProcessorUtil; + repositoryManager.addHook(new CacheClearHook(cacheManager)); } //~--- methods -------------------------------------------------------------- @@ -256,6 +264,111 @@ public final class RepositoryServiceFactory return service; } + //~--- inner classes -------------------------------------------------------- + + /** + * TODO find a more elegant way + * + * + * @version Enter version here..., 12/06/16 + * @author Enter your name here... + */ + private static class CacheClearHook extends PostReceiveRepositoryHook + { + + /** + * Constructs ... + * + * + * @param cacheManager + */ + public CacheClearHook(CacheManager cacheManager) + { + this.blameCache = + cacheManager.getCache(BlameCommandBuilder.CacheKey.class, + BlameResult.class, + BlameCommandBuilder.CACHE_NAME); + this.browseCache = + cacheManager.getCache(BrowseCommandBuilder.CacheKey.class, + BrowserResult.class, + BrowseCommandBuilder.CACHE_NAME); + this.logCache = cacheManager.getCache(LogCommandBuilder.CacheKey.class, + ChangesetPagingResult.class, LogCommandBuilder.CACHE_NAME); + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param event + */ + @Override + public void onEvent(RepositoryHookEvent event) + { + Repository repository = event.getRepository(); + + if (repository != null) + { + String id = repository.getId(); + + clearCaches(id); + } + } + + /** + * Method description + * + * + * @param repositoryId + */ + private void clearCaches(final String repositoryId) + { + if (logger.isDebugEnabled()) + { + logger.debug("clear caches for repository id {}", repositoryId); + } + + blameCache.removeAll(new Filter() + { + @Override + public boolean accept(BlameCommandBuilder.CacheKey item) + { + return repositoryId.equals(item.getRepositoryId()); + } + }); + browseCache.removeAll(new Filter() + { + @Override + public boolean accept(BrowseCommandBuilder.CacheKey item) + { + return repositoryId.equals(item.getRepositoryId()); + } + }); + logCache.removeAll(new Filter() + { + @Override + public boolean accept(LogCommandBuilder.CacheKey item) + { + return repositoryId.equals(item.getRepositoryId()); + } + }); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private Cache blameCache; + + /** Field description */ + private Cache browseCache; + + /** Field description */ + private Cache logCache; + } + + //~--- fields --------------------------------------------------------------- /** Field description */ From 234f61a822a277374d8463547e49f1ac01ff4012 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 20 Jun 2012 08:08:46 +0200 Subject: [PATCH 093/159] update slf4j to version 1.6.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8138550468..e756235770 100644 --- a/pom.xml +++ b/pom.xml @@ -390,7 +390,7 @@ 4.10 - 1.6.5 + 1.6.6 1.0.4 2.5 From cc4cb80e105bb1abb0c95ad45d79b84f339377ab Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 20 Jun 2012 08:10:17 +0200 Subject: [PATCH 094/159] update logback to version 1.0.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e756235770..df3a4daa24 100644 --- a/pom.xml +++ b/pom.xml @@ -391,7 +391,7 @@ 1.6.6 - 1.0.4 + 1.0.6 2.5 3.0 From e6d4f081a20b1b82cfa521582efc3e39b2388238 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 20 Jun 2012 08:31:54 +0200 Subject: [PATCH 095/159] close branch issue-156 From e3fff09c76810db982739eee599588a42bf575bb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 21 Jun 2012 15:31:13 +0200 Subject: [PATCH 096/159] added close method to repository service --- .../scm/repository/api/RepositoryService.java | 45 ++++++++++++++++++- .../spi/RepositoryServiceProvider.java | 24 +++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 8c824a1f5f..0d72f7c908 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -43,6 +43,11 @@ import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.spi.RepositoryServiceProvider; +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Closeable; +import java.io.IOException; + /** * From the {@link RepositoryService} it is possible to access all commands for * a single {@link Repository}. The {@link RepositoryService} is only access @@ -53,12 +58,17 @@ import sonia.scm.repository.spi.RepositoryServiceProvider; * the command is not supported the method will trow a * {@link CommandNotSupportedException}. It is possible to check if the command * is supported by the {@link RepositoryService} with the - * {@link RepositoryService#isSupported(Command)} method. + * {@link RepositoryService#isSupported(Command)} method.
+ *
+ * + * Warning: You should always close the connection to the repository + * after work is finished. For closing the connection to the repository use the + * {@link #close()} method. * * @author Sebastian Sdorra * @since 1.17 */ -public final class RepositoryService +public final class RepositoryService implements Closeable { /** @@ -88,6 +98,37 @@ public final class RepositoryService this.preProcessorUtil = preProcessorUtil; } + //~--- methods -------------------------------------------------------------- + + /** + * Closes the connection to the repository and releases all locks + * and resources. This method should be called in a finally block e.g.: + * + *

+   * RepositoryService service = null;
+   * try {
+   *   service = factory.create("repositoryId");
+   *   // do something with the service
+   * } finally {
+   *   if ( service != null ){
+   *     service.close();
+   *   }
+   * }
+   * 
+ */ + @Override + public void close() + { + try + { + provider.close(); + } + catch (IOException ex) + { + logger.error("cound not close repository service provider", ex); + } + } + //~--- get methods ---------------------------------------------------------- /** diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java index 6944c50e29..8fbc820d04 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java @@ -40,6 +40,9 @@ import sonia.scm.repository.api.CommandNotSupportedException; //~--- JDK imports ------------------------------------------------------------ +import java.io.Closeable; +import java.io.IOException; + import java.util.Set; /** @@ -47,7 +50,7 @@ import java.util.Set; * @author Sebastian Sdorra * @since 1.17 */ -public abstract class RepositoryServiceProvider +public abstract class RepositoryServiceProvider implements Closeable { /** @@ -58,6 +61,25 @@ public abstract class RepositoryServiceProvider */ public abstract Set getSupportedCommands(); + //~--- methods -------------------------------------------------------------- + + /** + * The default implementation of this method does nothing. If you need to + * free resources, close connections or release locks than you have to + * override this method. + * + * + * @throws IOException + */ + @Override + public void close() throws IOException + { + + // should be implmentented from a service provider + } + + //~--- get methods ---------------------------------------------------------- + /** * Method description * From afbbcfc75dbd1cc3515912ec9fed9def567d466f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 21 Jun 2012 16:06:35 +0200 Subject: [PATCH 097/159] improve javadoc of repository api --- .../repository/api/BlameCommandBuilder.java | 17 +++++++++++++++- .../repository/api/BrowseCommandBuilder.java | 16 ++++++++++++++- .../scm/repository/api/CatCommandBuilder.java | 12 ++++++++++- .../repository/api/DiffCommandBuilder.java | 14 ++++++++++++- .../scm/repository/api/LogCommandBuilder.java | 20 ++++--------------- .../api/RepositoryServiceFactory.java | 13 ++++++++++-- 6 files changed, 70 insertions(+), 22 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index 868cd2e6b4..ce04f58053 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -57,7 +57,22 @@ import java.io.Serializable; /** * Shows changeset information by line for a given file. - * Blame is also known as annotate in some SCM systems. + * Blame is also known as annotate in some SCM systems.
+ *
+ * Sample: + *
+ *
+ * Print each line number and code of the file scm-core/pom.xml at + * revision 60c2f2783368:
+ *

+ * BlameCommandBuilder blame = repositoryService.getBlameCommand();
+ * BlameResult result = blame.setRevision("60c2f2783368")
+ *                           .getBlameResult("scm-core/pom.xml");
+ * 
+ * for ( BlameLine line : result ){
+ *   System.out.println(line.getLineNumber() + ": " + line.getCode());
+ * }
+ * 
* * @author Sebastian Sdorra * @since 1.17 diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index a4df503d27..d571fd6a71 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -56,7 +56,21 @@ import java.io.Serializable; /** * BrowseCommandBuilder is able to browse the files of a {@link Repository}. - * + *

+ * Sample: + *
+ *
+ * Print all paths from folder scm-core at revision 11aeec7db845:
+ *

+ * BrowseCommandBuilder browse = repositoryService.getBrowseCommand();
+ * BrowserResult result = browse.setPath("scm-core")
+ *                              .setRevision("11aeec7db845")
+ *                              .getBrowserResult();
+ * 
+ * for ( FileObject fo : result ){
+ *   System.out.println( fo.getPath() );
+ * }
+ * 
* * @author Sebastian Sdorra * @since 1.17 diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java index dc98c713a1..546da6c167 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java @@ -54,7 +54,17 @@ import java.io.IOException; import java.io.OutputStream; /** - * Shows the content of a file in the {@link Repository}. + * Shows the content of a file in the {@link Repository}.
+ *
+ * Sample: + *
+ *
+ * Print the content of the file core/pom.xml from revision 46a23689ac91:
+ *

+ * CatCommandBuilder cat = repositoryService.getCatCommand();
+ * String content = cat.setRevision("46a23689ac91").getContent("core/pom.xml");
+ * System.out.println(content);
+ * 
* * @author Sebastian Sdorra * @since 1.17 diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java index 35ef6b0359..072a56b927 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java @@ -54,7 +54,19 @@ import java.io.OutputStream; /** * Shows differences between revisions for a specified file or * the entire revision.
- * Note: One of the parameter path or revision have to be set. + * Note: One of the parameter path or revision have to be set.
+ *
+ * Sample: + *
+ *
+ * Print the differences from revision 33b93c443867:
+ *

+ * DiffCommandBuilder diff = repositoryService.getDiffCommand();
+ * String content = diff.setRevision("33b93c443867").getContent();
+ * System.out.println(content);
+ * 
+ * + * * TODO check current behavior. * * @author Sebastian Sdorra diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index a04570002b..fc914d321c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -63,35 +63,23 @@ import java.io.Serializable; * or to get a list of changesets in a {@link ChangesetPagingResult} * which can be used for paging.
*
- * Samples: + * Samples: *
*
- * Get a instance of LogCommandBuilder: - *

- * public class Sample {
- *
- *   {@literal @}Inject
- *   public Sample(RepositoryServiceFactory factory){
- *     LogCommandBuilder log = factory.create("repository-id").getLogCommand();
- *   }
- *
- * }
- * 
- * - * Retrieve a single {@link Changeset}: + * Retrieve a single {@link Changeset}:
*

  * LogCommand log = repositoryService.getLogCommand();
  * Changeset changeset = log.getChangeset("id-of-the-commit");
  * 
* - * Retrieve changesets of a {@link Repository} with paging: + * Retrieve changesets of a {@link Repository} with paging:
*

  * LogCommand log = repositoryService.getLogCommand();
  * ChangesetPagingResult changesetPagingResult =
  *          log.setPagingStart(25).setPagingLimit(25).getChangesets();
  * 
* - * Retrieve all changesets of a file in a {@link Repository}: + * Retrieve all changesets of a file in a {@link Repository}:
*

  * LogCommand log = repositoryService.getLogCommand();
  * ChangesetPagingResult changesetPagingResult =
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
index 7e5bdf2f86..78775e678a 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
@@ -86,8 +86,17 @@ import java.util.Set;
  *   }
  *
  *   public Changeset getChangeset(String repositoryId, String commitId){
- *     RepositoryService service = factory.create(repositoryId);
- *     return service.getLogCommand().getChangeset(commitId);
+ *     Changeset changeset = null;
+ *     RepositoryService service = null;
+ *     try {
+ *       service = factory.create(repositoryId);
+ *       changeset = service.getLogCommand().getChangeset(commitId);
+ *     } finally {
+ *       if ( service != null ){
+ *         service.close();
+ *       }
+ *     }
+ *     return changeset;
  *   }
  *
  * }

From 13c6eb978cfffa8b50ec96250e91afe66d1aac77 Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Thu, 21 Jun 2012 19:56:35 +0200
Subject: [PATCH 098/159] improve performance of git repository api

---
 .../repository/spi/AbstractGitCommand.java    |  17 ++-
 .../scm/repository/spi/GitBlameCommand.java   | 115 ++++++++---------
 .../scm/repository/spi/GitBrowseCommand.java  |  81 ++++++------
 .../scm/repository/spi/GitCatCommand.java     |  22 ++--
 .../sonia/scm/repository/spi/GitContext.java  | 121 ++++++++++++++++++
 .../scm/repository/spi/GitDiffCommand.java    |  13 +-
 .../scm/repository/spi/GitLogCommand.java     |  12 +-
 .../spi/GitRepositoryServiceProvider.java     |  32 +++--
 .../spi/AbstractGitCommandTestBase.java       |  37 ++++++
 .../repository/spi/GitBlameCommandTest.java   |  17 ++-
 .../repository/spi/GitBrowseCommandTest.java  |  20 ++-
 .../scm/repository/spi/GitCatCommandTest.java |   2 +-
 .../scm/repository/spi/GitLogCommandTest.java |  31 +++--
 13 files changed, 345 insertions(+), 175 deletions(-)
 create mode 100644 scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java

diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java
index ced9de8909..a788f1f8b0 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java
@@ -35,11 +35,8 @@ package sonia.scm.repository.spi;
 
 import org.eclipse.jgit.lib.Repository;
 
-import sonia.scm.repository.GitUtil;
-
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 
 /**
@@ -53,14 +50,16 @@ public class AbstractGitCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  protected AbstractGitCommand(sonia.scm.repository.Repository repository,
-                               File repositoryDirectory)
+  protected AbstractGitCommand(GitContext context,
+                               sonia.scm.repository.Repository repository)
   {
     this.repository = repository;
-    this.repositoryDirectory = repositoryDirectory;
+    this.context = context;
   }
 
   //~--- methods --------------------------------------------------------------
@@ -75,14 +74,14 @@ public class AbstractGitCommand
    */
   protected Repository open() throws IOException
   {
-    return GitUtil.open(repositoryDirectory);
+    return context.open();
   }
 
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  protected sonia.scm.repository.Repository repository;
+  protected GitContext context;
 
   /** Field description */
-  protected File repositoryDirectory;
+  protected sonia.scm.repository.Repository repository;
 }
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java
index e210a51d18..f7d84cbedb 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java
@@ -53,7 +53,6 @@ import sonia.scm.repository.RepositoryException;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 
 import java.util.ArrayList;
@@ -78,12 +77,14 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public GitBlameCommand(Repository repository, File repositoryDirectory)
+  public GitBlameCommand(GitContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -111,70 +112,56 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
     Preconditions.checkArgument(!Strings.isNullOrEmpty(request.getPath()),
                                 "path is empty or null");
 
-    org.eclipse.jgit.blame.BlameResult gitBlameResult = null;
-    sonia.scm.repository.BlameResult blameResult = null;
-    org.eclipse.jgit.lib.Repository gr = null;
+    org.eclipse.jgit.lib.Repository gr = open();
+    org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame();
 
-    try
+    blame.setFilePath(request.getPath());
+
+    ObjectId revId = GitUtil.getRevisionId(gr, request.getRevision());
+
+    blame.setStartCommit(revId);
+
+    org.eclipse.jgit.blame.BlameResult gitBlameResult = blame.call();
+
+    if (gitBlameResult == null)
     {
-      gr = open();
-
-      org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame();
-
-      blame.setFilePath(request.getPath());
-
-      ObjectId revId = GitUtil.getRevisionId(gr, request.getRevision());
-
-      blame.setStartCommit(revId);
-      gitBlameResult = blame.call();
-
-      if (gitBlameResult == null)
-      {
-        throw new RepositoryException(
-            "could not create blame result for path ".concat(
-              request.getPath()));
-      }
-
-      List blameLines = new ArrayList();
-      int total = gitBlameResult.getResultContents().size();
-      int i = 0;
-
-      for (; i < total; i++)
-      {
-        RevCommit commit = gitBlameResult.getSourceCommit(i);
-
-        if (commit != null)
-        {
-          PersonIdent author = gitBlameResult.getSourceAuthor(i);
-          BlameLine blameLine = new BlameLine();
-
-          blameLine.setLineNumber(i + 1);
-          blameLine.setAuthor(new Person(author.getName(),
-                                         author.getEmailAddress()));
-          blameLine.setDescription(commit.getShortMessage());
-
-          long when = GitUtil.getCommitTime(commit);
-
-          blameLine.setWhen(when);
-
-          String rev = commit.getId().getName();
-
-          blameLine.setRevision(rev);
-
-          String content = gitBlameResult.getResultContents().getString(i);
-
-          blameLine.setCode(content);
-          blameLines.add(blameLine);
-        }
-      }
-
-      blameResult = new sonia.scm.repository.BlameResult(i, blameLines);
-    }
-    finally
-    {
-      GitUtil.close(gr);
+      throw new RepositoryException(
+          "could not create blame result for path ".concat(request.getPath()));
     }
 
-    return blameResult;
+    List blameLines = new ArrayList();
+    int total = gitBlameResult.getResultContents().size();
+    int i = 0;
+
+    for (; i < total; i++)
+    {
+      RevCommit commit = gitBlameResult.getSourceCommit(i);
+
+      if (commit != null)
+      {
+        PersonIdent author = gitBlameResult.getSourceAuthor(i);
+        BlameLine blameLine = new BlameLine();
+
+        blameLine.setLineNumber(i + 1);
+        blameLine.setAuthor(new Person(author.getName(),
+                                       author.getEmailAddress()));
+        blameLine.setDescription(commit.getShortMessage());
+
+        long when = GitUtil.getCommitTime(commit);
+
+        blameLine.setWhen(when);
+
+        String rev = commit.getId().getName();
+
+        blameLine.setRevision(rev);
+
+        String content = gitBlameResult.getResultContents().getString(i);
+
+        blameLine.setCode(content);
+        blameLines.add(blameLine);
+      }
+    }
+
+    return new sonia.scm.repository.BlameResult(i, blameLines);
   }
 }
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java
index 0663eb6067..b6799f0612 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java
@@ -61,7 +61,6 @@ import sonia.scm.util.Util;
 //~--- JDK imports ------------------------------------------------------------
 
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
 
 import java.util.ArrayList;
@@ -92,12 +91,14 @@ public class GitBrowseCommand extends AbstractGitCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public GitBrowseCommand(Repository repository, File repositoryDirectory)
+  public GitBrowseCommand(GitContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -109,53 +110,49 @@ public class GitBrowseCommand extends AbstractGitCommand
    * @param request
    *
    * @return
+   *
+   * @throws IOException
+   * @throws RepositoryException
    */
   @Override
-  public BrowserResult getBrowserResult(BrowseCommandRequest request) throws IOException, RepositoryException
+  public BrowserResult getBrowserResult(BrowseCommandRequest request)
+          throws IOException, RepositoryException
   {
-    if ( logger.isDebugEnabled() ){
+    if (logger.isDebugEnabled())
+    {
       logger.debug("try to create browse result for {}", request);
     }
+
     BrowserResult result = null;
-    org.eclipse.jgit.lib.Repository repo = null;
+    org.eclipse.jgit.lib.Repository repo = open();
+    ObjectId revId = null;
 
-    try
+    if (Util.isEmpty(request.getRevision()))
     {
-      repo = open();
-
-      ObjectId revId = null;
-
-      if (Util.isEmpty(request.getRevision()))
-      {
-        revId = GitUtil.getRepositoryHead(repo);
-      }
-      else
-      {
-        revId = GitUtil.getRevisionId(repo, request.getRevision());
-      }
-
-      if (revId != null)
-      {
-        result = getResult(repo, revId, request.getPath());
-      }
-      else
-      {
-        if (Util.isNotEmpty(request.getRevision()))
-        {
-          logger.error("could not find revision {}", request.getRevision());
-        }
-        else if (logger.isWarnEnabled())
-        {
-          logger.warn("coul not find head of repository, empty?");
-        }
-
-        result = new BrowserResult(Constants.HEAD, null, null,
-                                   new ArrayList());
-      }
+      revId = GitUtil.getRepositoryHead(repo);
     }
-    finally
+    else
     {
-      GitUtil.close(repo);
+      revId = GitUtil.getRevisionId(repo, request.getRevision());
+    }
+
+    if (revId != null)
+    {
+      result = getResult(repo, revId, request.getPath());
+    }
+    else
+    {
+      if (Util.isNotEmpty(request.getRevision()))
+      {
+        logger.error("could not find revision {}", request.getRevision());
+      }
+      else if (logger.isWarnEnabled())
+      {
+        logger.warn("coul not find head of repository, empty?");
+      }
+
+      result = new BrowserResult(Constants.HEAD, null, null,
+                                 new ArrayList());
     }
 
     return result;
@@ -457,8 +454,8 @@ public class GitBrowseCommand extends AbstractGitCommand
 
     try
     {
-      new GitCatCommand(repository, repositoryDirectory).getContent(repo,
-                        revision, PATH_MODULES, baos);
+      new GitCatCommand(context, repository).getContent(repo, revision,
+                        PATH_MODULES, baos);
       subRepositories = GitSubModuleParser.parse(baos.toString());
     }
     catch (PathNotFoundException ex)
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java
index d4028f9d79..ebc77abc89 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java
@@ -52,7 +52,6 @@ import sonia.scm.util.Util;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -75,13 +74,15 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public GitCatCommand(sonia.scm.repository.Repository repository,
-                       File repositoryDirectory)
+  public GitCatCommand(GitContext context,
+                       sonia.scm.repository.Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -107,18 +108,11 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand
 
     org.eclipse.jgit.lib.Repository repo = null;
 
-    try
-    {
-      repo = open();
+    repo = open();
 
-      ObjectId revId = GitUtil.getRevisionId(repo, request.getRevision());
+    ObjectId revId = GitUtil.getRevisionId(repo, request.getRevision());
 
-      getContent(repo, revId, request.getPath(), output);
-    }
-    finally
-    {
-      GitUtil.close(repo);
-    }
+    getContent(repo, revId, request.getPath(), output);
   }
 
   /**
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java
new file mode 100644
index 0000000000..f53dfd718a
--- /dev/null
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.repository.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import sonia.scm.repository.GitUtil;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class GitContext implements Closeable
+{
+
+  /**
+   * the logger for GitContext
+   */
+  private static final Logger logger =
+    LoggerFactory.getLogger(GitContext.class);
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param directory
+   */
+  public GitContext(File directory)
+  {
+    this.directory = directory;
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   */
+  @Override
+  public void close()
+  {
+    if (logger.isTraceEnabled())
+    {
+      logger.trace("close git repository {}", directory);
+    }
+
+    GitUtil.close(repository);
+    repository = null;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   *
+   * @throws IOException
+   */
+  public org.eclipse.jgit.lib.Repository open() throws IOException
+  {
+    if (repository == null)
+    {
+      if (logger.isTraceEnabled())
+      {
+        logger.trace("open git repository {}", directory);
+      }
+
+      repository = GitUtil.open(directory);
+    }
+
+    return repository;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private File directory;
+
+  /** Field description */
+  private org.eclipse.jgit.lib.Repository repository;
+}
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java
index 27e5dc4183..8b24eea53f 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java
@@ -52,7 +52,6 @@ import sonia.scm.util.Util;
 //~--- JDK imports ------------------------------------------------------------
 
 import java.io.BufferedOutputStream;
-import java.io.File;
 import java.io.OutputStream;
 
 import java.util.List;
@@ -76,12 +75,14 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public GitDiffCommand(Repository repository, File repositoryDirectory)
+  public GitDiffCommand(GitContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -96,14 +97,14 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
   @Override
   public void getDiffResult(DiffCommandRequest request, OutputStream output)
   {
-    org.eclipse.jgit.lib.Repository gr = null;
     RevWalk walk = null;
     TreeWalk treeWalk = null;
     DiffFormatter formatter = null;
 
     try
     {
-      gr = open();
+      org.eclipse.jgit.lib.Repository gr = open();
+
       walk = new RevWalk(gr);
 
       RevCommit commit = walk.parseCommit(gr.resolve(request.getRevision()));
@@ -155,6 +156,7 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
     }
     catch (Exception ex)
     {
+
       // TODO throw exception
       logger.error("could not create diff", ex);
     }
@@ -163,7 +165,6 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
       GitUtil.release(walk);
       GitUtil.release(treeWalk);
       GitUtil.release(formatter);
-      GitUtil.close(gr);
     }
   }
 }
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java
index 51d4748b6e..b7423a2940 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java
@@ -54,7 +54,6 @@ import sonia.scm.util.IOUtil;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 
 import java.util.ArrayList;
@@ -79,13 +78,14 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  GitLogCommand(sonia.scm.repository.Repository repository,
-                File repositoryDirectory)
+  GitLogCommand(GitContext context, sonia.scm.repository.Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -164,12 +164,11 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
     }
 
     ChangesetPagingResult changesets = null;
-    org.eclipse.jgit.lib.Repository gr = null;
     GitChangesetConverter converter = null;
 
     try
     {
-      gr = open();
+      org.eclipse.jgit.lib.Repository gr = open();
 
       if (!gr.getAllRefs().isEmpty())
       {
@@ -260,7 +259,6 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
     finally
     {
       IOUtil.close(converter);
-      GitUtil.close(gr);
     }
 
     return changesets;
diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java
index b300af1762..3a55da1237 100644
--- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java
+++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java
@@ -41,7 +41,7 @@ import sonia.scm.repository.api.Command;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
+import java.io.IOException;
 
 import java.util.Set;
 
@@ -70,7 +70,21 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
           Repository repository)
   {
     this.repository = repository;
-    this.repositoryDirectory = handler.getDirectory(repository);
+    context = new GitContext(handler.getDirectory(repository));
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @throws IOException
+   */
+  @Override
+  public void close() throws IOException
+  {
+    context.close();
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -84,7 +98,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public BlameCommand getBlameCommand()
   {
-    return new GitBlameCommand(repository, repositoryDirectory);
+    return new GitBlameCommand(context, repository);
   }
 
   /**
@@ -96,7 +110,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public BrowseCommand getBrowseCommand()
   {
-    return new GitBrowseCommand(repository, repositoryDirectory);
+    return new GitBrowseCommand(context, repository);
   }
 
   /**
@@ -108,7 +122,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public CatCommand getCatCommand()
   {
-    return new GitCatCommand(repository, repositoryDirectory);
+    return new GitCatCommand(context, repository);
   }
 
   /**
@@ -120,7 +134,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public DiffCommand getDiffCommand()
   {
-    return new GitDiffCommand(repository, repositoryDirectory);
+    return new GitDiffCommand(context, repository);
   }
 
   /**
@@ -132,7 +146,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public LogCommand getLogCommand()
   {
-    return new GitLogCommand(repository, repositoryDirectory);
+    return new GitLogCommand(context, repository);
   }
 
   /**
@@ -150,8 +164,8 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  private Repository repository;
+  private GitContext context;
 
   /** Field description */
-  private File repositoryDirectory;
+  private Repository repository;
 }
diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java
index 32b2ad826d..98e2399c8f 100644
--- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java
+++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java
@@ -31,6 +31,10 @@
 
 package sonia.scm.repository.spi;
 
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.junit.After;
+
 /**
  *
  * @author Sebastian Sdorra
@@ -38,6 +42,34 @@ package sonia.scm.repository.spi;
 public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
 {
 
+  /**
+   * Method description
+   *
+   */
+  @After
+  public void close()
+  {
+    context.close();
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  protected GitContext createContext()
+  {
+    if (context == null)
+    {
+      context = new GitContext(repositoryDirectory);
+    }
+
+    return context;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
   /**
    * Method description
    *
@@ -61,4 +93,9 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
   {
     return "sonia/scm/repository/spi/scm-git-spi-test.zip";
   }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private GitContext context;
 }
diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java
index 8cb1d5d13c..05649f64d8 100644
--- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java
+++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java
@@ -66,8 +66,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
 
     request.setPath("a.txt");
 
-    BlameResult result = new GitBlameCommand(repository,
-                           repositoryDirectory).getBlameResult(request);
+    BlameResult result = createCommand().getBlameResult(request);
 
     assertNotNull(result);
     assertEquals(2, result.getTotal());
@@ -103,8 +102,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
     request.setPath("a.txt");
     request.setRevision("86a6645eceefe8b9a247db5eb16e3d89a7e6e6d1");
 
-    BlameResult result = new GitBlameCommand(repository,
-                           repositoryDirectory).getBlameResult(request);
+    BlameResult result = createCommand().getBlameResult(request);
 
     assertNotNull(result);
     assertEquals(1, result.getTotal());
@@ -131,4 +129,15 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
     assertEquals("Douglas Adams", line.getAuthor().getName());
     assertEquals("douglas.adams@hitchhiker.com", line.getAuthor().getMail());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private GitBlameCommand createCommand()
+  {
+    return new GitBlameCommand(createContext(), repository);
+  }
 }
diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java
index faa6b4b041..70a55a1050 100644
--- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java
+++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java
@@ -64,10 +64,8 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
   @Test
   public void testBrowse() throws IOException, RepositoryException
   {
-    BrowserResult result = new GitBrowseCommand(
-                               repository,
-                               repositoryDirectory).getBrowserResult(
-                                   new BrowseCommandRequest());
+    BrowserResult result =
+      createCommand().getBrowserResult(new BrowseCommandRequest());
 
     assertNotNull(result);
 
@@ -119,8 +117,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
 
     request.setPath("c");
 
-    BrowserResult result = new GitBrowseCommand(repository,
-                             repositoryDirectory).getBrowserResult(request);
+    BrowserResult result = createCommand().getBrowserResult(request);
 
     assertNotNull(result);
 
@@ -160,4 +157,15 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
     assertTrue(e.getLength() > 0);
     checkDate(e.getLastModified());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private GitBrowseCommand createCommand()
+  {
+    return new GitBrowseCommand(createContext(), repository);
+  }
 }
diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java
index 431051aeac..2a8943f6f8 100644
--- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java
+++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java
@@ -104,7 +104,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase
 
     try
     {
-      new GitCatCommand(repository, repositoryDirectory).getCatResult(request,
+      new GitCatCommand(createContext(), repository).getCatResult(request,
                         baos);
     }
     finally
diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java
index 5acaca69cc..0381b2d514 100644
--- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java
+++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java
@@ -63,10 +63,8 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
   @Test
   public void testGetAll() throws IOException
   {
-    ChangesetPagingResult result = new GitLogCommand(
-                                       repository,
-                                       repositoryDirectory).getChangesets(
-                                         new LogCommandRequest());
+    ChangesetPagingResult result =
+      createCommand().getChangesets(new LogCommandRequest());
 
     assertNotNull(result);
     assertEquals(5, result.getTotal());
@@ -86,8 +84,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
 
     request.setPath("a.txt");
 
-    ChangesetPagingResult result =
-      new GitLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(3, result.getTotal());
@@ -110,8 +107,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
 
     request.setPagingLimit(2);
 
-    ChangesetPagingResult result =
-      new GitLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(5, result.getTotal());
@@ -142,8 +138,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
     request.setPagingStart(1);
     request.setPagingLimit(2);
 
-    ChangesetPagingResult result =
-      new GitLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(5, result.getTotal());
@@ -167,7 +162,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
   @Test
   public void testGetCommit()
   {
-    GitLogCommand command = new GitLogCommand(repository, repositoryDirectory);
+    GitLogCommand command = createCommand();
     Changeset c = command.getChangeset("435df2f061add3589cb3");
 
     assertNotNull(c);
@@ -202,8 +197,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
     request.setStartChangeset("592d797cd36432e59141");
     request.setEndChangeset("435df2f061add3589cb3");
 
-    ChangesetPagingResult result =
-      new GitLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(2, result.getTotal());
@@ -217,4 +211,15 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
     assertNotNull(c2);
     assertEquals("435df2f061add3589cb3", c2.getId());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private GitLogCommand createCommand()
+  {
+    return new GitLogCommand(createContext(), repository);
+  }
 }

From 7a7579edefcb2ed4fe6ada94dca0d1d86c913324 Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Thu, 21 Jun 2012 20:18:05 +0200
Subject: [PATCH 099/159] improve performance of subversion repository api

---
 .../repository/spi/AbstractSvnCommand.java    |  16 +-
 .../scm/repository/spi/SvnBlameCommand.java   |  20 +--
 .../scm/repository/spi/SvnBrowseCommand.java  |  15 +-
 .../scm/repository/spi/SvnCatCommand.java     |  15 +-
 .../sonia/scm/repository/spi/SvnContext.java  | 153 ++++++++++++++++++
 .../scm/repository/spi/SvnDiffCommand.java    |   8 +-
 .../scm/repository/spi/SvnLogCommand.java     |  25 +--
 .../spi/SvnRepositoryServiceProvider.java     |  18 +--
 .../spi/AbstractSvnCommandTestBase.java       |  46 ++++++
 .../repository/spi/SvnBlameCommandTest.java   |  17 +-
 .../repository/spi/SvnBrowseCommandTest.java  |  35 +++-
 .../scm/repository/spi/SvnCatCommandTest.java |  20 ++-
 .../scm/repository/spi/SvnLogCommandTest.java |  75 +++++----
 13 files changed, 340 insertions(+), 123 deletions(-)
 create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java

diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java
index 27ce9637ec..1060337cd0 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java
@@ -40,10 +40,6 @@ import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
 
 import sonia.scm.repository.Repository;
 
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-
 /**
  *
  * @author Sebastian Sdorra
@@ -55,13 +51,15 @@ public class AbstractSvnCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  protected AbstractSvnCommand(Repository repository, File repositoryDirectory)
+  protected AbstractSvnCommand(SvnContext context, Repository repository)
   {
+    this.context = context;
     this.repository = repository;
-    this.repositoryDirectory = repositoryDirectory;
   }
 
   //~--- methods --------------------------------------------------------------
@@ -76,14 +74,14 @@ public class AbstractSvnCommand
    */
   public SVNRepository open() throws SVNException
   {
-    return SVNRepositoryFactory.create(SVNURL.fromFile(repositoryDirectory));
+    return context.open();
   }
 
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  protected Repository repository;
+  protected SvnContext context;
 
   /** Field description */
-  protected File repositoryDirectory;
+  protected Repository repository;
 }
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java
index e7a50d9d52..527d381eed 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java
@@ -48,7 +48,6 @@ import sonia.scm.repository.BlameResult;
 import sonia.scm.repository.Repository;
 import sonia.scm.repository.RepositoryException;
 import sonia.scm.repository.SvnBlameHandler;
-import sonia.scm.repository.SvnUtil;
 import sonia.scm.util.Util;
 
 //~--- JDK imports ------------------------------------------------------------
@@ -69,12 +68,14 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public SvnBlameCommand(Repository repository, File repositoryDirectory)
+  public SvnBlameCommand(SvnContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -97,8 +98,6 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
     String path = request.getPath();
     String revision = request.getRevision();
     List blameLines = Lists.newArrayList();
-    SVNRepository svnRepository = null;
-    SVNURL svnurl = null;
     SVNRevision endRevision = null;
 
     if (Util.isNotEmpty(revision))
@@ -112,10 +111,9 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
 
     try
     {
-      svnurl = SVNURL.fromFile(new File(repositoryDirectory, path));
-      svnRepository =
-        SVNRepositoryFactory.create(SVNURL.fromFile(repositoryDirectory));
-
+      SVNURL svnurl = SVNURL.fromFile(new File(context.getDirectory(), path));
+      SVNRepository svnRepository =
+        SVNRepositoryFactory.create(context.createUrl());
       ISVNAuthenticationManager svnManager =
         svnRepository.getAuthenticationManager();
       SVNLogClient svnLogClient = new SVNLogClient(svnManager, null);
@@ -129,10 +127,6 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
     {
       throw new RepositoryException("could not create blame result", ex);
     }
-    finally
-    {
-      SvnUtil.closeSession(svnRepository);
-    }
 
     return new BlameResult(blameLines.size(), blameLines);
   }
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java
index 6b7d6e4d17..d261a567f8 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java
@@ -53,7 +53,6 @@ import sonia.scm.util.Util;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 
 import java.util.ArrayList;
@@ -80,12 +79,14 @@ public class SvnBrowseCommand extends AbstractSvnCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  SvnBrowseCommand(Repository repository, File repositoryDirectory)
+  SvnBrowseCommand(SvnContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -116,12 +117,10 @@ public class SvnBrowseCommand extends AbstractSvnCommand
     }
 
     BrowserResult result = null;
-    SVNRepository svnRepository = null;
 
     try
     {
-      svnRepository = open();
-
+      SVNRepository svnRepository = open();
       Collection entries =
         svnRepository.getDir(Util.nonNull(path), revisionNumber, null,
                              (Collection) null);
@@ -152,10 +151,6 @@ public class SvnBrowseCommand extends AbstractSvnCommand
     {
       logger.error("could not open repository", ex);
     }
-    finally
-    {
-      SvnUtil.closeSession(svnRepository);
-    }
 
     return result;
   }
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java
index 57f01c74dd..7ff45073cb 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java
@@ -46,7 +46,6 @@ import sonia.scm.repository.SvnUtil;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -69,12 +68,14 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  SvnCatCommand(Repository repository, File repositoryDirectory)
+  SvnCatCommand(SvnContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -99,11 +100,11 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
     }
 
     long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision());
-    SVNRepository svnRepository = null;
 
     try
     {
-      svnRepository = open();
+      SVNRepository svnRepository = open();
+
       svnRepository.getFile(request.getPath(), revisionNumber,
                             new SVNProperties(), output);
     }
@@ -111,9 +112,5 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
     {
       logger.error("could not open repository", ex);
     }
-    finally
-    {
-      SvnUtil.closeSession(svnRepository);
-    }
   }
 }
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java
new file mode 100644
index 0000000000..478632c633
--- /dev/null
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java
@@ -0,0 +1,153 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.repository.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.io.SVNRepository;
+import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
+
+import sonia.scm.repository.SvnUtil;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class SvnContext implements Closeable
+{
+
+  /**
+   * the logger for SvnContext
+   */
+  private static final Logger logger =
+    LoggerFactory.getLogger(SvnContext.class);
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param directory
+   */
+  public SvnContext(File directory)
+  {
+    this.directory = directory;
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @throws IOException
+   */
+  @Override
+  public void close() throws IOException
+  {
+    if (logger.isTraceEnabled())
+    {
+      logger.trace("close svn repository {}", directory);
+    }
+
+    SvnUtil.closeSession(repository);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   *
+   * @throws SVNException
+   */
+  public SVNURL createUrl() throws SVNException
+  {
+    return SVNURL.fromFile(directory);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   *
+   * @throws SVNException
+   */
+  public SVNRepository open() throws SVNException
+  {
+    if (repository == null)
+    {
+      if (logger.isTraceEnabled())
+      {
+        logger.trace("open svn repository {}", directory);
+      }
+
+      repository = SVNRepositoryFactory.create(createUrl());
+    }
+
+    return repository;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public File getDirectory()
+  {
+    return directory;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private File directory;
+
+  /** Field description */
+  private SVNRepository repository;
+}
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java
index 10053d99fa..f4f6649e96 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java
@@ -77,12 +77,14 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  public SvnDiffCommand(Repository repository, File repositoryDirectory)
+  public SvnDiffCommand(SvnContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -114,7 +116,7 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand
 
     try
     {
-      SVNURL svnurl = SVNURL.fromFile(repositoryDirectory);
+      SVNURL svnurl = context.createUrl();
 
       if (Util.isNotEmpty(path))
       {
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
index 9167c63388..57fcd4fe13 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java
@@ -52,7 +52,6 @@ import sonia.scm.util.Util;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
 import java.io.IOException;
 
 import java.util.Collection;
@@ -77,12 +76,14 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
    * Constructs ...
    *
    *
+   *
+   * @param context
    * @param repository
    * @param repositoryDirectory
    */
-  SvnLogCommand(Repository repository, File repositoryDirectory)
+  SvnLogCommand(SvnContext context, Repository repository)
   {
-    super(repository, repositoryDirectory);
+    super(context, repository);
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -109,14 +110,10 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
       logger.debug("fetch changeset {}", revision);
     }
 
-    SVNRepository repository = null;
-
     try
     {
       long revisioNumber = Long.parseLong(revision);
-
-      repository = open();
-
+      SVNRepository repository = open();
       Collection entries = repository.log(null, null,
                                           revisioNumber, revisioNumber, true,
                                           true);
@@ -134,10 +131,6 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
     {
       throw new RepositoryException("could not open repository", ex);
     }
-    finally
-    {
-      SvnUtil.closeSession(repository);
-    }
 
     return changeset;
   }
@@ -163,14 +156,12 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
     }
 
     ChangesetPagingResult changesets = null;
-    SVNRepository repository = null;
     String startRevision = request.getStartChangeset();
     String endRevision = request.getEndChangeset();
 
     try
     {
-      repository = open();
-
+      SVNRepository repository = open();
       long startRev = repository.getLatestRevision();
       long endRev = 0;
       long maxRev = startRev;
@@ -231,10 +222,6 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
     {
       throw new RepositoryException("could not open repository", ex);
     }
-    finally
-    {
-      SvnUtil.closeSession(repository);
-    }
 
     return changesets;
   }
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java
index ddc49b479d..f089d01216 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java
@@ -41,8 +41,6 @@ import sonia.scm.repository.api.Command;
 
 //~--- JDK imports ------------------------------------------------------------
 
-import java.io.File;
-
 import java.util.Set;
 
 /**
@@ -70,7 +68,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
                                Repository repository)
   {
     this.repository = repository;
-    this.repositoryDirectory = handler.getDirectory(repository);
+    this.context = new SvnContext(handler.getDirectory(repository));
   }
 
   //~--- get methods ----------------------------------------------------------
@@ -84,7 +82,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public SvnBlameCommand getBlameCommand()
   {
-    return new SvnBlameCommand(repository, repositoryDirectory);
+    return new SvnBlameCommand(context, repository);
   }
 
   /**
@@ -96,7 +94,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public SvnBrowseCommand getBrowseCommand()
   {
-    return new SvnBrowseCommand(repository, repositoryDirectory);
+    return new SvnBrowseCommand(context, repository);
   }
 
   /**
@@ -108,7 +106,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public SvnCatCommand getCatCommand()
   {
-    return new SvnCatCommand(repository, repositoryDirectory);
+    return new SvnCatCommand(context, repository);
   }
 
   /**
@@ -120,7 +118,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public SvnDiffCommand getDiffCommand()
   {
-    return new SvnDiffCommand(repository, repositoryDirectory);
+    return new SvnDiffCommand(context, repository);
   }
 
   /**
@@ -132,7 +130,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   @Override
   public SvnLogCommand getLogCommand()
   {
-    return new SvnLogCommand(repository, repositoryDirectory);
+    return new SvnLogCommand(context, repository);
   }
 
   /**
@@ -150,8 +148,8 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  private Repository repository;
+  private SvnContext context;
 
   /** Field description */
-  private File repositoryDirectory;
+  private Repository repository;
 }
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java
index a4ff8eab88..b8eee112c0 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java
@@ -31,6 +31,14 @@
 
 package sonia.scm.repository.spi;
 
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.junit.After;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.IOException;
+
 /**
  *
  * @author Sebastian Sdorra
@@ -38,6 +46,39 @@ package sonia.scm.repository.spi;
 public class AbstractSvnCommandTestBase extends ZippedRepositoryTestBase
 {
 
+  /**
+   * Method description
+   *
+   *
+   * @throws IOException
+   */
+  @After
+  public void close() throws IOException
+  {
+    if (context != null)
+    {
+      context.close();
+    }
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public SvnContext createContext()
+  {
+    if (context == null)
+    {
+      context = new SvnContext(repositoryDirectory);
+    }
+
+    return context;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
   /**
    * Method description
    *
@@ -61,4 +102,9 @@ public class AbstractSvnCommandTestBase extends ZippedRepositoryTestBase
   {
     return "sonia/scm/repository/spi/scm-svn-spi-test.zip";
   }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private SvnContext context;
 }
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java
index a4b49baffc..7585535716 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java
@@ -66,8 +66,7 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
 
     request.setPath("a.txt");
 
-    BlameResult result = new SvnBlameCommand(repository,
-                           repositoryDirectory).getBlameResult(request);
+    BlameResult result = createCommand().getBlameResult(request);
 
     assertNotNull(result);
     assertEquals(2, result.getTotal());
@@ -101,8 +100,7 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
     request.setPath("a.txt");
     request.setRevision("3");
 
-    BlameResult result = new SvnBlameCommand(repository,
-                           repositoryDirectory).getBlameResult(request);
+    BlameResult result = createCommand().getBlameResult(request);
 
     assertNotNull(result);
     assertEquals(1, result.getTotal());
@@ -128,4 +126,15 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
     assertEquals("perfect", line.getAuthor().getName());
     assertNull(line.getAuthor().getMail());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private SvnBlameCommand createCommand()
+  {
+    return new SvnBlameCommand(createContext(), repository);
+  }
 }
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java
index 354fab6501..b346507fa5 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java
@@ -26,23 +26,34 @@
  * http://bitbucket.org/sdorra/scm-manager
  *
  */
+
+
+
 package sonia.scm.repository.spi;
 
-import java.io.IOException;
-import java.util.List;
+//~--- non-JDK imports --------------------------------------------------------
+
 import org.junit.Test;
+
 import sonia.scm.repository.BrowserResult;
 import sonia.scm.repository.FileObject;
 import sonia.scm.repository.RepositoryException;
 
 import static org.junit.Assert.*;
 
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.IOException;
+
+import java.util.List;
+
 /**
  *
  * @author Sebastian Sdorra
  */
 public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
 {
+
   /**
    * Method description
    *
@@ -53,10 +64,8 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
   @Test
   public void testBrowse() throws IOException, RepositoryException
   {
-    BrowserResult result = new SvnBrowseCommand(
-                               repository,
-                               repositoryDirectory).getBrowserResult(
-                                   new BrowseCommandRequest());
+    BrowserResult result =
+      createCommand().getBrowserResult(new BrowseCommandRequest());
 
     assertNotNull(result);
 
@@ -108,8 +117,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
 
     request.setPath("c");
 
-    BrowserResult result = new SvnBrowseCommand(repository,
-                             repositoryDirectory).getBrowserResult(request);
+    BrowserResult result = createCommand().getBrowserResult(request);
 
     assertNotNull(result);
 
@@ -149,4 +157,15 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
     assertTrue(e.getLength() > 0);
     checkDate(e.getLastModified());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private SvnBrowseCommand createCommand()
+  {
+    return new SvnBrowseCommand(createContext(), repository);
+  }
 }
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java
index add8d01e65..2048c9dbb4 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java
@@ -26,23 +26,32 @@
  * http://bitbucket.org/sdorra/scm-manager
  *
  */
+
+
+
 package sonia.scm.repository.spi;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+//~--- non-JDK imports --------------------------------------------------------
+
 import org.junit.Test;
+
 import sonia.scm.repository.RepositoryException;
 
 import static org.junit.Assert.*;
 
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
 /**
  *
  * @author Sebastian Sdorra
  */
 public class SvnCatCommandTest extends AbstractSvnCommandTestBase
 {
-  
-   /**
+
+  /**
    * Method description
    *
    *
@@ -94,7 +103,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase
 
     try
     {
-      new SvnCatCommand(repository, repositoryDirectory).getCatResult(request,
+      new SvnCatCommand(createContext(), repository).getCatResult(request,
                         baos);
     }
     finally
@@ -104,5 +113,4 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase
 
     return content;
   }
-  
 }
diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
index 62824c3081..166305bb61 100644
--- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
+++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java
@@ -35,7 +35,9 @@ package sonia.scm.repository.spi;
 
 import org.junit.Test;
 
+import sonia.scm.repository.Changeset;
 import sonia.scm.repository.ChangesetPagingResult;
+import sonia.scm.repository.Modifications;
 import sonia.scm.repository.RepositoryException;
 
 import static org.junit.Assert.*;
@@ -43,8 +45,6 @@ import static org.junit.Assert.*;
 //~--- JDK imports ------------------------------------------------------------
 
 import java.io.IOException;
-import sonia.scm.repository.Changeset;
-import sonia.scm.repository.Modifications;
 
 /**
  *
@@ -55,29 +55,28 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
 
   /**
    *   Method description
-   *  
-   *  
+   *
+   *
    *   @throws IOException
    * @throws RepositoryException
    */
   @Test
   public void testGetAll() throws IOException, RepositoryException
   {
-    ChangesetPagingResult result = new SvnLogCommand(
-                                       repository,
-                                       repositoryDirectory).getChangesets(
-                                         new LogCommandRequest());
+    ChangesetPagingResult result =
+      createCommand().getChangesets(new LogCommandRequest());
 
     assertNotNull(result);
     assertEquals(6, result.getTotal());
     assertEquals(6, result.getChangesets().size());
   }
-  
+
   /**
    * Method description
    *
    *
    * @throws IOException
+   * @throws RepositoryException
    */
   @Test
   public void testGetAllByPath() throws IOException, RepositoryException
@@ -86,8 +85,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
 
     request.setPath("a.txt");
 
-    ChangesetPagingResult result =
-      new SvnLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(3, result.getTotal());
@@ -96,12 +94,13 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     assertEquals("3", result.getChangesets().get(1).getId());
     assertEquals("1", result.getChangesets().get(2).getId());
   }
-  
- /**
-   * Method description
+
+  /**
+   *  Method description
    *
    *
-   * @throws IOException
+   *  @throws IOException
+   * @throws RepositoryException
    */
   @Test
   public void testGetAllWithLimit() throws IOException, RepositoryException
@@ -110,8 +109,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
 
     request.setPagingLimit(2);
 
-    ChangesetPagingResult result =
-      new SvnLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(6, result.getTotal());
@@ -127,12 +125,13 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     assertNotNull(c2);
     assertEquals("4", c2.getId());
   }
-  
-    /**
+
+  /**
    * Method description
    *
    *
    * @throws IOException
+   * @throws RepositoryException
    */
   @Test
   public void testGetAllWithPaging() throws IOException, RepositoryException
@@ -142,8 +141,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     request.setPagingStart(1);
     request.setPagingLimit(2);
 
-    ChangesetPagingResult result =
-      new SvnLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(6, result.getTotal());
@@ -159,16 +157,18 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     assertNotNull(c2);
     assertEquals("3", c2.getId());
   }
-  
- /**
-   * Method description
+
+  /**
+   *  Method description
    *
+   *
+   * @throws IOException
+   * @throws RepositoryException
    */
   @Test
   public void testGetCommit() throws IOException, RepositoryException
   {
-    SvnLogCommand command = new SvnLogCommand(repository, repositoryDirectory);
-    Changeset c = command.getChangeset("3");
+    Changeset c = createCommand().getChangeset("3");
 
     assertNotNull(c);
     assertEquals("3", c.getId());
@@ -186,12 +186,13 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     assertEquals("a.txt", mods.getModified().get(0));
     assertEquals("b.txt", mods.getRemoved().get(0));
   }
-  
- /**
-   * Method description
+
+  /**
+   *  Method description
    *
    *
-   * @throws IOException
+   *  @throws IOException
+   * @throws RepositoryException
    */
   @Test
   public void testGetRange() throws IOException, RepositoryException
@@ -201,8 +202,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     request.setStartChangeset("2");
     request.setEndChangeset("1");
 
-    ChangesetPagingResult result =
-      new SvnLogCommand(repository, repositoryDirectory).getChangesets(request);
+    ChangesetPagingResult result = createCommand().getChangesets(request);
 
     assertNotNull(result);
     assertEquals(2, result.getTotal());
@@ -216,4 +216,15 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
     assertNotNull(c2);
     assertEquals("1", c2.getId());
   }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  private SvnLogCommand createCommand()
+  {
+    return new SvnLogCommand(createContext(), repository);
+  }
 }

From 3205780f07353591a451552b021e0b65311a793d Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Fri, 22 Jun 2012 14:45:58 +0200
Subject: [PATCH 100/159] upgrade svnkit to version 1.7.5-1

---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index df3a4daa24..3718ca746d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -402,7 +402,7 @@
     
     
     1.3.0.201202151440-r
-    1.7.4-1.v1
+    1.7.5-1
     
     
     1.6

From ef00ad320b31a75e5244764ea8b0f69abafb2e8d Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sat, 23 Jun 2012 13:58:18 +0200
Subject: [PATCH 101/159] close repository service after usage

---
 .../rest/resources/RepositoryResource.java    | 50 ++++++++++++++++---
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java
index ca577885a9..9fa12d452c 100644
--- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java
+++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java
@@ -36,6 +36,7 @@ package sonia.scm.api.rest.resources;
 //~--- non-JDK imports --------------------------------------------------------
 
 import com.google.common.base.Strings;
+import com.google.common.io.Closeables;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
@@ -347,12 +348,13 @@ public class RepositoryResource
           throws RepositoryException, IOException
   {
     Response response = null;
+    RepositoryService service = null;
 
     try
     {
       AssertUtil.assertIsNotNull(path);
+      service = servicefactory.create(id);
 
-      RepositoryService service = servicefactory.create(id);
       BlameCommandBuilder builder = service.getBlameCommand();
 
       if (!Strings.isNullOrEmpty(revision))
@@ -383,6 +385,10 @@ public class RepositoryResource
     {
       response = Response.status(Response.Status.BAD_REQUEST).build();
     }
+    finally
+    {
+      Closeables.closeQuietly(service);
+    }
 
     return response;
   }
@@ -418,10 +424,12 @@ public class RepositoryResource
           throws RepositoryException, IOException
   {
     Response response = null;
+    RepositoryService service = null;
 
     try
     {
-      RepositoryService service = servicefactory.create(id);
+      service = servicefactory.create(id);
+
       BrowseCommandBuilder builder = service.getBrowseCommand();
 
       if (!Strings.isNullOrEmpty(revision))
@@ -453,6 +461,10 @@ public class RepositoryResource
     {
       response = Response.status(Response.Status.BAD_REQUEST).build();
     }
+    finally
+    {
+      Closeables.closeQuietly(service);
+    }
 
     return response;
   }
@@ -528,9 +540,12 @@ public class RepositoryResource
 
     if (Util.isNotEmpty(id) && Util.isNotEmpty(revision))
     {
+      RepositoryService service = null;
+
       try
       {
-        RepositoryService service = servicefactory.create(id);
+        service = servicefactory.create(id);
+
         Changeset changeset = service.getLogCommand().getChangeset(revision);
 
         if (changeset != null)
@@ -550,6 +565,10 @@ public class RepositoryResource
       {
         response = Response.status(Response.Status.BAD_REQUEST).build();
       }
+      finally
+      {
+        Closeables.closeQuietly(service);
+      }
     }
     else
     {
@@ -599,11 +618,14 @@ public class RepositoryResource
   @QueryParam("limit") int limit) throws RepositoryException, IOException
   {
     Response response = null;
+    RepositoryService service = null;
 
     try
     {
       ChangesetPagingResult changesets = null;
-      RepositoryService service = servicefactory.create(id);
+
+      service = servicefactory.create(id);
+
       LogCommandBuilder builder = service.getLogCommand();
 
       if (!Strings.isNullOrEmpty(path))
@@ -636,6 +658,10 @@ public class RepositoryResource
     {
       response = Response.status(Response.Status.BAD_REQUEST).build();
     }
+    finally
+    {
+      Closeables.closeQuietly(service);
+    }
 
     return response;
   }
@@ -668,10 +694,12 @@ public class RepositoryResource
   {
     Response response = null;
     StreamingOutput output = null;
+    RepositoryService service = null;
 
     try
     {
-      RepositoryService service = servicefactory.create(id);
+      service = servicefactory.create(id);
+
       CatCommandBuilder builder = service.getCatCommand();
 
       if (!Strings.isNullOrEmpty(revision))
@@ -700,6 +728,10 @@ public class RepositoryResource
       logger.error("could not retrive content", ex);
       response = createErrorResonse(ex);
     }
+    finally
+    {
+      Closeables.closeQuietly(service);
+    }
 
     return response;
   }
@@ -737,11 +769,13 @@ public class RepositoryResource
     AssertUtil.assertIsNotEmpty(id);
     AssertUtil.assertIsNotEmpty(revision);
 
+    RepositoryService service = null;
     Response response = null;
 
     try
     {
-      RepositoryService service = servicefactory.create(id);
+      service = servicefactory.create(id);
+
       DiffCommandBuilder builder = service.getDiffCommand();
 
       if (!Strings.isNullOrEmpty(revision))
@@ -774,6 +808,10 @@ public class RepositoryResource
       logger.error("could not create diff", ex);
       response = createErrorResonse(ex);
     }
+    finally
+    {
+      Closeables.closeQuietly(service);
+    }
 
     return response;
   }

From 1a062efc3e25f86176b839aaabd28e9667a3e07b Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sat, 23 Jun 2012 16:41:47 +0200
Subject: [PATCH 102/159] added selenium test case for authentication

---
 scm-webapp/pom.xml                            | 123 ++++++++
 .../resources/js/login/sonia.login.form.js    |   1 +
 .../scm/selenium/AuthenticationITCase.java    |  57 ++++
 .../sonia/scm/selenium/SeleniumTestBase.java  | 270 ++++++++++++++++++
 4 files changed, 451 insertions(+)
 create mode 100644 scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
 create mode 100644 scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java

diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml
index 52c456c6a8..96a902f54c 100644
--- a/scm-webapp/pom.xml
+++ b/scm-webapp/pom.xml
@@ -231,6 +231,20 @@
       
     
     
+    
+      org.seleniumhq.selenium
+      selenium-java
+      2.24.1
+      test
+    
+    
+    
+      org.seleniumhq.selenium
+      selenium-firefox-driver
+      2.24.1
+      test
+    
+    
     
       com.jcraft
       jsch
@@ -435,6 +449,11 @@
             org.apache.maven.plugins
             maven-failsafe-plugin
             2.12
+            
+              
+                sonia/scm/it/*ITCase.java
+              
+            
             
               
                 integration-test
@@ -499,6 +518,110 @@
 
     
     
+    
+      selenium
+          
+      
+        
+          
+          
+            org.apache.maven.plugins
+            maven-failsafe-plugin
+            2.12
+            
+              
+                sonia/scm/selenium/*ITCase.java
+              
+            
+            
+              
+                integration-test
+                
+                  integration-test
+                
+              
+              
+                verify
+                
+                  verify
+                
+              
+            
+          
+          
+          
+            org.mortbay.jetty
+            maven-jetty-plugin
+            6.1.26
+            
+              8086
+              STOP
+              
+                
+                  scm.home
+                  target/scm-it
+                
+              
+              
+                
+                  8082
+                  60000
+                
+              
+              ${project.build.javaLevel}
+              ${project.build.javaLevel}
+              ${project.build.sourceEncoding}
+              0
+              true
+            
+            
+              
+                start-jetty
+                pre-integration-test
+                
+                  deploy-war
+                
+              
+              
+                stop-jetty
+                post-integration-test
+                
+                  stop
+                
+              
+            
+          
+          
+          
+            org.codehaus.mojo
+            selenium-maven-plugin
+            2.3
+            
+              
+                start-selenium-server
+                pre-integration-test
+                
+                  start-server
+                
+                
+                  true
+                
+              
+              
+                stop-selenium-server
+                post-integration-test
+                
+                  stop-server
+                                
+              
+            
+          
+          
+        
+      
+      
+    
+    
     
       doc
       
diff --git a/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js b/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js
index c4ed773987..22d037d6a2 100644
--- a/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js
+++ b/scm-webapp/src/main/webapp/resources/js/login/sonia.login.form.js
@@ -82,6 +82,7 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
           scope: this,
           handler: this.cancel
         },{
+          id: 'loginButton',
           text: this.loginText,
           formBind: true,
           scope: this,
diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
new file mode 100644
index 0000000000..105fbb1100
--- /dev/null
+++ b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.selenium;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.junit.Test;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class AuthenticationITCase extends SeleniumTestBase
+{
+
+  /**
+   * Method description
+   *
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testAuthentication() throws Exception
+  {
+    authenticate("scmadmin", "scmadmin");
+    logout();
+  }
+}
diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java
new file mode 100644
index 0000000000..356c77fdba
--- /dev/null
+++ b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java
@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.selenium;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.io.Files;
+
+import org.junit.After;
+import org.junit.Before;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.*;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class SeleniumTestBase
+{
+
+  /**
+   * the logger for SeleniumTestBase
+   */
+  private static final Logger logger =
+    LoggerFactory.getLogger(SeleniumTestBase.class);
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @throws Exception
+   */
+  @After
+  public void tearDown() throws Exception
+  {
+    driver.quit();
+  }
+
+  //~--- set methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @throws Exception
+   */
+  @Before
+  public void setUp() throws Exception
+  {
+    driver = new FirefoxDriver();
+    baseUrl = "http://localhost:8082/scm/";
+    open("index.html");
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param username
+   * @param password
+   */
+  protected void authenticate(String username, String password)
+  {
+    type("input[name=username]", username);
+    type("input[name=password]", password);
+    waitAndClick("#loginButton button");
+
+    String ue = waitForPresence("#scm-userinfo-tip").getText();
+
+    assertEquals(username, ue);
+  }
+
+  /**
+   * Method description
+   *
+   */
+  protected void logout()
+  {
+    waitAndClick("#navLogout a");
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param url
+   */
+  protected void open(String url)
+  {
+    driver.get(baseUrl + url);
+    pause(500, TimeUnit.MILLISECONDS);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param value
+   * @param unit
+   */
+  protected void pause(int value, TimeUnit unit)
+  {
+    driver.manage().timeouts().implicitlyWait(value, unit);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param target
+   */
+  protected void screenshot(String target)
+  {
+    screenshot(new File(target));
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param target
+   */
+  protected void screenshot(File target)
+  {
+    try
+    {
+      File scrFile =
+        ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
+
+      Files.copy(scrFile, target);
+    }
+    catch (IOException ex)
+    {
+      logger.error("could not create screenshot", ex);
+    }
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param cssSelector
+   *
+   * @return
+   */
+  protected WebElement select(String cssSelector)
+  {
+    WebElement element = driver.findElement(By.cssSelector(cssSelector));
+
+    assertNotNull(element);
+
+    return element;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param cssLocator
+   * @param value
+   */
+  protected void type(String cssLocator, String value)
+  {
+    select(cssLocator).clear();
+    select(cssLocator).sendKeys(value);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param query
+   */
+  protected void waitAndClick(String query)
+  {
+    waitToBeClickable(query).click();
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param query
+   *
+   * @return
+   */
+  protected WebElement waitForPresence(String query)
+  {
+    WebDriverWait wait = new WebDriverWait(driver, 2);
+
+    return wait.until(
+        ExpectedConditions.presenceOfElementLocated(By.cssSelector(query)));
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param query
+   *
+   * @return
+   */
+  protected WebElement waitToBeClickable(String query)
+  {
+    WebDriverWait wait = new WebDriverWait(driver, 2);
+
+    return wait.until(
+        ExpectedConditions.elementToBeClickable(By.cssSelector(query)));
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  protected WebDriver driver;
+
+  /** Field description */
+  private String baseUrl;
+}

From 10b6a9528623f7b48a46425f5374303520632e91 Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sat, 23 Jun 2012 17:47:07 +0200
Subject: [PATCH 103/159] added selenium test for repository creation

---
 .../js/repository/sonia.repository.panel.js   |  1 +
 .../sonia.repository.settingsformpanel.js     |  1 +
 .../scm/selenium/AuthenticationITCase.java    |  2 +-
 .../scm/selenium/RepositoryCRUDITCase.java    | 90 +++++++++++++++++++
 .../sonia/scm/selenium/SeleniumTestBase.java  |  6 +-
 5 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java

diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.panel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.panel.js
index 60228ce38e..1350693f82 100644
--- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.panel.js
+++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.panel.js
@@ -73,6 +73,7 @@ Sonia.repository.Panel = Ext.extend(Sonia.rest.Panel, {
     var toolbar = [];
     if ( admin ){
       toolbar.push({
+        id: 'repositoryAddButton',
         xtype: 'tbbutton', 
         text: this.addText, 
         icon: this.addIcon, 
diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.settingsformpanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.settingsformpanel.js
index 3987f2076c..956934cee5 100644
--- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.settingsformpanel.js
+++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.settingsformpanel.js
@@ -45,6 +45,7 @@ Sonia.repository.SettingsFormPanel = Ext.extend(Sonia.repository.FormPanel, {
         helpText: this.nameHelpText,
         vtype: 'repositoryName'
       },{
+       id: 'repositoryType',
        fieldLabel: this.typeText,
        name: 'type',
        xtype: 'combo',
diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
index 105fbb1100..73ef171c99 100644
--- a/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
+++ b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java
@@ -51,7 +51,7 @@ public class AuthenticationITCase extends SeleniumTestBase
   @Test
   public void testAuthentication() throws Exception
   {
-    authenticate("scmadmin", "scmadmin");
+    login("scmadmin", "scmadmin");
     logout();
   }
 }
diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java
new file mode 100644
index 0000000000..f3e75ec46b
--- /dev/null
+++ b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.selenium;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class RepositoryCRUDITCase extends SeleniumTestBase
+{
+
+  /**
+   * Method description
+   *
+   */
+  @After
+  public void after()
+  {
+    logout();
+  }
+
+  /**
+   * Method description
+   *
+   */
+  @Test
+  public void createRepository()
+  {
+    waitAndClick("#repositoryAddButton");
+    waitForPresence("input[name=name]").sendKeys("scm");
+    select("#x-form-el-repositoryType img").click();
+    waitAndClick("div.x-combo-list-item:nth-of-type(2)");
+    type("input[name=contact]", "scmadmin@scm-manager.org");
+    type("textarea[name=description]", "SCM-Manager");
+    waitAndClick("div.x-panel-btns button:nth-of-type(1)");
+
+    String name =
+      waitForPresence(
+          "div.x-grid3-row-selected div.x-grid3-col-name").getText();
+
+    assertEquals("scm", name);
+  }
+
+  /**
+   * Method description
+   *
+   */
+  @Before
+  public void login()
+  {
+    login("scmadmin", "scmadmin");
+  }
+}
diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java
index 356c77fdba..547332f386 100644
--- a/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java
+++ b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java
@@ -111,7 +111,7 @@ public class SeleniumTestBase
    * @param username
    * @param password
    */
-  protected void authenticate(String username, String password)
+  protected void login(String username, String password)
   {
     type("input[name=username]", username);
     type("input[name=password]", password);
@@ -238,7 +238,7 @@ public class SeleniumTestBase
    */
   protected WebElement waitForPresence(String query)
   {
-    WebDriverWait wait = new WebDriverWait(driver, 2);
+    WebDriverWait wait = new WebDriverWait(driver, 5);
 
     return wait.until(
         ExpectedConditions.presenceOfElementLocated(By.cssSelector(query)));
@@ -254,7 +254,7 @@ public class SeleniumTestBase
    */
   protected WebElement waitToBeClickable(String query)
   {
-    WebDriverWait wait = new WebDriverWait(driver, 2);
+    WebDriverWait wait = new WebDriverWait(driver, 5);
 
     return wait.until(
         ExpectedConditions.elementToBeClickable(By.cssSelector(query)));

From 5406d1005b121f1cb51f39ac24802e74c0a45d81 Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sun, 24 Jun 2012 10:14:05 +0200
Subject: [PATCH 104/159] remove currently unused parameter

---
 .../scm/repository/api/LogCommandBuilder.java | 15 -----
 .../scm/repository/spi/LogCommandRequest.java | 60 +------------------
 2 files changed, 2 insertions(+), 73 deletions(-)

diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
index fc914d321c..1fe3e35afb 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
@@ -278,21 +278,6 @@ public final class LogCommandBuilder
 
   //~--- set methods ----------------------------------------------------------
 
-  /**
-   * Retrieve only changesets of the given branch.
-   *
-   *
-   * @param branch branch name to query
-   *
-   * @return {@code this}
-   */
-  public LogCommandBuilder setBranch(String branch)
-  {
-    request.setBranch(branch);
-
-    return this;
-  }
-
   /**
    * Disables the cache for changesets. This means that every {@link Changeset}
    * is directly retrieved from the {@link Repository}. Note:  Disabling
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
index 96fc585c6a..f1ec3e206c 100644
--- a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
@@ -76,9 +76,7 @@ public final class LogCommandRequest implements Serializable, Resetable
            && Objects.equal(endChangeset, other.endChangeset)
            && Objects.equal(pagingStart, other.pagingStart)
            && Objects.equal(pagingLimit, other.pagingLimit)
-           && Objects.equal(branch, other.branch)
-           && Objects.equal(path, other.path)
-           && Objects.equal(pending, other.pending);
+           && Objects.equal(path, other.path);
   }
 
   /**
@@ -91,7 +89,7 @@ public final class LogCommandRequest implements Serializable, Resetable
   public int hashCode()
   {
     return Objects.hashCode(startChangeset, endChangeset, pagingStart,
-                            pagingLimit, branch, path, pending);
+                            pagingLimit, path);
   }
 
   /**
@@ -106,8 +104,6 @@ public final class LogCommandRequest implements Serializable, Resetable
     pagingStart = 0;
     pagingLimit = 20;
     path = null;
-    branch = null;
-    pending = false;
   }
 
   /**
@@ -125,26 +121,13 @@ public final class LogCommandRequest implements Serializable, Resetable
                   .add("endChangeset", endChangeset)
                   .add("pagingStart", pagingStart)
                   .add("pagingLimit", pagingLimit)
-                  .add("branch", branch)
                   .add("path", path)
-                  .add("pending", pending)
                   .toString();
     //J+
   }
 
   //~--- set methods ----------------------------------------------------------
 
-  /**
-   * Method description
-   *
-   *
-   * @param branch
-   */
-  public void setBranch(String branch)
-  {
-    this.branch = branch;
-  }
-
   /**
    * Method description
    *
@@ -189,17 +172,6 @@ public final class LogCommandRequest implements Serializable, Resetable
     this.path = path;
   }
 
-  /**
-   * Method description
-   *
-   *
-   * @param pending
-   */
-  public void setPending(boolean pending)
-  {
-    this.pending = pending;
-  }
-
   /**
    * Method description
    *
@@ -213,17 +185,6 @@ public final class LogCommandRequest implements Serializable, Resetable
 
   //~--- get methods ----------------------------------------------------------
 
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  String getBranch()
-  {
-    return branch;
-  }
-
   /**
    * Method description
    *
@@ -290,22 +251,8 @@ public final class LogCommandRequest implements Serializable, Resetable
     return pagingLimit < 0;
   }
 
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  boolean isPending()
-  {
-    return pending;
-  }
-
   //~--- fields ---------------------------------------------------------------
 
-  /** Field description */
-  private String branch;
-
   /** Field description */
   private String endChangeset;
 
@@ -318,9 +265,6 @@ public final class LogCommandRequest implements Serializable, Resetable
   /** Field description */
   private String path;
 
-  /** Field description */
-  private boolean pending = false;
-
   /** Field description */
   private String startChangeset;
 }

From cdf35480d942503647195a6152e59d382edd009c Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sun, 24 Jun 2012 10:44:39 +0200
Subject: [PATCH 105/159] improve cache for repository commands

---
 .../repository/RepositoryCacheKeyFilter.java  | 80 +++++++++++++++++++
 .../repository/api/BlameCommandBuilder.java   | 10 ++-
 .../repository/api/BrowseCommandBuilder.java  |  8 +-
 .../scm/repository/api/LogCommandBuilder.java |  6 +-
 .../api/RepositoryServiceFactory.java         | 33 +++-----
 5 files changed, 104 insertions(+), 33 deletions(-)
 create mode 100644 scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java

diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java
new file mode 100644
index 0000000000..dc25a1a5a2
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.repository;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.Filter;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ *
+ * @param 
+ */
+public class RepositoryCacheKeyFilter
+        implements Filter
+{
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param repositoryId
+   */
+  public RepositoryCacheKeyFilter(String repositoryId)
+  {
+    this.repositoryId = repositoryId;
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param item
+   *
+   * @return
+   */
+  @Override
+  public boolean accept(T item)
+  {
+    return repositoryId.equals(item.getRepositoryId());
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private String repositoryId;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java
index ce04f58053..93891937a5 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java
@@ -46,6 +46,7 @@ import sonia.scm.cache.Cache;
 import sonia.scm.cache.CacheManager;
 import sonia.scm.repository.BlameResult;
 import sonia.scm.repository.Repository;
+import sonia.scm.repository.RepositoryCacheKey;
 import sonia.scm.repository.RepositoryException;
 import sonia.scm.repository.spi.BlameCommand;
 import sonia.scm.repository.spi.BlameCommandRequest;
@@ -62,13 +63,13 @@ import java.io.Serializable;
  * Sample:
  * 
*
- * Print each line number and code of the file scm-core/pom.xml at + * Print each line number and code of the file scm-core/pom.xml at * revision 60c2f2783368:
*

  * BlameCommandBuilder blame = repositoryService.getBlameCommand();
  * BlameResult result = blame.setRevision("60c2f2783368")
  *                           .getBlameResult("scm-core/pom.xml");
- * 
+ *
  * for ( BlameLine line : result ){
  *   System.out.println(line.getLineNumber() + ": " + line.getCode());
  * }
@@ -228,7 +229,7 @@ public final class BlameCommandBuilder
    * @version        Enter version here..., 12/06/05
    * @author         Enter your name here...
    */
-  static class CacheKey implements Serializable
+  static class CacheKey implements RepositoryCacheKey, Serializable
   {
 
     /**
@@ -293,7 +294,8 @@ public final class BlameCommandBuilder
      *
      * @return
      */
-    String getRepositoryId()
+    @Override
+    public String getRepositoryId()
     {
       return repositoryId;
     }
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
index d571fd6a71..4ca46a54ff 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
@@ -45,6 +45,7 @@ import sonia.scm.cache.CacheManager;
 import sonia.scm.repository.BrowserResult;
 import sonia.scm.repository.PreProcessorUtil;
 import sonia.scm.repository.Repository;
+import sonia.scm.repository.RepositoryCacheKey;
 import sonia.scm.repository.RepositoryException;
 import sonia.scm.repository.spi.BrowseCommand;
 import sonia.scm.repository.spi.BrowseCommandRequest;
@@ -66,7 +67,7 @@ import java.io.Serializable;
  * BrowserResult result = browse.setPath("scm-core")
  *                              .setRevision("11aeec7db845")
  *                              .getBrowserResult();
- * 
+ *
  * for ( FileObject fo : result ){
  *   System.out.println( fo.getPath() );
  * }
@@ -257,7 +258,7 @@ public final class BrowseCommandBuilder
    * @version        Enter version here..., 12/06/05
    * @author         Enter your name here...
    */
-  static class CacheKey implements Serializable
+  static class CacheKey implements RepositoryCacheKey, Serializable
   {
 
     /**
@@ -322,7 +323,8 @@ public final class BrowseCommandBuilder
      *
      * @return
      */
-    String getRepositoryId()
+    @Override
+    public String getRepositoryId()
     {
       return repositoryId;
     }
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
index 1fe3e35afb..fe6e5ebcef 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
@@ -55,6 +55,7 @@ import sonia.scm.repository.spi.LogCommandRequest;
 
 import java.io.IOException;
 import java.io.Serializable;
+import sonia.scm.repository.RepositoryCacheKey;
 
 /**
  * LogCommandBuilder is able to show the history of a file in a
@@ -396,7 +397,7 @@ public final class LogCommandBuilder
    * @version        Enter version here..., 12/06/05
    * @author         Enter your name here...
    */
-  static class CacheKey implements Serializable
+  static class CacheKey implements RepositoryCacheKey, Serializable
   {
 
     /**
@@ -476,7 +477,8 @@ public final class LogCommandBuilder
      *
      * @return
      */
-    String getRepositoryId()
+    @Override
+    public String getRepositoryId()
     {
       return repositoryId;
     }
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
index 78775e678a..8ec4da7f2b 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
@@ -55,6 +55,8 @@ import sonia.scm.repository.PermissionUtil;
 import sonia.scm.repository.PostReceiveRepositoryHook;
 import sonia.scm.repository.PreProcessorUtil;
 import sonia.scm.repository.Repository;
+import sonia.scm.repository.RepositoryCacheKey;
+import sonia.scm.repository.RepositoryCacheKeyFilter;
 import sonia.scm.repository.RepositoryHookEvent;
 import sonia.scm.repository.RepositoryManager;
 import sonia.scm.repository.RepositoryNotFoundException;
@@ -332,6 +334,7 @@ public final class RepositoryServiceFactory
      *
      * @param repositoryId
      */
+    @SuppressWarnings("unchecked")
     private void clearCaches(final String repositoryId)
     {
       if (logger.isDebugEnabled())
@@ -339,30 +342,12 @@ public final class RepositoryServiceFactory
         logger.debug("clear caches for repository id {}", repositoryId);
       }
 
-      blameCache.removeAll(new Filter()
-      {
-        @Override
-        public boolean accept(BlameCommandBuilder.CacheKey item)
-        {
-          return repositoryId.equals(item.getRepositoryId());
-        }
-      });
-      browseCache.removeAll(new Filter()
-      {
-        @Override
-        public boolean accept(BrowseCommandBuilder.CacheKey item)
-        {
-          return repositoryId.equals(item.getRepositoryId());
-        }
-      });
-      logCache.removeAll(new Filter()
-      {
-        @Override
-        public boolean accept(LogCommandBuilder.CacheKey item)
-        {
-          return repositoryId.equals(item.getRepositoryId());
-        }
-      });
+      RepositoryCacheKeyFilter filter =
+        new RepositoryCacheKeyFilter(repositoryId);
+
+      blameCache.removeAll(filter);
+      browseCache.removeAll(filter);
+      logCache.removeAll(filter);
     }
 
     //~--- fields -------------------------------------------------------------

From c5029d73ed5c92373057bbf1d2d052b5ae1b72ad Mon Sep 17 00:00:00 2001
From: Sebastian Sdorra 
Date: Sun, 24 Jun 2012 10:48:26 +0200
Subject: [PATCH 106/159] sort fileobject list of browse command

---
 .../scm/repository/api/BrowseCommandBuilder.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
index 4ca46a54ff..c23d5efb3c 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java
@@ -43,6 +43,8 @@ import org.slf4j.LoggerFactory;
 import sonia.scm.cache.Cache;
 import sonia.scm.cache.CacheManager;
 import sonia.scm.repository.BrowserResult;
+import sonia.scm.repository.FileObject;
+import sonia.scm.repository.FileObjectNameComparator;
 import sonia.scm.repository.PreProcessorUtil;
 import sonia.scm.repository.Repository;
 import sonia.scm.repository.RepositoryCacheKey;
@@ -55,6 +57,9 @@ import sonia.scm.repository.spi.BrowseCommandRequest;
 import java.io.IOException;
 import java.io.Serializable;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
  * BrowseCommandBuilder is able to browse the files of a {@link Repository}.
  * 

@@ -180,6 +185,14 @@ public final class BrowseCommandBuilder if (!disablePreProcessors && (result != null)) { preProcessorUtil.prepareForReturn(repository, result); + + List fileObjects = result.getFiles(); + + if (fileObjects != null) + { + Collections.sort(fileObjects, FileObjectNameComparator.instance); + result.setFiles(fileObjects); + } } return result; From d84c3ae03a799752e551410440e65f96e1289d4e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 14:29:20 +0200 Subject: [PATCH 107/159] added api for blame pre processors --- .../scm/repository/BlameLinePreProcessor.java | 44 ++++++++++++ .../BlameLinePreProcessorFactory.java | 45 ++++++++++++ .../sonia/scm/repository/BlameResult.java | 5 +- .../java/sonia/scm/repository/EscapeUtil.java | 47 ++++++++++-- .../scm/repository/PreProcessorUtil.java | 72 +++++++++++++++++-- 5 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java new file mode 100644 index 0000000000..18a78355fc --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.plugin.ExtensionPoint; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +@ExtensionPoint +public interface BlameLinePreProcessor extends PreProcessor {} diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java new file mode 100644 index 0000000000..7d529e487c --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.repository; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.plugin.ExtensionPoint; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +@ExtensionPoint +public interface BlameLinePreProcessorFactory + extends PreProcessorFactory {} diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index a1ef0db44c..08b6664ac3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -48,8 +48,9 @@ import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; /** - * Class description - * + * Changeset information by line for a given file. + * + * TODO for 2.0 implement {@link Iterable} * * @author Sebastian Sdorra * @since 1.8 diff --git a/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java b/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java index e3d41c4f1c..b4e85faac0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/EscapeUtil.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- @@ -69,6 +70,34 @@ public class EscapeUtil } } + /** + * Method description + * + * + * @param result + * @since 1.17 + */ + public static void escape(BlameResult result) + { + for (BlameLine line : result.getBlameLines()) + { + escape(line); + } + } + + /** + * Method description + * + * + * @param line + * @since 1.17 + */ + public static void escape(BlameLine line) + { + line.setDescription(escape(line.getDescription())); + escape(line.getAuthor()); + } + /** * Method description * @@ -91,17 +120,25 @@ public class EscapeUtil public static void escape(Changeset changeset) { changeset.setDescription(escape(changeset.getDescription())); + escape(changeset.getAuthor()); + changeset.setBranches(escapeList(changeset.getBranches())); + changeset.setTags(escapeList(changeset.getTags())); + } - Person person = changeset.getAuthor(); - + /** + * Method description + * + * + * @param person + * @since 1.17 + */ + public static void escape(Person person) + { if (person != null) { person.setName(escape(person.getName())); person.setMail(escape(person.getMail())); } - - changeset.setBranches(escapeList(changeset.getBranches())); - changeset.setTags(escapeList(changeset.getTags())); } /** diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java index f9251e8f38..0de4157159 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java @@ -71,13 +71,17 @@ public class PreProcessorUtil * @param changesetPreProcessorFactorySet * @param fileObjectPreProcessorSet * @param fileObjectPreProcessorFactorySet + * @param blameLinePreProcessorSet + * @param blameLinePreProcessorFactorySet */ @Inject public PreProcessorUtil( Set changesetPreProcessorSet, Set changesetPreProcessorFactorySet, Set fileObjectPreProcessorSet, - Set fileObjectPreProcessorFactorySet) + Set fileObjectPreProcessorFactorySet, + Set blameLinePreProcessorSet, + Set blameLinePreProcessorFactorySet) { this.changesetPreProcessorSet = Collections2.transform(changesetPreProcessorSet, @@ -125,10 +129,62 @@ public class PreProcessorUtil return new FileObjectPreProcessorFactoryWrapper(input); } }); + this.blameLinePreProcessorSet = blameLinePreProcessorSet; + this.blameLinePreProcessorFactorySet = blameLinePreProcessorFactorySet; } //~--- methods -------------------------------------------------------------- + /** + * Method description + * + * + * @param repository + * @param blameLine + */ + public void prepareForReturn(Repository repository, BlameLine blameLine) + { + if (logger.isTraceEnabled()) + { + logger.trace("prepare blame line {} of repository {} for return", + blameLine.getLineNumber(), repository.getName()); + } + + EscapeUtil.escape(blameLine); + + PreProcessorHandler handler = + new PreProcessorHandler(blameLinePreProcessorFactorySet, + blameLinePreProcessorSet, repository); + + handler.callPreProcessors(blameLine); + handler.callPreProcessorFactories(blameLine); + } + + /** + * Method description + * + * + * @param repository + * @param blameResult + */ + public void prepareForReturn(Repository repository, BlameResult blameResult) + { + if (logger.isTraceEnabled()) + { + logger.trace("prepare blame result of repository {} for return", + repository.getName()); + } + + EscapeUtil.escape(blameResult); + + PreProcessorHandler handler = + new PreProcessorHandler(blameLinePreProcessorFactorySet, + blameLinePreProcessorSet, repository); + + handler.callPreProcessors(blameResult.getBlameLines()); + handler.callPreProcessorFactories(blameResult.getBlameLines()); + } + /** * Method description * @@ -213,7 +269,7 @@ public class PreProcessorUtil * * * @version Enter version here..., 12/06/16 - * @author Enter your name here... + * @author Enter your name here... */ private static class ChangesetPreProcessorFactoryWrapper implements PreProcessorFactory @@ -268,7 +324,7 @@ public class PreProcessorUtil * * * @version Enter version here..., 12/06/16 - * @author Enter your name here... + * @author Enter your name here... */ private static class ChangesetPreProcessorWrapper implements PreProcessor @@ -311,7 +367,7 @@ public class PreProcessorUtil * * * @version Enter version here..., 12/06/16 - * @author Enter your name here... + * @author Enter your name here... */ private static class FileObjectPreProcessorFactoryWrapper implements PreProcessorFactory @@ -367,7 +423,7 @@ public class PreProcessorUtil * * * @version Enter version here..., 12/06/16 - * @author Enter your name here... + * @author Enter your name here... */ private static class FileObjectPreProcessorWrapper implements PreProcessor @@ -551,6 +607,12 @@ public class PreProcessorUtil //~--- fields --------------------------------------------------------------- + /** Field description */ + private Collection blameLinePreProcessorFactorySet; + + /** Field description */ + private Collection blameLinePreProcessorSet; + /** Field description */ private Collection changesetPreProcessorFactorySet; From c05a141cf653142b0dc624901a9454eeeff02f53 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 14:34:09 +0200 Subject: [PATCH 108/159] use blame pre processor api --- .../repository/api/BlameCommandBuilder.java | 32 ++++++++++++++++++- .../scm/repository/api/RepositoryService.java | 6 ++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index 93891937a5..ab1cb24849 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BlameResult; +import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryCacheKey; import sonia.scm.repository.RepositoryException; @@ -99,14 +100,16 @@ public final class BlameCommandBuilder * @param cacheManager cache manager * @param blameCommand implementation of the {@link BlameCommand} * @param repository repository to query + * @param preProcessorUtil */ BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand, - Repository repository) + Repository repository, PreProcessorUtil preProcessorUtil) { this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class, CACHE_NAME); this.blameCommand = blameCommand; this.repository = repository; + this.preProcessorUtil = preProcessorUtil; } //~--- methods -------------------------------------------------------------- @@ -183,6 +186,11 @@ public final class BlameCommandBuilder } } + if (!disablePreProcessors && (result != null)) + { + preProcessorUtil.prepareForReturn(repository, result); + } + return result; } @@ -205,6 +213,22 @@ public final class BlameCommandBuilder return this; } + /** + * Disable the execution of pre processors. + * + * + * @param disablePreProcessors true to disable the pre processors execution + * + * @return {@code this} + */ + public BlameCommandBuilder setDisablePreProcessors( + boolean disablePreProcessors) + { + this.disablePreProcessors = disablePreProcessors; + + return this; + } + /** * Sets the start revision for the blame. * @@ -321,6 +345,12 @@ public final class BlameCommandBuilder /** disable change */ private boolean disableCache; + /** disable the execution of pre processors */ + private boolean disablePreProcessors = false; + + /** Field description */ + private PreProcessorUtil preProcessorUtil; + /** the repository */ private Repository repository; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 0d72f7c908..8e9416c0c1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -60,8 +60,8 @@ import java.io.IOException; * is supported by the {@link RepositoryService} with the * {@link RepositoryService#isSupported(Command)} method.
*
- * - * Warning: You should always close the connection to the repository + * + * Warning: You should always close the connection to the repository * after work is finished. For closing the connection to the repository use the * {@link #close()} method. * @@ -147,7 +147,7 @@ public final class RepositoryService implements Closeable } return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(), - repository); + repository, preProcessorUtil); } /** From 667f1ee83dcdb6400439ab542892fe4235241d82 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 14:38:39 +0200 Subject: [PATCH 109/159] bind blame line pre processor api --- .../sonia/scm/BindingExtensionProcessor.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java b/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java index 07df184863..666e925ddf 100644 --- a/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java +++ b/scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java @@ -46,6 +46,8 @@ import sonia.scm.group.GroupListener; import sonia.scm.io.FileSystem; import sonia.scm.plugin.ext.Extension; import sonia.scm.plugin.ext.ExtensionProcessor; +import sonia.scm.repository.BlameLinePreProcessor; +import sonia.scm.repository.BlameLinePreProcessorFactory; import sonia.scm.repository.ChangesetPreProcessor; import sonia.scm.repository.ChangesetPreProcessorFactory; import sonia.scm.repository.FileObjectPreProcessor; @@ -125,6 +127,12 @@ public class BindingExtensionProcessor implements ExtensionProcessor Multibinder fileObjectPreProcessorFactoryBinder = Multibinder.newSetBinder(binder, FileObjectPreProcessorFactory.class); + // blameline pre processor + Multibinder blameLinePreProcessorBinder = + Multibinder.newSetBinder(binder, BlameLinePreProcessor.class); + Multibinder blameLinePreProcessorFactoryBinder = + Multibinder.newSetBinder(binder, BlameLinePreProcessorFactory.class); + // repository service resolver Multibinder repositoryServiceResolverBinder = Multibinder.newSetBinder(binder, RepositoryServiceResolver.class); @@ -273,6 +281,27 @@ public class BindingExtensionProcessor implements ExtensionProcessor fileObjectPreProcessorFactoryBinder.addBinding().to(extensionClass); } + else if (BlameLinePreProcessor.class.isAssignableFrom(extensionClass)) + { + if (logger.isInfoEnabled()) + { + logger.info("bind BlameLinePreProcessor {}", + extensionClass.getName()); + } + + blameLinePreProcessorBinder.addBinding().to(extensionClass); + } + else if (BlameLinePreProcessorFactory.class.isAssignableFrom( + extensionClass)) + { + if (logger.isInfoEnabled()) + { + logger.info("bind BlameLinePreProcessorFactory {}", + extensionClass.getName()); + } + + blameLinePreProcessorFactoryBinder.addBinding().to(extensionClass); + } else if (RepositoryHook.class.isAssignableFrom(extensionClass)) { if (logger.isInfoEnabled()) From 1a31608f41908f77ded608bba6f3d3d577d84a86 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 15:32:49 +0200 Subject: [PATCH 110/159] added map cache for unit tests --- .../main/java/sonia/scm/cache/MapCache.java | 153 +++++++++++++++ .../java/sonia/scm/cache/MapCacheManager.java | 180 ++++++++++++++++++ 2 files changed, 333 insertions(+) create mode 100644 scm-test/src/main/java/sonia/scm/cache/MapCache.java create mode 100644 scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java diff --git a/scm-test/src/main/java/sonia/scm/cache/MapCache.java b/scm-test/src/main/java/sonia/scm/cache/MapCache.java new file mode 100644 index 0000000000..dc479eeb02 --- /dev/null +++ b/scm-test/src/main/java/sonia/scm/cache/MapCache.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.cache; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.Maps; + +import sonia.scm.Filter; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + * + * @param + * @param + */ +public class MapCache implements Cache +{ + + /** + * Method description + * + */ + @Override + public void clear() + { + map.clear(); + } + + /** + * Method description + * + * + * @param key + * + * @return + */ + @Override + public boolean contains(K key) + { + return map.containsKey(key); + } + + /** + * Method description + * + * + * @param key + * @param value + */ + @Override + public void put(K key, V value) + { + map.put(key, value); + } + + /** + * Method description + * + * + * @param key + * + * @return + */ + @Override + public boolean remove(K key) + { + return map.remove(key) != null; + } + + /** + * Method description + * + * + * @param filter + * + * @return + */ + @Override + public boolean removeAll(Filter filter) + { + boolean result = false; + + for (K key : map.keySet()) + { + if (filter.accept(key)) + { + if (remove(key)) + { + result = true; + } + } + } + + return result; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param key + * + * @return + */ + @Override + public V get(K key) + { + return map.get(key); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private Map map = Maps.newHashMap(); +} diff --git a/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java b/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java new file mode 100644 index 0000000000..799eac69a3 --- /dev/null +++ b/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. Neither the name of SCM-Manager; + * nor the names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + + +package sonia.scm.cache; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; +import com.google.common.collect.Maps; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + * @since 1.17 + */ +public class MapCacheManager implements CacheManager +{ + + /** + * Method description + * + * + * @throws IOException + */ + @Override + public void close() throws IOException + { + + // do nothing + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param key + * @param value + * @param name + * @param + * @param + * + * @return + */ + @Override + public Cache getCache(Class key, Class value, String name) + { + CacheKey cacheKey = new CacheKey(key, value, name); + Cache cache = cacheMap.get(cacheKey); + + if (cache == null) + { + cache = new MapCache(); + cacheMap.put(cacheKey, cache); + } + + return cache; + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Class description + * + * + * @version Enter version here..., 12/06/24 + * @author Enter your name here... + */ + private static class CacheKey + { + + /** + * Constructs ... + * + * + * @param key + * @param value + * @param name + */ + public CacheKey(Class key, Class value, String name) + { + this.key = key; + this.value = value; + this.name = name; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final CacheKey other = (CacheKey) obj; + + return Objects.equal(key, other.key) && Objects.equal(value, other.value) + && Objects.equal(name, other.name); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(key, value, name); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private Class key; + + /** Field description */ + private String name; + + /** Field description */ + private Class value; + } + + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private Map cacheMap = Maps.newHashMap(); +} From db42d835cfd8377eacfc69ae88c83b5634e101cb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:00:46 +0200 Subject: [PATCH 111/159] fix mercurial version informations --- .../scm/repository/HgRepositoryHandler.java | 13 +++- .../java/sonia/scm/repository/HgVersion.java | 62 +++++++++++++++++++ .../scm/repository/HgVersionHandler.java | 6 +- 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java index bba0f0ad76..f883b571af 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java @@ -127,7 +127,8 @@ public class HgRepositoryHandler try { this.jaxbContext = JAXBContext.newInstance(BrowserResult.class, - BlameResult.class, Changeset.class, ChangesetPagingResult.class); + BlameResult.class, Changeset.class, ChangesetPagingResult.class, + HgVersion.class); } catch (JAXBException ex) { @@ -362,15 +363,23 @@ public class HgRepositoryHandler try { - JAXBContext context = JAXBContext.newInstance(HgVersion.class); HgVersion hgVersion = new HgVersionHandler(this, hgContextProvider.get(), baseDirectory).getVersion(); if (hgVersion != null) { + if (logger.isDebugEnabled()) + { + logger.debug("mercurial/python informations: {}", hgVersion); + } + version = MessageFormat.format(version, hgVersion.getPython(), hgVersion.getMercurial()); } + else if (logger.isWarnEnabled()) + { + logger.warn("could not retrieve version informations"); + } } catch (Exception ex) { diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java index 616d2dbab5..78017ada51 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java @@ -31,6 +31,10 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; + //~--- JDK imports ------------------------------------------------------------ import javax.xml.bind.annotation.XmlAccessType; @@ -46,6 +50,64 @@ import javax.xml.bind.annotation.XmlRootElement; public class HgVersion { + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final HgVersion other = (HgVersion) obj; + + return Objects.equal(mercurial, other.mercurial) + && Objects.equal(python, other.python); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(mercurial, python); + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("mercurial", mercurial) + .add("python", python) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + /** * Method description * diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java index 7641b9f112..9291454272 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java @@ -36,8 +36,6 @@ package sonia.scm.repository; import java.io.File; import java.io.IOException; -import javax.xml.bind.JAXBContext; - /** * * @author Sebastian Sdorra @@ -54,8 +52,8 @@ public class HgVersionHandler extends AbstractHgHandler * @param context * @param directory */ - public HgVersionHandler(HgRepositoryHandler handler, - HgContext context, File directory) + public HgVersionHandler(HgRepositoryHandler handler, HgContext context, + File directory) { super(handler, context, null, directory); } From 0b3b595c8767851dd06bbf3ed8c8aec92a097107 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:03:35 +0200 Subject: [PATCH 112/159] fix svn version informations --- .../src/main/resources/sonia/scm/version/scm-svn-plugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/version/scm-svn-plugin b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/version/scm-svn-plugin index 76ed46fd46..76fa1f0105 100644 --- a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/version/scm-svn-plugin +++ b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/version/scm-svn-plugin @@ -1 +1 @@ -scm-svn-plugin/${project.version} svnkit/${svnkit-dav.version} \ No newline at end of file +scm-svn-plugin/${project.version} svnkit/${svnkit.version} \ No newline at end of file From 25f07764141687c8332b79306f6bc989b7811a73 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:10:23 +0200 Subject: [PATCH 113/159] fix detection of scm-server servlet container --- scm-core/src/main/java/sonia/scm/ServletContainerDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/ServletContainerDetector.java b/scm-core/src/main/java/sonia/scm/ServletContainerDetector.java index f4f935ce9e..6038abed05 100644 --- a/scm-core/src/main/java/sonia/scm/ServletContainerDetector.java +++ b/scm-core/src/main/java/sonia/scm/ServletContainerDetector.java @@ -215,7 +215,7 @@ public class ServletContainerDetector */ public boolean isScmServer() { - return "scm-server".equals(System.getProperty("app-name")); + return "scm-server".equals(System.getProperty("app.name")); } /** From 23ea72b3c89d676a8fc2715308af0ed2eaa06cb2 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:15:45 +0200 Subject: [PATCH 114/159] use repository createUrl instead of deprecated getUrl --- .../resources/RepositoryRootResource.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java index 9a11e74a6f..48a0d7f975 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java @@ -42,7 +42,6 @@ import com.google.inject.Inject; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryTypePredicate; -import sonia.scm.repository.RepositoryUtil; import sonia.scm.template.TemplateHandler; import sonia.scm.url.UrlProvider; import sonia.scm.url.UrlProviderFactory; @@ -116,15 +115,15 @@ public class RepositoryRootResource @PathParam("type") final String type) throws IOException { - UrlProvider uiUrlProvider = - UrlProviderFactory.createUrlProvider(HttpUtil.getCompleteUrl(request), - UrlProviderFactory.TYPE_WUI); + String baseUrl = HttpUtil.getCompleteUrl(request); + UrlProvider uiUrlProvider = UrlProviderFactory.createUrlProvider(baseUrl, + UrlProviderFactory.TYPE_WUI); //J- Collection unsortedRepositories = Collections2.transform( Collections2.filter( repositoryManager.getAll(), new RepositoryTypePredicate(type)) - , new RepositoryTransformFunction(request, repositoryManager, uiUrlProvider) + , new RepositoryTransformFunction(uiUrlProvider, baseUrl) ); List repositories = Ordering.from( @@ -160,12 +159,14 @@ public class RepositoryRootResource * * @param repository * @param uiUrlProvider + * @param baseUrl */ public RepositoryTemplateElement(Repository repository, - UrlProvider uiUrlProvider) + UrlProvider uiUrlProvider, String baseUrl) { this.repository = repository; this.urlProvider = uiUrlProvider; + this.baseUrl = baseUrl; } //~--- get methods -------------------------------------------------------- @@ -236,11 +237,14 @@ public class RepositoryRootResource */ public String getUrl() { - return repository.getUrl(); + return repository.createUrl(baseUrl); } //~--- fields ------------------------------------------------------------- + /** Field description */ + private String baseUrl; + /** Field description */ private Repository repository; @@ -298,13 +302,10 @@ public class RepositoryRootResource * @param request * @param repositoryManager * @param urlProvider + * @param baseUrl */ - public RepositoryTransformFunction(HttpServletRequest request, - RepositoryManager repositoryManager, - UrlProvider urlProvider) + public RepositoryTransformFunction(UrlProvider urlProvider, String baseUrl) { - this.request = request; - this.repositoryManager = repositoryManager; this.urlProvider = urlProvider; } @@ -321,18 +322,13 @@ public class RepositoryRootResource @Override public RepositoryTemplateElement apply(Repository repository) { - RepositoryUtil.appendUrl(request, repositoryManager, repository); - - return new RepositoryTemplateElement(repository, urlProvider); + return new RepositoryTemplateElement(repository, urlProvider, baseUrl); } //~--- fields ------------------------------------------------------------- /** Field description */ - private RepositoryManager repositoryManager; - - /** Field description */ - private HttpServletRequest request; + private String baseUrl; /** Field description */ private UrlProvider urlProvider; From 9723148d4b6026723415ab77e9c9b88e104a850d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:20:09 +0200 Subject: [PATCH 115/159] fix npe on repository root resource --- .../sonia/scm/api/rest/resources/RepositoryRootResource.java | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java index 48a0d7f975..d3eb29042d 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java @@ -307,6 +307,7 @@ public class RepositoryRootResource public RepositoryTransformFunction(UrlProvider urlProvider, String baseUrl) { this.urlProvider = urlProvider; + this.baseUrl = baseUrl; } //~--- methods ------------------------------------------------------------ From ede9312ef1306ce485e0883f635e777b3239e81b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 16:49:01 +0200 Subject: [PATCH 116/159] mark old repository api as deprecated --- .../src/main/java/sonia/scm/repository/BlameViewer.java | 7 +++++++ .../java/sonia/scm/repository/BlameViewerProvider.java | 7 +++++++ .../main/java/sonia/scm/repository/BlameViewerUtil.java | 4 ++++ .../main/java/sonia/scm/repository/ChangesetViewer.java | 4 ++++ .../java/sonia/scm/repository/ChangesetViewerProvider.java | 3 +++ .../java/sonia/scm/repository/ChangesetViewerUtil.java | 3 +++ .../src/main/java/sonia/scm/repository/DiffViewer.java | 4 ++++ .../main/java/sonia/scm/repository/DiffViewerProvider.java | 3 +++ .../main/java/sonia/scm/repository/RepositoryBrowser.java | 3 +++ .../sonia/scm/repository/RepositoryBrowserProvider.java | 5 +++++ .../java/sonia/scm/repository/RepositoryBrowserUtil.java | 3 +++ 11 files changed, 46 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java b/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java index 6192329017..69657a2005 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java @@ -33,6 +33,10 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; @@ -43,7 +47,10 @@ import java.io.IOException; * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getBlameCommand()) instead. */ +@Deprecated public interface BlameViewer { diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameViewerProvider.java b/scm-core/src/main/java/sonia/scm/repository/BlameViewerProvider.java index 5c2419ac16..6af34a5bf1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameViewerProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameViewerProvider.java @@ -33,11 +33,18 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + /** * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getBlameCommand()} instead. */ +@Deprecated public interface BlameViewerProvider { diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java b/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java index e552a53d1f..3345971958 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java @@ -49,14 +49,18 @@ import sonia.scm.util.AssertUtil; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; +import sonia.scm.repository.api.RepositoryService; /** * Class description * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getBlameCommand()} instead. */ @Singleton +@Deprecated public class BlameViewerUtil extends PartCacheClearHook { diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java index 0f9561e4d0..fe0fed7839 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java @@ -36,11 +36,15 @@ package sonia.scm.repository; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; +import sonia.scm.repository.api.RepositoryService; /** * * @author Sebastian Sdorra + * + * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ +@Deprecated public interface ChangesetViewer { diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java index 4ccf0b86af..f648b79390 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java @@ -37,7 +37,10 @@ package sonia.scm.repository; * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ +@Deprecated public interface ChangesetViewerProvider { diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java index 75c62964e5..d7565ee4f7 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java @@ -58,7 +58,10 @@ import java.util.Set; * * @author Sebastian Sdorra * @since 1.6 + * + * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ +@Deprecated public class ChangesetViewerUtil extends PartCacheClearHook { diff --git a/scm-core/src/main/java/sonia/scm/repository/DiffViewer.java b/scm-core/src/main/java/sonia/scm/repository/DiffViewer.java index 8b9ba11187..149d1b22b9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/DiffViewer.java +++ b/scm-core/src/main/java/sonia/scm/repository/DiffViewer.java @@ -37,12 +37,16 @@ package sonia.scm.repository; import java.io.IOException; import java.io.OutputStream; +import sonia.scm.repository.api.RepositoryService; /** * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getDiffCommand()} instead. */ +@Deprecated public interface DiffViewer { diff --git a/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java b/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java index eea836977b..103ef0a77e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java @@ -37,7 +37,10 @@ package sonia.scm.repository; * * @author Sebastian Sdorra * @since 1.8 + * + * @deprecated use {@link RepositoryService#getDiffCommand()} instead. */ +@Deprecated public interface DiffViewerProvider { diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java index abf137dbfd..ea3ba75c14 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java @@ -42,7 +42,10 @@ import java.io.OutputStream; * * @author Sebastian Sdorra * @since 1.5 + * + * @deprecated use {@link RepositoryService#getBrowseCommand()} instead. */ +@Deprecated public interface RepositoryBrowser { diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java index b87d3481d0..e07de36ef8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java @@ -33,11 +33,16 @@ package sonia.scm.repository; +import sonia.scm.repository.api.RepositoryService; + /** * * @author Sebastian Sdorra * @since 1.5 + * + * @deprecated use {@link RepositoryService#getBrowseCommand()) instead. */ +@Deprecated public interface RepositoryBrowserProvider { diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java index db31d17287..b5cbf1127e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java @@ -59,8 +59,11 @@ import java.util.Set; * * @author Sebastian Sdorra * @since 1.6 + * + * @deprecated use {@link RepositoryService#getBrowseCommand()) instead. */ @Singleton +@Deprecated public class RepositoryBrowserUtil extends PartCacheClearHook { From 43d0ea67a8136b052f867e77d2e243ebb4e8fbe7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 17:27:40 +0200 Subject: [PATCH 117/159] improve cache configuration of blame, browse and log command --- .../repository/api/BlameCommandBuilder.java | 2 +- .../repository/api/BrowseCommandBuilder.java | 2 +- .../scm/repository/api/LogCommandBuilder.java | 2 +- .../src/main/resources/config/ehcache.xml | 27 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index ab1cb24849..aadff564a2 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -83,7 +83,7 @@ public final class BlameCommandBuilder { /** name of the cache */ - static final String CACHE_NAME = "sonia.scm.cache.blame"; + static final String CACHE_NAME = "sonia.cache.cmd.blame"; /** * the logger for BlameCommandBuilder diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index c23d5efb3c..053ef06ac9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -85,7 +85,7 @@ public final class BrowseCommandBuilder { /** Name of the cache */ - static final String CACHE_NAME = "sonia.scm.cache.browse"; + static final String CACHE_NAME = "sonia.cache.cmd.browse"; /** * the logger for BrowseCommandBuilder diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index fe6e5ebcef..bfa337ea6f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -94,7 +94,7 @@ public final class LogCommandBuilder { /** name of the cache */ - static final String CACHE_NAME = "sonia.scm.cache.log"; + static final String CACHE_NAME = "sonia.cache.cmd.log"; /** * the logger for LogCommandBuilder diff --git a/scm-webapp/src/main/resources/config/ehcache.xml b/scm-webapp/src/main/resources/config/ehcache.xml index 5e144a653c..1b238d046d 100644 --- a/scm-webapp/src/main/resources/config/ehcache.xml +++ b/scm-webapp/src/main/resources/config/ehcache.xml @@ -161,4 +161,31 @@ diskPersistent="false" /> + + + + + + From e47c7407d4875ce593128fc83b83024b3bf2628d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 17:41:23 +0200 Subject: [PATCH 118/159] improve blame line pre processor --- .../scm/repository/BlameLinePreProcessor.java | 13 ++++++++++++- .../repository/BlameLinePreProcessorFactory.java | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java index 18a78355fc..4f9d32712f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java @@ -41,4 +41,15 @@ import sonia.scm.plugin.ExtensionPoint; * @since 1.17 */ @ExtensionPoint -public interface BlameLinePreProcessor extends PreProcessor {} +public interface BlameLinePreProcessor extends PreProcessor +{ + + /** + * Method description + * + * + * @param blameLine + */ + @Override + public void process(BlameLine blameLine); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java index 7d529e487c..fc49dd43ec 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java @@ -42,4 +42,17 @@ import sonia.scm.plugin.ExtensionPoint; */ @ExtensionPoint public interface BlameLinePreProcessorFactory - extends PreProcessorFactory {} + extends PreProcessorFactory +{ + + /** + * Method description + * + * + * @param repository + * + * @return + */ + @Override + public BlameLinePreProcessor createPreProcessor(Repository repository); +} From cb16d451ed353cce3bb4954e144987096d6f896a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 17:59:04 +0200 Subject: [PATCH 119/159] fix license headers --- .../scm/cli/BooleanModifyOptionHandler.java | 33 ++++++++++--------- .../scm/repository/BlameLinePreProcessor.java | 33 ++++++++++--------- .../BlameLinePreProcessorFactory.java | 33 ++++++++++--------- .../sonia/scm/repository/PreProcessor.java | 33 ++++++++++--------- .../scm/repository/PreProcessorFactory.java | 33 ++++++++++--------- .../scm/repository/PreProcessorUtil.java | 33 ++++++++++--------- .../repository/RepositoryCacheKeyFilter.java | 33 ++++++++++--------- .../sonia/scm/repository/RepositoryTest.java | 33 ++++++++++--------- .../repository/spi/AbstractGitCommand.java | 33 ++++++++++--------- .../scm/repository/spi/GitBlameCommand.java | 33 ++++++++++--------- .../scm/repository/spi/GitBrowseCommand.java | 33 ++++++++++--------- .../scm/repository/spi/GitCatCommand.java | 33 ++++++++++--------- .../sonia/scm/repository/spi/GitContext.java | 33 ++++++++++--------- .../scm/repository/spi/GitDiffCommand.java | 33 ++++++++++--------- .../scm/repository/spi/GitLogCommand.java | 33 ++++++++++--------- .../spi/GitRepositoryServiceProvider.java | 33 ++++++++++--------- .../spi/GitRepositoryServiceResolver.java | 33 ++++++++++--------- .../spi/AbstractGitCommandTestBase.java | 33 ++++++++++--------- .../repository/spi/GitBlameCommandTest.java | 33 ++++++++++--------- .../repository/spi/GitBrowseCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/GitCatCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/GitLogCommandTest.java | 33 ++++++++++--------- .../java/sonia/scm/repository/HgVersion.java | 33 ++++++++++--------- .../scm/repository/HgVersionHandler.java | 33 ++++++++++--------- .../scm/repository/spi/AbstractHgCommand.java | 33 ++++++++++--------- .../scm/repository/spi/HgBlameCommand.java | 33 ++++++++++--------- .../scm/repository/spi/HgBrowseCommand.java | 33 ++++++++++--------- .../scm/repository/spi/HgCatCommand.java | 33 ++++++++++--------- .../scm/repository/spi/HgDiffCommand.java | 33 ++++++++++--------- .../scm/repository/spi/HgLogCommand.java | 33 ++++++++++--------- .../spi/HgRepositoryServiceProvider.java | 33 ++++++++++--------- .../spi/HgRepositoryServiceResolver.java | 33 ++++++++++--------- .../sonia/scm/web/HgCGIExceptionHandler.java | 33 ++++++++++--------- .../resources/sonia/scm/python/version.py | 31 +++++++++++++++++ .../sonia/scm/web/cgimessages.properties | 12 ++++--- .../scm/repository/HgContextProvider.java | 33 ++++++++++--------- .../repository/TempSCMContextProvider.java | 33 ++++++++++--------- .../spi/AbstractHgCommandTestBase.java | 33 ++++++++++--------- .../repository/spi/HgBlameCommandTest.java | 33 ++++++++++--------- .../repository/spi/HgBrowseCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/HgCatCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/HgLogCommandTest.java | 33 ++++++++++--------- .../repository/spi/AbstractSvnCommand.java | 33 ++++++++++--------- .../scm/repository/spi/SvnBlameCommand.java | 33 ++++++++++--------- .../scm/repository/spi/SvnBrowseCommand.java | 33 ++++++++++--------- .../scm/repository/spi/SvnCatCommand.java | 33 ++++++++++--------- .../sonia/scm/repository/spi/SvnContext.java | 33 ++++++++++--------- .../scm/repository/spi/SvnDiffCommand.java | 33 ++++++++++--------- .../scm/repository/spi/SvnLogCommand.java | 33 ++++++++++--------- .../spi/SvnRepositoryServiceProvider.java | 33 ++++++++++--------- .../spi/SvnRepositoryServiceResolver.java | 33 ++++++++++--------- .../java/sonia/scm/web/SvnGZipFilter.java | 33 ++++++++++--------- .../spi/AbstractSvnCommandTestBase.java | 33 ++++++++++--------- .../repository/spi/SvnBlameCommandTest.java | 33 ++++++++++--------- .../repository/spi/SvnBrowseCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/SvnCatCommandTest.java | 33 ++++++++++--------- .../scm/repository/spi/SvnLogCommandTest.java | 33 ++++++++++--------- .../main/java/sonia/scm/cache/MapCache.java | 33 ++++++++++--------- .../java/sonia/scm/cache/MapCacheManager.java | 33 ++++++++++--------- .../spi/ZippedRepositoryTestBase.java | 33 ++++++++++--------- .../resources/RepositoryRootResource.java | 33 ++++++++++--------- .../api/rest/resources/SupportResource.java | 33 ++++++++++--------- .../scm/net/TrustAllHostnameVerifier.java | 33 ++++++++++--------- .../sonia/scm/net/TrustAllTrustManager.java | 33 ++++++++++--------- .../scm/plugin/DefaultProxySelector.java | 33 ++++++++++--------- .../web/cgi/DefaultCGIStatusCodeHandler.java | 33 ++++++++++--------- .../main/webapp/resources/js/sonia.core.js | 13 ++++---- .../sonia/scm/it/DeactivatedUserITCase.java | 33 ++++++++++--------- .../scm/selenium/AuthenticationITCase.java | 33 ++++++++++--------- .../scm/selenium/RepositoryCRUDITCase.java | 33 ++++++++++--------- .../sonia/scm/selenium/SeleniumTestBase.java | 33 ++++++++++--------- 71 files changed, 1200 insertions(+), 1100 deletions(-) diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/BooleanModifyOptionHandler.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/BooleanModifyOptionHandler.java index 76d2e350de..46d18badb6 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/BooleanModifyOptionHandler.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/BooleanModifyOptionHandler.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.cli; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java index 4f9d32712f..dd876e3093 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java index fc49dd43ec..8c3a642024 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java index 3431991c5a..cdfd711a87 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; /** diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java index bd25b578bf..4bf90ec1c6 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; /** diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java index 0de4157159..89d8099996 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorUtil.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java index dc25a1a5a2..c2c2c41b67 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryCacheKeyFilter.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java b/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java index 5a7ac8c4fb..98e714b67f 100644 --- a/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java +++ b/scm-core/src/test/java/sonia/scm/repository/RepositoryTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java index a788f1f8b0..dc26777f65 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java index f7d84cbedb..bc0d57bc91 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java index b6799f0612..3dc4eacd80 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBrowseCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java index ebc77abc89..17dad775b1 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitCatCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java index f53dfd718a..b003395e5a 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitContext.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java index 8b24eea53f..a8edfa8848 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitDiffCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index b7423a2940..cf2639b1cf 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java index 3a55da1237..097d72b6b8 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceProvider.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java index b6f922e07e..da46605cd7 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitRepositoryServiceResolver.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java index 98e2399c8f..496b71e656 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTestBase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java index 05649f64d8..953372020b 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBlameCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java index 70a55a1050..d891053f22 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitBrowseCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java index 2a8943f6f8..1a44a0076c 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitCatCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 0381b2d514..b0ab9b46ba 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java index 78017ada51..afe6a17ca1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersion.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java index 9291454272..e52eee2c8a 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgVersionHandler.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- JDK imports ------------------------------------------------------------ diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java index d758cad95a..26613150c1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java index 8e0f5c57c9..4c9d3f7f06 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBlameCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java index 91106c206d..56ce86734c 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgBrowseCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java index 955278f49e..69c012e52a 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgCatCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java index fb29820aee..8ec6d58367 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgDiffCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java index 7d39973597..d90211d437 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgLogCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java index c30ce79a28..ffcc0fe776 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java index 00981a2195..abdfd441e1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceResolver.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/web/HgCGIExceptionHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/web/HgCGIExceptionHandler.java index 5c67d147e9..c1e068b665 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/web/HgCGIExceptionHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/web/HgCGIExceptionHandler.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.web; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/version.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/version.py index c6cccc7c6d..b92504d338 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/version.py +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/version.py @@ -1,3 +1,34 @@ +# +# Copyright (c) 2010, Sebastian Sdorra +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# 3. Neither the name of SCM-Manager; nor the names of its +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# http://bitbucket.org/sdorra/scm-manager +# +# + import sys from mercurial import util from xml.dom.minidom import Document diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/web/cgimessages.properties b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/web/cgimessages.properties index 6fac1956dd..a42f82271d 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/web/cgimessages.properties +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/web/cgimessages.properties @@ -1,9 +1,10 @@ +# # Copyright (c) 2010, Sebastian Sdorra # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: -# +# # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, @@ -12,7 +13,7 @@ # 3. Neither the name of SCM-Manager; nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -23,9 +24,10 @@ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# +# # http://bitbucket.org/sdorra/scm-manager -# +# +# error.notConfigured = The mercurial installation on the scm-manager server seems to be not configured correctly. Please check the settings. error.statusCode = Mercurial/Python process ends with return code {0} diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java index 8c7a5b752d..4b0979da8d 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgContextProvider.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java index f36bf66c83..0e14d8e8ee 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/TempSCMContextProvider.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java index 3cf98402dd..fda5e14462 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/AbstractHgCommandTestBase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java index 9e34b36219..d55f6d6fce 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBlameCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java index 055d456221..e637e0c12a 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgBrowseCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java index 35e718bd44..45bfee8414 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java index a822d2ad01..aec477a6d7 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgLogCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java index 1060337cd0..0cc80a8e92 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/AbstractSvnCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java index 527d381eed..9c059d0ea5 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBlameCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java index d261a567f8..d1cea1a511 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBrowseCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java index 7ff45073cb..5acbe5966f 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnCatCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java index 478632c633..3a04ec1a2d 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnContext.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java index f4f6649e96..8990240223 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnDiffCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 57fcd4fe13..73ebe6727d 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java index f089d01216..eb260209dc 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceProvider.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java index c48866cd27..cf01df8f84 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnRepositoryServiceResolver.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnGZipFilter.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnGZipFilter.java index 0daa5d6af8..2267673e3f 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnGZipFilter.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnGZipFilter.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.web; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java index b8eee112c0..81b55e5db3 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/AbstractSvnCommandTestBase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java index 7585535716..e320dd3251 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBlameCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java index b346507fa5..e59b878d5c 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBrowseCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java index 2048c9dbb4..198a55edf3 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnCatCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java index 166305bb61..a3942bd0f4 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnLogCommandTest.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-test/src/main/java/sonia/scm/cache/MapCache.java b/scm-test/src/main/java/sonia/scm/cache/MapCache.java index dc479eeb02..24a0d7622c 100644 --- a/scm-test/src/main/java/sonia/scm/cache/MapCache.java +++ b/scm-test/src/main/java/sonia/scm/cache/MapCache.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.cache; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java b/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java index 799eac69a3..afc4580f99 100644 --- a/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java +++ b/scm-test/src/main/java/sonia/scm/cache/MapCacheManager.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.cache; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java b/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java index ba5b859f77..f42fb0993b 100644 --- a/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java +++ b/scm-test/src/main/java/sonia/scm/repository/spi/ZippedRepositoryTestBase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java index d3eb29042d..cc2b903ff3 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryRootResource.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java index b7a85d8c13..29f37b6b33 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java b/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java index 437216a3ca..2ffd2f4676 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java +++ b/scm-webapp/src/main/java/sonia/scm/net/TrustAllHostnameVerifier.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.net; //~--- JDK imports ------------------------------------------------------------ diff --git a/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java b/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java index 7f89682d30..e4d73aed31 100644 --- a/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java +++ b/scm-webapp/src/main/java/sonia/scm/net/TrustAllTrustManager.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.net; //~--- JDK imports ------------------------------------------------------------ diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultProxySelector.java b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultProxySelector.java index 616b5b9308..fd3ad16507 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultProxySelector.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultProxySelector.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.plugin; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/main/java/sonia/scm/web/cgi/DefaultCGIStatusCodeHandler.java b/scm-webapp/src/main/java/sonia/scm/web/cgi/DefaultCGIStatusCodeHandler.java index 3d5eee88cd..91531d9838 100644 --- a/scm-webapp/src/main/java/sonia/scm/web/cgi/DefaultCGIStatusCodeHandler.java +++ b/scm-webapp/src/main/java/sonia/scm/web/cgi/DefaultCGIStatusCodeHandler.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.web.cgi; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.core.js b/scm-webapp/src/main/webapp/resources/js/sonia.core.js index 474eb4c992..83732d10ae 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.core.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.core.js @@ -1,10 +1,10 @@ -/* * +/* * Copyright (c) 2010, Sebastian Sdorra * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, @@ -13,7 +13,7 @@ * 3. Neither the name of SCM-Manager; nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -24,12 +24,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * http://bitbucket.org/sdorra/scm-manager - * + * */ - String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; diff --git a/scm-webapp/src/test/java/sonia/scm/it/DeactivatedUserITCase.java b/scm-webapp/src/test/java/sonia/scm/it/DeactivatedUserITCase.java index b29c17b5a4..68fe13b201 100644 --- a/scm-webapp/src/test/java/sonia/scm/it/DeactivatedUserITCase.java +++ b/scm-webapp/src/test/java/sonia/scm/it/DeactivatedUserITCase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.it; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java index 73ef171c99..a2b0d0fe6d 100644 --- a/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java +++ b/scm-webapp/src/test/java/sonia/scm/selenium/AuthenticationITCase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.selenium; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java index f3e75ec46b..b3a97413a7 100644 --- a/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java +++ b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.selenium; //~--- non-JDK imports -------------------------------------------------------- diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java index 547332f386..1ae5e86b3d 100644 --- a/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java +++ b/scm-webapp/src/test/java/sonia/scm/selenium/SeleniumTestBase.java @@ -1,34 +1,35 @@ /** - * Copyright (c) 2010, Sebastian Sdorra All rights reserved. + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of SCM-Manager; - * nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://bitbucket.org/sdorra/scm-manager * */ - package sonia.scm.selenium; //~--- non-JDK imports -------------------------------------------------------- From 38502d21e1a52f3fbe49e8f79bd323176641cf83 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 19:05:11 +0200 Subject: [PATCH 120/159] clear cache after repository modification or deletion --- .../api/RepositoryServiceFactory.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index 8ec4da7f2b..1a3c075444 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -44,7 +44,7 @@ import com.google.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sonia.scm.Filter; +import sonia.scm.HandlerEvent; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; import sonia.scm.repository.BlameResult; @@ -55,9 +55,9 @@ import sonia.scm.repository.PermissionUtil; import sonia.scm.repository.PostReceiveRepositoryHook; import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; -import sonia.scm.repository.RepositoryCacheKey; import sonia.scm.repository.RepositoryCacheKeyFilter; import sonia.scm.repository.RepositoryHookEvent; +import sonia.scm.repository.RepositoryListener; import sonia.scm.repository.RepositoryManager; import sonia.scm.repository.RepositoryNotFoundException; import sonia.scm.repository.spi.RepositoryServiceProvider; @@ -142,7 +142,11 @@ public final class RepositoryServiceFactory this.securityContextProvider = securityContextProvider; this.resolvers = resolvers; this.preProcessorUtil = preProcessorUtil; - repositoryManager.addHook(new CacheClearHook(cacheManager)); + + CacheClearHook cch = new CacheClearHook(cacheManager); + + repositoryManager.addHook(cch); + repositoryManager.addListener(cch); } //~--- methods -------------------------------------------------------------- @@ -285,6 +289,7 @@ public final class RepositoryServiceFactory * @author Enter your name here... */ private static class CacheClearHook extends PostReceiveRepositoryHook + implements RepositoryListener { /** @@ -328,6 +333,22 @@ public final class RepositoryServiceFactory } } + /** + * Method description + * + * + * @param repository + * @param event + */ + @Override + public void onEvent(Repository repository, HandlerEvent event) + { + if ((event == HandlerEvent.MODIFY) || (event == HandlerEvent.DELETE)) + { + clearCaches(repository.getId()); + } + } + /** * Method description * From 19f437d65b76d755c0d764171fa315ed53f4721d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 19:19:45 +0200 Subject: [PATCH 121/159] return a clone of blame result to fix pre processor behavior --- .../java/sonia/scm/repository/BlameLine.java | 27 ++++++++++++++++- .../sonia/scm/repository/BlameResult.java | 29 +++++++++++++++++-- .../repository/api/BlameCommandBuilder.java | 2 ++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java index 7d60e6e9f6..9988287b87 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java @@ -43,7 +43,7 @@ import com.google.common.base.Objects; * @author Sebastian Sdorra * @since 1.8 */ -public class BlameLine +public class BlameLine implements Cloneable { /** @@ -77,6 +77,31 @@ public class BlameLine //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link BlameLine} object. + * + * + * @return clone of this {@link BlameLine} + * + * @since 1.17 + */ + @Override + public BlameLine clone() + { + BlameLine blameLine = null; + + try + { + blameLine = (BlameLine) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return blameLine; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index 08b6664ac3..8f3280e5c4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -49,7 +49,7 @@ import javax.xml.bind.annotation.XmlRootElement; /** * Changeset information by line for a given file. - * + * * TODO for 2.0 implement {@link Iterable} * * @author Sebastian Sdorra @@ -57,7 +57,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "blame-result") @XmlAccessorType(XmlAccessType.FIELD) -public class BlameResult +public class BlameResult implements Cloneable { /** @@ -93,6 +93,31 @@ public class BlameResult //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link blameResult} object. + * + * + * @return clone of this {@link blameResult} + * + * @since 1.17 + */ + @Override + public BlameResult clone() + { + BlameResult blameResult = null; + + try + { + blameResult = (BlameResult) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return blameResult; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index aadff564a2..7863613963 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -188,6 +188,8 @@ public final class BlameCommandBuilder if (!disablePreProcessors && (result != null)) { + // clone result to fix pre processor behavior + result = result.clone(); preProcessorUtil.prepareForReturn(repository, result); } From 05bc3946a3e6270189ea4830fbf5f2297fd20bde Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 19:27:44 +0200 Subject: [PATCH 122/159] return a clone of changeset paging result to fix pre processor behavior --- .../sonia/scm/repository/BlameResult.java | 4 +-- .../java/sonia/scm/repository/Changeset.java | 21 +++++++++------ .../scm/repository/ChangesetPagingResult.java | 27 ++++++++++++++++++- .../sonia/scm/repository/Modifications.java | 27 ++++++++++++++++++- .../scm/repository/api/LogCommandBuilder.java | 2 ++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index 8f3280e5c4..d4581dae84 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -94,10 +94,10 @@ public class BlameResult implements Cloneable //~--- methods -------------------------------------------------------------- /** - * Create a clone of this {@link blameResult} object. + * Create a clone of this {@link BlameResult} object. * * - * @return clone of this {@link blameResult} + * @return clone of this {@link BlameResult} * * @since 1.17 */ diff --git a/scm-core/src/main/java/sonia/scm/repository/Changeset.java b/scm-core/src/main/java/sonia/scm/repository/Changeset.java index 3fb89a064e..20eadd1ac3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Changeset.java +++ b/scm-core/src/main/java/sonia/scm/repository/Changeset.java @@ -109,21 +109,26 @@ public class Changeset extends BasicPropertiesAware //~--- methods -------------------------------------------------------------- /** - * {@inheritDoc} + * Create a clone of this {@link Changeset} object. * * - * @return + * @return clone of this {@link Changeset} + * + * @since 1.17 */ @Override public Changeset clone() { - Changeset changeset = new Changeset(id, date, author, description); + Changeset changeset = null; - changeset.setBranches(branches); - changeset.setTags(tags); - changeset.setModifications(modifications); - changeset.setProperties(properties); - changeset.setParents(parents); + try + { + changeset = (Changeset) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } return changeset; } diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java index d4a105d22b..15096e792f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java @@ -50,7 +50,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "changeset-paging") @XmlAccessorType(XmlAccessType.FIELD) -public class ChangesetPagingResult implements Iterable +public class ChangesetPagingResult implements Iterable, Cloneable { /** @@ -74,6 +74,31 @@ public class ChangesetPagingResult implements Iterable //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link ChangesetPagingResult} object. + * + * + * @return clone of this {@link ChangesetPagingResult} + * + * @since 1.17 + */ + @Override + public ChangesetPagingResult clone() + { + ChangesetPagingResult changesetPagingResult = null; + + try + { + changesetPagingResult = (ChangesetPagingResult) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return changesetPagingResult; + } + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/repository/Modifications.java b/scm-core/src/main/java/sonia/scm/repository/Modifications.java index 5ce5779031..33571b28d2 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Modifications.java +++ b/scm-core/src/main/java/sonia/scm/repository/Modifications.java @@ -58,7 +58,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "modifications") -public class Modifications implements Serializable +public class Modifications implements Cloneable, Serializable { /** Field description */ @@ -113,6 +113,31 @@ public class Modifications implements Serializable //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link Modifications} object. + * + * + * @return clone of this {@link Modifications} + * + * @since 1.17 + */ + @Override + public Modifications clone() + { + Modifications modifications = null; + + try + { + modifications = (Modifications) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return modifications; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index bfa337ea6f..951f46763a 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -214,6 +214,7 @@ public final class LogCommandBuilder if (!disablePreProcessors && (changeset != null)) { + changeset = changeset.clone(); preProcessorUtil.prepareForReturn(repository, changeset); } @@ -271,6 +272,7 @@ public final class LogCommandBuilder if (!disablePreProcessors && (cpr != null)) { + cpr = cpr.clone(); preProcessorUtil.prepareForReturn(repository, cpr); } From 554dcd4ffb60bbe8aab2886d3aeefd0e1fa1c70f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 19:37:03 +0200 Subject: [PATCH 123/159] return a clone of browser result to fix pre processor behavior --- .../sonia/scm/repository/BrowserResult.java | 27 ++++++++++++++++++- .../java/sonia/scm/repository/FileObject.java | 25 +++++++++++++++++ .../java/sonia/scm/repository/Person.java | 27 ++++++++++++++++++- .../sonia/scm/repository/SubRepository.java | 27 ++++++++++++++++++- .../repository/api/BrowseCommandBuilder.java | 1 + 5 files changed, 104 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java index 7230b2ab48..dbcf1cf91f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java @@ -55,7 +55,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "browser-result") -public class BrowserResult implements Iterable +public class BrowserResult implements Iterable, Cloneable { /** @@ -84,6 +84,31 @@ public class BrowserResult implements Iterable //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link BrowserResult} object. + * + * + * @return clone of this {@link BrowserResult} + * + * @since 1.17 + */ + @Override + public BrowserResult clone() + { + BrowserResult browserResult = null; + + try + { + browserResult = (BrowserResult) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return browserResult; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObject.java b/scm-core/src/main/java/sonia/scm/repository/FileObject.java index 089ac48361..27c03d22c9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObject.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObject.java @@ -56,6 +56,31 @@ import javax.xml.bind.annotation.XmlRootElement; public class FileObject implements LastModifiedAware { + /** + * Create a clone of this {@link FileObject} object. + * + * + * @return clone of this {@link FileObject} + * + * @since 1.17 + */ + @Override + public FileObject clone() + { + FileObject fileObject = null; + + try + { + fileObject = (FileObject) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return fileObject; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/Person.java b/scm-core/src/main/java/sonia/scm/repository/Person.java index 29ea5b3d5b..74f44317c9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Person.java +++ b/scm-core/src/main/java/sonia/scm/repository/Person.java @@ -56,7 +56,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "person") @XmlAccessorType(XmlAccessType.FIELD) -public class Person implements Validateable, Serializable +public class Person implements Validateable, Serializable, Cloneable { /** Field description */ @@ -130,6 +130,31 @@ public class Person implements Validateable, Serializable return person; } + /** + * Create a clone of this {@link Person} object. + * + * + * @return clone of this {@link Person} + * + * @since 1.17 + */ + @Override + public Person clone() + { + Person person = null; + + try + { + person = (Person) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return person; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java index a00784cae3..572a92dd05 100644 --- a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java +++ b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java @@ -50,7 +50,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "subrepository") @XmlAccessorType(XmlAccessType.FIELD) -public class SubRepository +public class SubRepository implements Cloneable { /** @@ -100,6 +100,31 @@ public class SubRepository //~--- methods -------------------------------------------------------------- + /** + * Create a clone of this {@link SubRepository} object. + * + * + * @return clone of this {@link SubRepository} + * + * @since 1.17 + */ + @Override + public SubRepository clone() + { + SubRepository subRepository = null; + + try + { + subRepository = (SubRepository) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return subRepository; + } + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 053ef06ac9..bb78e4a661 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -184,6 +184,7 @@ public final class BrowseCommandBuilder if (!disablePreProcessors && (result != null)) { + result = result.clone(); preProcessorUtil.prepareForReturn(repository, result); List fileObjects = result.getFiles(); From 826d7833db080a3e89550de1e698741176935575 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 24 Jun 2012 19:52:59 +0200 Subject: [PATCH 124/159] revert cloning of command results for performance reasons --- .../main/java/sonia/scm/repository/api/BlameCommandBuilder.java | 2 -- .../java/sonia/scm/repository/api/BrowseCommandBuilder.java | 1 - .../main/java/sonia/scm/repository/api/LogCommandBuilder.java | 2 -- 3 files changed, 5 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index 7863613963..aadff564a2 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -188,8 +188,6 @@ public final class BlameCommandBuilder if (!disablePreProcessors && (result != null)) { - // clone result to fix pre processor behavior - result = result.clone(); preProcessorUtil.prepareForReturn(repository, result); } diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index bb78e4a661..053ef06ac9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -184,7 +184,6 @@ public final class BrowseCommandBuilder if (!disablePreProcessors && (result != null)) { - result = result.clone(); preProcessorUtil.prepareForReturn(repository, result); List fileObjects = result.getFiles(); diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index 951f46763a..bfa337ea6f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -214,7 +214,6 @@ public final class LogCommandBuilder if (!disablePreProcessors && (changeset != null)) { - changeset = changeset.clone(); preProcessorUtil.prepareForReturn(repository, changeset); } @@ -272,7 +271,6 @@ public final class LogCommandBuilder if (!disablePreProcessors && (cpr != null)) { - cpr = cpr.clone(); preProcessorUtil.prepareForReturn(repository, cpr); } From ddb1af8ec8c905bbaf1be2121e04b77d674b5f1d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 25 Jun 2012 16:30:41 +0200 Subject: [PATCH 125/159] improve reset methods --- .../java/sonia/scm/repository/api/BlameCommandBuilder.java | 4 +++- .../java/sonia/scm/repository/api/BrowseCommandBuilder.java | 2 ++ .../main/java/sonia/scm/repository/api/LogCommandBuilder.java | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index aadff564a2..fe22dc933a 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -122,6 +122,8 @@ public final class BlameCommandBuilder public BlameCommandBuilder reset() { request.reset(); + this.disableCache = false; + this.disablePreProcessors = false; return this; } @@ -343,7 +345,7 @@ public final class BlameCommandBuilder private Cache cache; /** disable change */ - private boolean disableCache; + private boolean disableCache = false; /** disable the execution of pre processors */ private boolean disablePreProcessors = false; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 053ef06ac9..33cf1786ec 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -126,6 +126,8 @@ public final class BrowseCommandBuilder public BrowseCommandBuilder reset() { request.reset(); + this.disableCache = false; + this.disablePreProcessors = false; return this; } diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index bfa337ea6f..6d0cb60021 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -47,6 +47,7 @@ import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; import sonia.scm.repository.PreProcessorUtil; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryCacheKey; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.LogCommand; import sonia.scm.repository.spi.LogCommandRequest; @@ -55,7 +56,6 @@ import sonia.scm.repository.spi.LogCommandRequest; import java.io.IOException; import java.io.Serializable; -import sonia.scm.repository.RepositoryCacheKey; /** * LogCommandBuilder is able to show the history of a file in a @@ -149,6 +149,8 @@ public final class LogCommandBuilder public LogCommandBuilder reset() { request.reset(); + this.disableCache = false; + this.disablePreProcessors = false; return this; } From 644b44f5311455fe720ce5e79d01b6ac14b7c181 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:13:38 +0200 Subject: [PATCH 126/159] remove invalid clone methods --- .../java/sonia/scm/repository/BlameLine.java | 27 +---------------- .../sonia/scm/repository/BlameResult.java | 27 +---------------- .../sonia/scm/repository/BrowserResult.java | 27 +---------------- .../java/sonia/scm/repository/Changeset.java | 27 +---------------- .../scm/repository/ChangesetPagingResult.java | 27 +---------------- .../java/sonia/scm/repository/FileObject.java | 25 ---------------- .../sonia/scm/repository/Modifications.java | 27 +---------------- .../java/sonia/scm/repository/Person.java | 27 +---------------- .../sonia/scm/repository/SubRepository.java | 29 ++----------------- 9 files changed, 9 insertions(+), 234 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java index 9988287b87..7d60e6e9f6 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java @@ -43,7 +43,7 @@ import com.google.common.base.Objects; * @author Sebastian Sdorra * @since 1.8 */ -public class BlameLine implements Cloneable +public class BlameLine { /** @@ -77,31 +77,6 @@ public class BlameLine implements Cloneable //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link BlameLine} object. - * - * - * @return clone of this {@link BlameLine} - * - * @since 1.17 - */ - @Override - public BlameLine clone() - { - BlameLine blameLine = null; - - try - { - blameLine = (BlameLine) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return blameLine; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index d4581dae84..9a9e59b631 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -57,7 +57,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "blame-result") @XmlAccessorType(XmlAccessType.FIELD) -public class BlameResult implements Cloneable +public class BlameResult { /** @@ -93,31 +93,6 @@ public class BlameResult implements Cloneable //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link BlameResult} object. - * - * - * @return clone of this {@link BlameResult} - * - * @since 1.17 - */ - @Override - public BlameResult clone() - { - BlameResult blameResult = null; - - try - { - blameResult = (BlameResult) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return blameResult; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java index dbcf1cf91f..7230b2ab48 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java @@ -55,7 +55,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "browser-result") -public class BrowserResult implements Iterable, Cloneable +public class BrowserResult implements Iterable { /** @@ -84,31 +84,6 @@ public class BrowserResult implements Iterable, Cloneable //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link BrowserResult} object. - * - * - * @return clone of this {@link BrowserResult} - * - * @since 1.17 - */ - @Override - public BrowserResult clone() - { - BrowserResult browserResult = null; - - try - { - browserResult = (BrowserResult) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return browserResult; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/Changeset.java b/scm-core/src/main/java/sonia/scm/repository/Changeset.java index 20eadd1ac3..379582c8c8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Changeset.java +++ b/scm-core/src/main/java/sonia/scm/repository/Changeset.java @@ -62,7 +62,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "changeset") @XmlAccessorType(XmlAccessType.FIELD) public class Changeset extends BasicPropertiesAware - implements Validateable, Cloneable, Serializable + implements Validateable, Serializable { /** Field description */ @@ -108,31 +108,6 @@ public class Changeset extends BasicPropertiesAware //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link Changeset} object. - * - * - * @return clone of this {@link Changeset} - * - * @since 1.17 - */ - @Override - public Changeset clone() - { - Changeset changeset = null; - - try - { - changeset = (Changeset) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return changeset; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java index 15096e792f..d4a105d22b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java @@ -50,7 +50,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "changeset-paging") @XmlAccessorType(XmlAccessType.FIELD) -public class ChangesetPagingResult implements Iterable, Cloneable +public class ChangesetPagingResult implements Iterable { /** @@ -74,31 +74,6 @@ public class ChangesetPagingResult implements Iterable, Cloneable //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link ChangesetPagingResult} object. - * - * - * @return clone of this {@link ChangesetPagingResult} - * - * @since 1.17 - */ - @Override - public ChangesetPagingResult clone() - { - ChangesetPagingResult changesetPagingResult = null; - - try - { - changesetPagingResult = (ChangesetPagingResult) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return changesetPagingResult; - } - /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObject.java b/scm-core/src/main/java/sonia/scm/repository/FileObject.java index 27c03d22c9..089ac48361 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObject.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObject.java @@ -56,31 +56,6 @@ import javax.xml.bind.annotation.XmlRootElement; public class FileObject implements LastModifiedAware { - /** - * Create a clone of this {@link FileObject} object. - * - * - * @return clone of this {@link FileObject} - * - * @since 1.17 - */ - @Override - public FileObject clone() - { - FileObject fileObject = null; - - try - { - fileObject = (FileObject) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return fileObject; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/Modifications.java b/scm-core/src/main/java/sonia/scm/repository/Modifications.java index 33571b28d2..5ce5779031 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Modifications.java +++ b/scm-core/src/main/java/sonia/scm/repository/Modifications.java @@ -58,7 +58,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "modifications") -public class Modifications implements Cloneable, Serializable +public class Modifications implements Serializable { /** Field description */ @@ -113,31 +113,6 @@ public class Modifications implements Cloneable, Serializable //~--- methods -------------------------------------------------------------- - /** - * Create a clone of this {@link Modifications} object. - * - * - * @return clone of this {@link Modifications} - * - * @since 1.17 - */ - @Override - public Modifications clone() - { - Modifications modifications = null; - - try - { - modifications = (Modifications) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return modifications; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/Person.java b/scm-core/src/main/java/sonia/scm/repository/Person.java index 74f44317c9..29ea5b3d5b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/Person.java +++ b/scm-core/src/main/java/sonia/scm/repository/Person.java @@ -56,7 +56,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "person") @XmlAccessorType(XmlAccessType.FIELD) -public class Person implements Validateable, Serializable, Cloneable +public class Person implements Validateable, Serializable { /** Field description */ @@ -130,31 +130,6 @@ public class Person implements Validateable, Serializable, Cloneable return person; } - /** - * Create a clone of this {@link Person} object. - * - * - * @return clone of this {@link Person} - * - * @since 1.17 - */ - @Override - public Person clone() - { - Person person = null; - - try - { - person = (Person) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return person; - } - /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java index 572a92dd05..de80720815 100644 --- a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java +++ b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java @@ -50,7 +50,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "subrepository") @XmlAccessorType(XmlAccessType.FIELD) -public class SubRepository implements Cloneable +public class SubRepository { /** @@ -99,32 +99,7 @@ public class SubRepository implements Cloneable } //~--- methods -------------------------------------------------------------- - - /** - * Create a clone of this {@link SubRepository} object. - * - * - * @return clone of this {@link SubRepository} - * - * @since 1.17 - */ - @Override - public SubRepository clone() - { - SubRepository subRepository = null; - - try - { - subRepository = (SubRepository) super.clone(); - } - catch (CloneNotSupportedException ex) - { - throw new RuntimeException(ex); - } - - return subRepository; - } - + /** * {@inheritDoc} * From ee0e34341db3864becc8cf90be615f42907b5d70 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:18:59 +0200 Subject: [PATCH 127/159] implement serializable interface for cacheable objects --- .../src/main/java/sonia/scm/repository/BlameLine.java | 11 ++++++++++- .../main/java/sonia/scm/repository/BlameResult.java | 9 ++++++++- .../main/java/sonia/scm/repository/BrowserResult.java | 9 ++++++++- .../sonia/scm/repository/ChangesetPagingResult.java | 9 ++++++++- .../main/java/sonia/scm/repository/FileObject.java | 9 ++++++++- .../main/java/sonia/scm/repository/SubRepository.java | 11 +++++++++-- 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java index 7d60e6e9f6..ff23ca8fd3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLine.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLine.java @@ -37,15 +37,24 @@ package sonia.scm.repository; import com.google.common.base.Objects; +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + /** * Single line of a file, in a {@link BlameResult}. * * @author Sebastian Sdorra * @since 1.8 */ -public class BlameLine +public class BlameLine implements Serializable { + /** Field description */ + private static final long serialVersionUID = 2816601606921153670L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index 9a9e59b631..9dd0dc36f4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -39,6 +39,8 @@ import com.google.common.base.Objects; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import java.util.List; import javax.xml.bind.annotation.XmlAccessType; @@ -57,9 +59,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "blame-result") @XmlAccessorType(XmlAccessType.FIELD) -public class BlameResult +public class BlameResult implements Serializable { + /** Field description */ + private static final long serialVersionUID = -8606237881465520606L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java index 7230b2ab48..7880b58f11 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BrowserResult.java @@ -39,6 +39,8 @@ import com.google.common.base.Objects; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import java.util.Iterator; import java.util.List; @@ -55,9 +57,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "browser-result") -public class BrowserResult implements Iterable +public class BrowserResult implements Iterable, Serializable { + /** Field description */ + private static final long serialVersionUID = 2818662048045182761L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java index d4a105d22b..2b1b455939 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPagingResult.java @@ -35,6 +35,8 @@ package sonia.scm.repository; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import java.util.Iterator; import java.util.List; @@ -50,9 +52,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "changeset-paging") @XmlAccessorType(XmlAccessType.FIELD) -public class ChangesetPagingResult implements Iterable +public class ChangesetPagingResult implements Iterable, Serializable { + /** Field description */ + private static final long serialVersionUID = -8678755403658841733L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObject.java b/scm-core/src/main/java/sonia/scm/repository/FileObject.java index 089ac48361..df6576464d 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObject.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObject.java @@ -41,6 +41,8 @@ import sonia.scm.LastModifiedAware; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -53,9 +55,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "file") @XmlAccessorType(XmlAccessType.FIELD) -public class FileObject implements LastModifiedAware +public class FileObject implements LastModifiedAware, Serializable { + /** Field description */ + private static final long serialVersionUID = -5562537629609891499L; + + //~--- methods -------------------------------------------------------------- + /** * {@inheritDoc} * diff --git a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java index de80720815..3c8acc4831 100644 --- a/scm-core/src/main/java/sonia/scm/repository/SubRepository.java +++ b/scm-core/src/main/java/sonia/scm/repository/SubRepository.java @@ -39,6 +39,8 @@ import com.google.common.base.Objects; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -50,9 +52,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "subrepository") @XmlAccessorType(XmlAccessType.FIELD) -public class SubRepository +public class SubRepository implements Serializable { + /** Field description */ + private static final long serialVersionUID = 6960065820378492531L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -99,7 +106,7 @@ public class SubRepository } //~--- methods -------------------------------------------------------------- - + /** * {@inheritDoc} * From f9affd47b8c41963c1328a45862c5ffb3f57f47a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:20:31 +0200 Subject: [PATCH 128/159] implement iterable interface --- .../sonia/scm/repository/BlameResult.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java index 9dd0dc36f4..3acb4928b1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameResult.java @@ -36,11 +36,13 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- import com.google.common.base.Objects; +import com.google.common.collect.Lists; //~--- JDK imports ------------------------------------------------------------ import java.io.Serializable; +import java.util.Iterator; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; @@ -59,7 +61,7 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "blame-result") @XmlAccessorType(XmlAccessType.FIELD) -public class BlameResult implements Serializable +public class BlameResult implements Serializable, Iterable { /** Field description */ @@ -139,6 +141,20 @@ public class BlameResult implements Serializable return Objects.hashCode(total, blameLines); } + /** + * Method description + * + * + * @return + * + * @since 1.17 + */ + @Override + public Iterator iterator() + { + return getBlameLines().iterator(); + } + /** * {@inheritDoc} * @@ -166,6 +182,9 @@ public class BlameResult implements Serializable */ public List getBlameLines() { + if ( blameLines == null ){ + blameLines = Lists.newArrayList(); + } return blameLines; } From 28ace74f5b4d167092be5641eb3a0606d8f0f440 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:28:18 +0200 Subject: [PATCH 129/159] fix possible npe --- scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java index 6b3e62695e..ee8ea815b4 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java @@ -35,6 +35,7 @@ package sonia.scm.web.filter; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.Closeables; import com.google.inject.Singleton; import org.slf4j.Logger; @@ -239,7 +240,7 @@ public class LoggingFilter extends HttpFilter } finally { - out.close(); + Closeables.closeQuietly(out); } logger.trace("Content: ".concat(new String(content))); From c3190de79ee2388f346a0d1cbff0bb595df68694 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:29:07 +0200 Subject: [PATCH 130/159] fix unused command field --- .../sonia/scm/repository/api/CommandNotSupportedException.java | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java index ddf1cc7b21..3b51254659 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java @@ -71,6 +71,7 @@ public final class CommandNotSupportedException extends RuntimeException public CommandNotSupportedException(Command command, String message) { super(message); + this.command = command; } //~--- get methods ---------------------------------------------------------- From d983cbf88b25c913d42ff2e0f05769ae8f196910 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:33:35 +0200 Subject: [PATCH 131/159] fix non serializable fields in serializable object --- .../main/java/sonia/scm/plugin/PluginCondition.java | 9 ++++++++- .../main/java/sonia/scm/plugin/PluginInformation.java | 9 ++++++++- .../main/java/sonia/scm/plugin/PluginRepository.java | 11 ++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/plugin/PluginCondition.java b/scm-core/src/main/java/sonia/scm/plugin/PluginCondition.java index 11198ae3f8..7cae04f45c 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/PluginCondition.java +++ b/scm-core/src/main/java/sonia/scm/plugin/PluginCondition.java @@ -42,6 +42,8 @@ import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import java.util.ArrayList; import java.util.List; @@ -57,9 +59,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement(name = "conditions") @XmlAccessorType(XmlAccessType.FIELD) -public class PluginCondition implements Cloneable +public class PluginCondition implements Cloneable, Serializable { + /** Field description */ + private static final long serialVersionUID = 2406156062634968672L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java b/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java index 4031def5a1..47363b9895 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java +++ b/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java @@ -40,6 +40,8 @@ import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ +import java.io.Serializable; + import java.util.ArrayList; import java.util.List; @@ -55,9 +57,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "plugin-information") -public class PluginInformation implements Validateable, Cloneable +public class PluginInformation implements Validateable, Cloneable, Serializable { + /** Field description */ + private static final long serialVersionUID = 461382048865977206L; + + //~--- methods -------------------------------------------------------------- + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/plugin/PluginRepository.java b/scm-core/src/main/java/sonia/scm/plugin/PluginRepository.java index 3ea5f40186..eba67110c5 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/PluginRepository.java +++ b/scm-core/src/main/java/sonia/scm/plugin/PluginRepository.java @@ -33,13 +33,22 @@ package sonia.scm.plugin; +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + /** * * @author Sebastian Sdorra */ -public class PluginRepository +public class PluginRepository implements Serializable { + /** Field description */ + private static final long serialVersionUID = -9504354306304731L; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * From 517ddc29a0b54642936e29a810e10c6a1486618f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:49:57 +0200 Subject: [PATCH 132/159] do not clear cache on repository modification only on deletion --- .../java/sonia/scm/repository/api/RepositoryServiceFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index 1a3c075444..7718c04a97 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -343,7 +343,7 @@ public final class RepositoryServiceFactory @Override public void onEvent(Repository repository, HandlerEvent event) { - if ((event == HandlerEvent.MODIFY) || (event == HandlerEvent.DELETE)) + if (event == HandlerEvent.DELETE) { clearCaches(repository.getId()); } From 76baa8518744f3cf27dcd1a70a468a00bfcf4eee Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 08:51:16 +0200 Subject: [PATCH 133/159] use copy on read for repository api caches to fix reference problems with pre processor api --- scm-webapp/src/main/resources/config/ehcache.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scm-webapp/src/main/resources/config/ehcache.xml b/scm-webapp/src/main/resources/config/ehcache.xml index 1b238d046d..beb3b7f862 100644 --- a/scm-webapp/src/main/resources/config/ehcache.xml +++ b/scm-webapp/src/main/resources/config/ehcache.xml @@ -161,6 +161,8 @@ diskPersistent="false" /> + + From 04939d5a4d2bdc1b97ae2b78e3451be63e1a138a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 21:25:57 +0200 Subject: [PATCH 134/159] update jgit to version 2.0.0.201206130900-r --- pom.xml | 2 +- .../sonia/scm/repository/GitBlameViewer.java | 18 ++-- .../scm/repository/GitChangesetViewer.java | 9 ++ .../scm/repository/spi/GitBlameCommand.java | 98 +++++++++++-------- .../scm/repository/spi/GitLogCommand.java | 10 +- .../sonia/scm/web/GitRepositoryViewer.java | 29 ++++-- .../scm/repository/spi/GitLogCommandTest.java | 17 +++- 7 files changed, 121 insertions(+), 62 deletions(-) diff --git a/pom.xml b/pom.xml index 3718ca746d..05d787f5bb 100644 --- a/pom.xml +++ b/pom.xml @@ -401,7 +401,7 @@ 7.6.4.v20120524 - 1.3.0.201202151440-r + 2.0.0.201206130900-r 1.7.5-1 diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitBlameViewer.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitBlameViewer.java index c6cf493433..6e575db31f 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitBlameViewer.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitBlameViewer.java @@ -37,6 +37,7 @@ package sonia.scm.repository; import org.eclipse.jgit.api.BlameCommand; import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.blame.BlameResult; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; @@ -123,20 +124,19 @@ public class GitBlameViewer implements BlameViewer List blameLines = new ArrayList(); int total = gitBlameResult.getResultContents().size(); int i = 0; - + for (; i < total; i++) { - RevCommit commit = gitBlameResult.getSourceCommit(i); - - if ( commit != null ) - { + RevCommit commit = gitBlameResult.getSourceCommit(i); + + if (commit != null) + { PersonIdent author = gitBlameResult.getSourceAuthor(i); BlameLine blameLine = new BlameLine(); blameLine.setLineNumber(i + 1); blameLine.setAuthor(new Person(author.getName(), author.getEmailAddress())); - blameLine.setDescription(commit.getShortMessage()); long when = GitUtil.getCommitTime(commit); @@ -151,7 +151,7 @@ public class GitBlameViewer implements BlameViewer blameLine.setCode(content); blameLines.add(blameLine); - } + } } blameResult = new sonia.scm.repository.BlameResult(i, blameLines); @@ -160,6 +160,10 @@ public class GitBlameViewer implements BlameViewer { logger.error("could not open repository", ex); } + catch (GitAPIException ex) + { + logger.error("could not create blame view", ex); + } return blameResult; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetViewer.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetViewer.java index 30ef4111c6..4fdb4713bd 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetViewer.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetViewer.java @@ -36,6 +36,7 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.revwalk.RevCommit; @@ -198,6 +199,10 @@ public class GitChangesetViewer implements ChangesetViewer { logger.error("could not read changesets", ex); } + catch (GitAPIException ex) + { + logger.error("could not read changesets", ex); + } catch (IOException ex) { logger.error("could not open repository", ex); @@ -279,6 +284,10 @@ public class GitChangesetViewer implements ChangesetViewer { logger.error("could not read changesets", ex); } + catch (GitAPIException ex) + { + logger.error("could not read changesets", ex); + } catch (IOException ex) { logger.error("could not open repository", ex); diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java index bc0d57bc91..a48b4b2b1e 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBlameCommand.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -38,6 +39,7 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.revwalk.RevCommit; @@ -113,56 +115,68 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand Preconditions.checkArgument(!Strings.isNullOrEmpty(request.getPath()), "path is empty or null"); - org.eclipse.jgit.lib.Repository gr = open(); - org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame(); + BlameResult result = null; - blame.setFilePath(request.getPath()); - - ObjectId revId = GitUtil.getRevisionId(gr, request.getRevision()); - - blame.setStartCommit(revId); - - org.eclipse.jgit.blame.BlameResult gitBlameResult = blame.call(); - - if (gitBlameResult == null) + try { - throw new RepositoryException( - "could not create blame result for path ".concat(request.getPath())); - } + org.eclipse.jgit.lib.Repository gr = open(); + org.eclipse.jgit.api.BlameCommand blame = new Git(gr).blame(); - List blameLines = new ArrayList(); - int total = gitBlameResult.getResultContents().size(); - int i = 0; + blame.setFilePath(request.getPath()); - for (; i < total; i++) - { - RevCommit commit = gitBlameResult.getSourceCommit(i); + ObjectId revId = GitUtil.getRevisionId(gr, request.getRevision()); - if (commit != null) + blame.setStartCommit(revId); + + org.eclipse.jgit.blame.BlameResult gitBlameResult = blame.call(); + + if (gitBlameResult == null) { - PersonIdent author = gitBlameResult.getSourceAuthor(i); - BlameLine blameLine = new BlameLine(); - - blameLine.setLineNumber(i + 1); - blameLine.setAuthor(new Person(author.getName(), - author.getEmailAddress())); - blameLine.setDescription(commit.getShortMessage()); - - long when = GitUtil.getCommitTime(commit); - - blameLine.setWhen(when); - - String rev = commit.getId().getName(); - - blameLine.setRevision(rev); - - String content = gitBlameResult.getResultContents().getString(i); - - blameLine.setCode(content); - blameLines.add(blameLine); + throw new RepositoryException( + "could not create blame result for path ".concat( + request.getPath())); } + + List blameLines = new ArrayList(); + int total = gitBlameResult.getResultContents().size(); + int i = 0; + + for (; i < total; i++) + { + RevCommit commit = gitBlameResult.getSourceCommit(i); + + if (commit != null) + { + PersonIdent author = gitBlameResult.getSourceAuthor(i); + BlameLine blameLine = new BlameLine(); + + blameLine.setLineNumber(i + 1); + blameLine.setAuthor(new Person(author.getName(), + author.getEmailAddress())); + blameLine.setDescription(commit.getShortMessage()); + + long when = GitUtil.getCommitTime(commit); + + blameLine.setWhen(when); + + String rev = commit.getId().getName(); + + blameLine.setRevision(rev); + + String content = gitBlameResult.getResultContents().getString(i); + + blameLine.setCode(content); + blameLines.add(blameLine); + } + } + + result = new BlameResult(i, blameLines); + } + catch (GitAPIException ex) + { + throw new RepositoryException("could not create blame view", ex); } - return new sonia.scm.repository.BlameResult(i, blameLines); + return result; } } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index cf2639b1cf..6d7e3c908b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -38,6 +39,7 @@ import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Repository; @@ -51,6 +53,7 @@ import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; import sonia.scm.repository.GitChangesetConverter; import sonia.scm.repository.GitUtil; +import sonia.scm.repository.RepositoryException; import sonia.scm.util.IOUtil; //~--- JDK imports ------------------------------------------------------------ @@ -154,10 +157,11 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand * @return * * @throws IOException + * @throws RepositoryException */ @Override public ChangesetPagingResult getChangesets(LogCommandRequest request) - throws IOException + throws IOException, RepositoryException { if (logger.isDebugEnabled()) { @@ -257,6 +261,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand changesets = new ChangesetPagingResult(0, new ArrayList()); } + catch (GitAPIException ex) + { + throw new RepositoryException("could not create change log", ex); + } finally { IOUtil.close(converter); diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitRepositoryViewer.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitRepositoryViewer.java index 689a175ee2..857884a888 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitRepositoryViewer.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitRepositoryViewer.java @@ -38,12 +38,16 @@ package sonia.scm.web; import org.apache.commons.lang.StringEscapeUtils; import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.io.RegexResourceProcessor; import sonia.scm.io.ResourceProcessor; import sonia.scm.repository.GitUtil; @@ -75,6 +79,12 @@ public class GitRepositoryViewer /** Field description */ public static final String RESOURCE_GITINDEX = "/sonia/scm/git.index.html"; + /** + * the logger for GitRepositoryViewer + */ + private static final Logger logger = + LoggerFactory.getLogger(GitRepositoryViewer.class); + //~--- methods -------------------------------------------------------------- /** @@ -107,16 +117,23 @@ public class GitRepositoryViewer int c = 0; ObjectId head = GitUtil.getRepositoryHead(repository); - for (RevCommit commit : git.log().add(head).call()) + try { - appendCommit(sb, commit); - c++; - - if (c > logSize) + for (RevCommit commit : git.log().add(head).call()) { - break; + appendCommit(sb, commit); + c++; + + if (c > logSize) + { + break; + } } } + catch (GitAPIException ex) + { + logger.error("could not read changesets", ex); + } } processor.addVariable("commits", sb.toString()); diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index b0ab9b46ba..650a9e0c36 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -39,6 +40,7 @@ import org.junit.Test; import sonia.scm.repository.Changeset; import sonia.scm.repository.ChangesetPagingResult; import sonia.scm.repository.Modifications; +import sonia.scm.repository.RepositoryException; import static org.hamcrest.Matchers.*; @@ -60,9 +62,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase * * * @throws IOException + * @throws RepositoryException */ @Test - public void testGetAll() throws IOException + public void testGetAll() throws IOException, RepositoryException { ChangesetPagingResult result = createCommand().getChangesets(new LogCommandRequest()); @@ -77,9 +80,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase * * * @throws IOException + * @throws RepositoryException */ @Test - public void testGetAllByPath() throws IOException + public void testGetAllByPath() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); @@ -100,9 +104,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase * * * @throws IOException + * @throws RepositoryException */ @Test - public void testGetAllWithLimit() throws IOException + public void testGetAllWithLimit() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); @@ -130,9 +135,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase * * * @throws IOException + * @throws RepositoryException */ @Test - public void testGetAllWithPaging() throws IOException + public void testGetAllWithPaging() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); @@ -189,9 +195,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase * * * @throws IOException + * @throws RepositoryException */ @Test - public void testGetRange() throws IOException + public void testGetRange() throws IOException, RepositoryException { LogCommandRequest request = new LogCommandRequest(); From 758202568c14258007ce6eac2646eaf5c9f35452 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 21:29:14 +0200 Subject: [PATCH 135/159] fix not serializable cache exception --- .../src/main/java/sonia/scm/repository/spi/SvnLogCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java index 73ebe6727d..74b1eb5566 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java @@ -211,7 +211,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand start = 0; } - changesetList = changesetList.subList(start, end); + changesetList = Lists.newArrayList(changesetList.subList(start, end)); changesets = new ChangesetPagingResult(total, changesetList); } catch (NumberFormatException ex) From a0ea74f3747c98540b23588108878a4ef9292f25 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 26 Jun 2012 21:52:46 +0200 Subject: [PATCH 136/159] log scm-manager version on boot --- .../src/main/java/sonia/scm/boot/BootstrapListener.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/boot/BootstrapListener.java b/scm-webapp/src/main/java/sonia/scm/boot/BootstrapListener.java index c6f45f2bc3..6794e2aa98 100644 --- a/scm-webapp/src/main/java/sonia/scm/boot/BootstrapListener.java +++ b/scm-webapp/src/main/java/sonia/scm/boot/BootstrapListener.java @@ -39,6 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.SCMContext; +import sonia.scm.SCMContextProvider; //~--- JDK imports ------------------------------------------------------------ @@ -102,14 +103,16 @@ public class BootstrapListener implements ServletContextListener @Override public void contextInitialized(ServletContextEvent sce) { + SCMContextProvider context = SCMContext.getContext(); + if (logger.isInfoEnabled()) { - logger.info("start scm-manager in stage: {}", - SCMContext.getContext().getStage()); + logger.info("start scm-manager {} in stage: {}", context.getVersion(), + context.getStage()); } ClassLoader classLoader = null; - File pluginDirectory = new File(SCMContext.getContext().getBaseDirectory(), + File pluginDirectory = new File(context.getBaseDirectory(), PLUGIN_DIRECTORY); if (pluginDirectory.exists()) From a6bdc9b84da1fabb278c0d00c9773755f353011f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 09:11:48 +0200 Subject: [PATCH 137/159] delete repository after test creation --- .../test/java/sonia/scm/selenium/RepositoryCRUDITCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java index b3a97413a7..64760ae774 100644 --- a/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java +++ b/scm-webapp/src/test/java/sonia/scm/selenium/RepositoryCRUDITCase.java @@ -62,7 +62,7 @@ public class RepositoryCRUDITCase extends SeleniumTestBase * */ @Test - public void createRepository() + public void createRepository() throws InterruptedException { waitAndClick("#repositoryAddButton"); waitForPresence("input[name=name]").sendKeys("scm"); @@ -77,6 +77,9 @@ public class RepositoryCRUDITCase extends SeleniumTestBase "div.x-grid3-row-selected div.x-grid3-col-name").getText(); assertEquals("scm", name); + + waitAndClick("#repoRmButton button"); + waitAndClick("div.x-window button:nth-of-type(1)"); } /** From fdd7ae4000164116de7c1b043bf88497c17008e1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 15:04:27 +0200 Subject: [PATCH 138/159] added serialVersionUID for cache keys --- .../java/sonia/scm/repository/api/BlameCommandBuilder.java | 5 +++++ .../java/sonia/scm/repository/api/BrowseCommandBuilder.java | 5 +++++ .../java/sonia/scm/repository/api/DiffCommandBuilder.java | 4 ++-- .../java/sonia/scm/repository/api/LogCommandBuilder.java | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java index fe22dc933a..0d0b5158e1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BlameCommandBuilder.java @@ -258,6 +258,11 @@ public final class BlameCommandBuilder static class CacheKey implements RepositoryCacheKey, Serializable { + /** Field description */ + private static final long serialVersionUID = 8373766042131887789L; + + //~--- constructors ------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java index 33cf1786ec..e3eb0a0be9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java @@ -276,6 +276,11 @@ public final class BrowseCommandBuilder static class CacheKey implements RepositoryCacheKey, Serializable { + /** Field description */ + private static final long serialVersionUID = 8078650026812373524L; + + //~--- constructors ------------------------------------------------------- + /** * Constructs ... * diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java index 072a56b927..dfe874813e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java @@ -65,8 +65,8 @@ import java.io.OutputStream; * String content = diff.setRevision("33b93c443867").getContent(); * System.out.println(content); *
- * - * + * + * * TODO check current behavior. * * @author Sebastian Sdorra diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java index 6d0cb60021..e39c3ced14 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java @@ -402,6 +402,11 @@ public final class LogCommandBuilder static class CacheKey implements RepositoryCacheKey, Serializable { + /** Field description */ + private static final long serialVersionUID = 5701675009949268863L; + + //~--- constructors ------------------------------------------------------- + /** * Constructs ... * From 09b04278f7703ba3c7daaf9286757052c70801a3 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 15:16:34 +0200 Subject: [PATCH 139/159] added javadoc for blame line pre processor api --- .../java/sonia/scm/repository/BlameLinePreProcessor.java | 6 ++++-- .../scm/repository/BlameLinePreProcessorFactory.java | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java index dd876e3093..68141f5aaf 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessor.java @@ -37,6 +37,8 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * A pre processor for {@link BlameLine} objects. A pre processor is able to + * modify the object before it is delivered to the user interface. * * @author Sebastian Sdorra * @since 1.17 @@ -46,10 +48,10 @@ public interface BlameLinePreProcessor extends PreProcessor { /** - * Method description + * Process the given blame line. * * - * @param blameLine + * @param blameLine blame line to process. */ @Override public void process(BlameLine blameLine); diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java index 8c3a642024..8ff5b6e01c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameLinePreProcessorFactory.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- @@ -37,6 +38,8 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * The BlameLinePreProcessorFactory create {@link BlameLinePreProcessor} + * objects for a specific repository. * * @author Sebastian Sdorra * @since 1.17 @@ -47,12 +50,12 @@ public interface BlameLinePreProcessorFactory { /** - * Method description + * Create a new {@link BlameLinePreProcessor} for the given repository. * * - * @param repository + * @param repository repository * - * @return + * @return {@link BlameLinePreProcessor} for the given repository */ @Override public BlameLinePreProcessor createPreProcessor(Repository repository); From a030f93b3a162401f1859a5fe6ad1bee40bbbd43 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 15:19:40 +0200 Subject: [PATCH 140/159] added javadoc for changeset pre processor api --- .../main/java/sonia/scm/repository/ChangesetPreProcessor.java | 3 +++ .../sonia/scm/repository/ChangesetPreProcessorFactory.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java index 26930abcc3..e302b82b1c 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java @@ -38,6 +38,9 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * A pre processor for {@link Changeset} objects. A pre processor is able to + * modify the object before it is delivered to the user interface. + * * TODO for 2.0 extends {@link PreProcessor} interface. * * @author Sebastian Sdorra diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java index 7805be8854..47f0a7ccd7 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java @@ -38,6 +38,9 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * The ChangesetPreProcessorFactory create {@link ChangesetPreProcessor} + * objects for a specific repository. + * * TODO for 2.0 extends {@link PreProcessorFactory} interface. * * @author Sebastian Sdorra From 0781b9a953988a1cf1acbc646307e0dafa2811b6 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 15:26:39 +0200 Subject: [PATCH 141/159] imporve javadoc for pre processor api --- .../sonia/scm/repository/ChangesetPreProcessor.java | 4 ++-- .../scm/repository/ChangesetPreProcessorFactory.java | 6 +++--- .../sonia/scm/repository/FileObjectPreProcessor.java | 7 +++++-- .../scm/repository/FileObjectPreProcessorFactory.java | 9 ++++++--- .../main/java/sonia/scm/repository/PreProcessor.java | 8 +++++--- .../sonia/scm/repository/PreProcessorFactory.java | 11 +++++++---- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java index e302b82b1c..0758f2d0a9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessor.java @@ -50,10 +50,10 @@ public interface ChangesetPreProcessor { /** - * Method description + * Process the given changeset. * * - * @param changeset + * @param changeset changeset to process */ public void process(Changeset changeset); } diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java index 47f0a7ccd7..47ab5786e2 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetPreProcessorFactory.java @@ -51,12 +51,12 @@ public interface ChangesetPreProcessorFactory { /** - * Method description + * Create a new {@link ChangesetPreProcessor} for the given repository. * * - * @param repository + * @param repository repository * - * @return + * @return {@link ChangesetPreProcessor} for the given repository */ public ChangesetPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java index 175020bf6c..0e6560136f 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessor.java @@ -38,6 +38,9 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * A pre processor for {@link FileObject} objects. A pre processor is able to + * modify the object before it is delivered to the user interface. + * * TODO for 2.0 extends {@link PreProcessor} interface. * * @author Sebastian Sdorra @@ -48,10 +51,10 @@ public interface FileObjectPreProcessor { /** - * Method description + * Process the given file object. * * - * @param fileObject + * @param fileObject file object to process */ public void process(FileObject fileObject); } diff --git a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java index 0875a092c6..746aed75f3 100644 --- a/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/FileObjectPreProcessorFactory.java @@ -38,6 +38,9 @@ package sonia.scm.repository; import sonia.scm.plugin.ExtensionPoint; /** + * The FileObjectPreProcessorFactory create {@link FileObjectPreProcessor} + * objects for a specific repository. + * * TODO for 2.0 extends {@link PreProcessorFactory} interface. * * @author Sebastian Sdorra @@ -48,12 +51,12 @@ public interface FileObjectPreProcessorFactory { /** - * Method description + * Create a new {@link FileObjectPreProcessor} for the given repository. * * - * @param repository + * @param repository repository * - * @return + * @return {@link FileObjectPreProcessor} for the given repository */ public FileObjectPreProcessor createPreProcessor(Repository repository); } diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java index cdfd711a87..992f5b07e6 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessor.java @@ -33,20 +33,22 @@ package sonia.scm.repository; /** + * A pre processor is able to modify a object before it is delivered + * to the user interface. * * @author Sebastian Sdorra * @since 1.17 * - * @param + * @param object type */ public interface PreProcessor { /** - * Method description + * Process the given object. * * - * @param item + * @param item object to process */ public void process(T item); } diff --git a/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java index 4bf90ec1c6..91a452d1bc 100644 --- a/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/PreProcessorFactory.java @@ -30,25 +30,28 @@ */ + package sonia.scm.repository; /** + * A pre processor factory creates a specific {@link PreProcessor} for + * the given repository. * * @author Sebastian Sdorra * - * @param + * @param object type for the {@link PreProcessor} * @since 1.17 */ public interface PreProcessorFactory { /** - * Method description + * Create a new {@link PreProcessor} for the given repository. * * - * @param repository + * @param repository repository * - * @return + * @return {@link PreProcessor} for the given repository */ public PreProcessor createPreProcessor(Repository repository); } From 4f7153b39341267a8cdf63bc78a32a8ea94c53d2 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 18:01:02 +0200 Subject: [PATCH 142/159] imporve javadoc for repository service and repository service factory --- .../java/sonia/scm/repository/api/RepositoryService.java | 7 +++++++ .../sonia/scm/repository/api/RepositoryServiceFactory.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 8e9416c0c1..29751e5bd5 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -67,6 +67,13 @@ import java.io.IOException; * * @author Sebastian Sdorra * @since 1.17 + * + * @apiviz.uses sonia.scm.repository.api.Command + * @apiviz.uses sonia.scm.repository.api.BlameCommandBuilder + * @apiviz.uses sonia.scm.repository.api.BrowseCommandBuilder + * @apiviz.uses sonia.scm.repository.api.CatCommandBuilder + * @apiviz.uses sonia.scm.repository.api.DiffCommandBuilder + * @apiviz.uses sonia.scm.repository.api.LogCommandBuilder */ public final class RepositoryService implements Closeable { diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index 7718c04a97..ad6b060712 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -106,6 +106,8 @@ import java.util.Set; * * @author Sebastian Sdorra * @since 1.17 + * + * @apiviz.uses sonia.scm.repository.api.RepositoryService */ @Singleton public final class RepositoryServiceFactory From 16c4cd98190999649a81dd55161a95cae654a709 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 18:11:55 +0200 Subject: [PATCH 143/159] fix some javadoc warnings and errors --- .../src/main/java/sonia/scm/repository/BlameViewer.java | 2 +- .../main/java/sonia/scm/repository/BlameViewerUtil.java | 5 ++--- .../main/java/sonia/scm/repository/ChangesetViewer.java | 7 +++++-- .../sonia/scm/repository/ChangesetViewerProvider.java | 6 +++++- .../java/sonia/scm/repository/ChangesetViewerUtil.java | 6 ++---- .../java/sonia/scm/repository/DiffViewerProvider.java | 6 +++++- .../java/sonia/scm/repository/RepositoryBrowser.java | 6 +++++- .../sonia/scm/repository/RepositoryBrowserProvider.java | 6 ++++-- .../java/sonia/scm/repository/RepositoryBrowserUtil.java | 5 +++-- .../java/sonia/scm/repository/RepositoryHookSupport.java | 9 ++++----- .../java/sonia/scm/repository/api/RepositoryService.java | 5 +---- 11 files changed, 37 insertions(+), 26 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java b/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java index 69657a2005..c77d5e92e4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameViewer.java @@ -48,7 +48,7 @@ import java.io.IOException; * @author Sebastian Sdorra * @since 1.8 * - * @deprecated use {@link RepositoryService#getBlameCommand()) instead. + * @deprecated use {@link RepositoryService#getBlameCommand()} instead. */ @Deprecated public interface BlameViewer diff --git a/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java b/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java index 3345971958..d824b256e1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/BlameViewerUtil.java @@ -44,19 +44,19 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; +import sonia.scm.repository.api.RepositoryService; import sonia.scm.util.AssertUtil; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; -import sonia.scm.repository.api.RepositoryService; /** * Class description * * @author Sebastian Sdorra * @since 1.8 - * + * * @deprecated use {@link RepositoryService#getBlameCommand()} instead. */ @Singleton @@ -79,7 +79,6 @@ public class BlameViewerUtil extends PartCacheClearHook * * @param repositoryManager * @param cacheManager - * @return */ @Inject public BlameViewerUtil(RepositoryManager repositoryManager, diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java index fe0fed7839..7d925bb8f4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewer.java @@ -33,15 +33,18 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; -import sonia.scm.repository.api.RepositoryService; /** * * @author Sebastian Sdorra - * + * * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ @Deprecated diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java index f648b79390..54ed628a60 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerProvider.java @@ -33,11 +33,15 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + /** * * @author Sebastian Sdorra * @since 1.8 - * + * * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ @Deprecated diff --git a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java index d7565ee4f7..1e12f9ab76 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/ChangesetViewerUtil.java @@ -37,13 +37,13 @@ package sonia.scm.repository; import com.google.inject.Inject; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; +import sonia.scm.repository.api.RepositoryService; import sonia.scm.util.AssertUtil; import sonia.scm.util.Util; @@ -58,7 +58,7 @@ import java.util.Set; * * @author Sebastian Sdorra * @since 1.6 - * + * * @deprecated use {@link RepositoryService#getLogCommand()} instead. */ @Deprecated @@ -471,8 +471,6 @@ public class ChangesetViewerUtil extends PartCacheClearHook } } - - /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java b/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java index 103ef0a77e..4876d3a5c7 100644 --- a/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/DiffViewerProvider.java @@ -33,11 +33,15 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + /** * * @author Sebastian Sdorra * @since 1.8 - * + * * @deprecated use {@link RepositoryService#getDiffCommand()} instead. */ @Deprecated diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java index ea3ba75c14..35e36de289 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowser.java @@ -33,6 +33,10 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.repository.api.RepositoryService; + //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; @@ -42,7 +46,7 @@ import java.io.OutputStream; * * @author Sebastian Sdorra * @since 1.5 - * + * * @deprecated use {@link RepositoryService#getBrowseCommand()} instead. */ @Deprecated diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java index e07de36ef8..cf017fd168 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserProvider.java @@ -33,14 +33,16 @@ package sonia.scm.repository; +//~--- non-JDK imports -------------------------------------------------------- + import sonia.scm.repository.api.RepositoryService; /** * * @author Sebastian Sdorra * @since 1.5 - * - * @deprecated use {@link RepositoryService#getBrowseCommand()) instead. + * + * @deprecated use {@link RepositoryService#getBrowseCommand()} instead. */ @Deprecated public interface RepositoryBrowserProvider diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java index b5cbf1127e..77abb191d1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryBrowserUtil.java @@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.cache.Cache; import sonia.scm.cache.CacheManager; +import sonia.scm.repository.api.RepositoryService; import sonia.scm.util.AssertUtil; import sonia.scm.util.Util; @@ -59,8 +60,8 @@ import java.util.Set; * * @author Sebastian Sdorra * @since 1.6 - * - * @deprecated use {@link RepositoryService#getBrowseCommand()) instead. + * + * @deprecated use {@link RepositoryService#getBrowseCommand()} instead. */ @Singleton @Deprecated diff --git a/scm-core/src/main/java/sonia/scm/repository/RepositoryHookSupport.java b/scm-core/src/main/java/sonia/scm/repository/RepositoryHookSupport.java index 63452822ef..3fced455cf 100644 --- a/scm-core/src/main/java/sonia/scm/repository/RepositoryHookSupport.java +++ b/scm-core/src/main/java/sonia/scm/repository/RepositoryHookSupport.java @@ -62,9 +62,8 @@ public interface RepositoryHookSupport /** * Fires a post receive hook event. This methods calls the - * {@link PostReceiveHook#onPostReceive(Repository, List)} of each registered - * {@link PostReceiveHook}. - * + * {@link PostReceiveRepositoryHook#onPostReceive(Repository, List)} + * of each registered {@link PostReceiveRepositoryHook}. * * @param repository that has changed * @param event @@ -73,8 +72,8 @@ public interface RepositoryHookSupport /** * Fires a post receive hook event. This methods calls the - * {@link PostReceiveHook#onPostReceive(Repository, List)} of each registered - * {@link PostReceiveHook}. + * {@link PostReceiveRepositoryHook#onPostReceive(Repository, List)} + * of each registered {@link PostReceiveRepositoryHook}. * * * @param type of the repository diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 29751e5bd5..8c77eb83f8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -67,7 +67,7 @@ import java.io.IOException; * * @author Sebastian Sdorra * @since 1.17 - * + * * @apiviz.uses sonia.scm.repository.api.Command * @apiviz.uses sonia.scm.repository.api.BlameCommandBuilder * @apiviz.uses sonia.scm.repository.api.BrowseCommandBuilder @@ -235,9 +235,6 @@ public final class RepositoryService implements Closeable /** * Returns the repository of this service. * - * - * @param repository repository of this service - * * @return repository of this service */ public Repository getRepository() From d5aa3a45c829ab97267e2a4febc72b359fe4f2b6 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 18:20:52 +0200 Subject: [PATCH 144/159] imporve javadoc for repository service and repository service factory --- .../main/java/sonia/scm/repository/api/RepositoryService.java | 1 + .../java/sonia/scm/repository/api/RepositoryServiceFactory.java | 1 + 2 files changed, 2 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 8c77eb83f8..94ead053f4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -68,6 +68,7 @@ import java.io.IOException; * @author Sebastian Sdorra * @since 1.17 * + * @apiviz.landmark * @apiviz.uses sonia.scm.repository.api.Command * @apiviz.uses sonia.scm.repository.api.BlameCommandBuilder * @apiviz.uses sonia.scm.repository.api.BrowseCommandBuilder diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java index ad6b060712..0b42f0820b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java @@ -107,6 +107,7 @@ import java.util.Set; * @author Sebastian Sdorra * @since 1.17 * + * @apiviz.landmark * @apiviz.uses sonia.scm.repository.api.RepositoryService */ @Singleton From 363ffdaf4d106f85e574e9b47b38f0de4ee7d1d7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 27 Jun 2012 18:23:04 +0200 Subject: [PATCH 145/159] remove landmark from repository service --- .../main/java/sonia/scm/repository/api/RepositoryService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java index 94ead053f4..8c77eb83f8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -68,7 +68,6 @@ import java.io.IOException; * @author Sebastian Sdorra * @since 1.17 * - * @apiviz.landmark * @apiviz.uses sonia.scm.repository.api.Command * @apiviz.uses sonia.scm.repository.api.BlameCommandBuilder * @apiviz.uses sonia.scm.repository.api.BrowseCommandBuilder From da7e9c67d8806fd42c57c2eee12ab64f5e8cb5d5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Jun 2012 10:55:55 +0200 Subject: [PATCH 146/159] improve trace logging for authentication --- .../web/filter/BasicAuthenticationFilter.java | 32 +++++++++++++++++++ .../scm/web/filter/PermissionFilter.java | 9 ++++++ .../web/security/BasicSecurityContext.java | 7 ++++ .../security/ChainAuthenticatonManager.java | 27 ++++++++++++++++ 4 files changed, 75 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java index db33f7f53c..b3fcd1f117 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java @@ -123,15 +123,42 @@ public class BasicAuthenticationFilter extends HttpFilter if (Util.isNotEmpty(authentication) && authentication.toUpperCase().startsWith(AUTHORIZATION_BASIC_PREFIX)) { + if (logger.isTraceEnabled()) + { + logger.trace("found basic authorization header, start authentication"); + } + user = authenticate(request, response, securityContext, authentication); + + if (logger.isTraceEnabled()) + { + if (user != null) + { + logger.trace("user {} successfully authenticated", user.getName()); + } + else + { + logger.trace("authentcation failed, user object is null"); + } + } } else if (securityContext.isAuthenticated()) { + if (logger.isTraceEnabled()) + { + logger.trace("user is allready authenticated"); + } + user = securityContext.getUser(); } if (user == null) { + if (logger.isTraceEnabled()) + { + logger.trace("could not find user send unauthorized"); + } + HttpUtil.sendUnauthorized(response); } else @@ -192,6 +219,11 @@ public class BasicAuthenticationFilter extends HttpFilter if (Util.isNotEmpty(username) && Util.isNotEmpty(password)) { + if (logger.isTraceEnabled()) + { + logger.trace("try to authenticate user {}", username); + } + user = securityContext.authenticate(request, response, username, password); } diff --git a/scm-core/src/main/java/sonia/scm/web/filter/PermissionFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/PermissionFilter.java index a584c821e5..cb361d4437 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/PermissionFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/PermissionFilter.java @@ -150,6 +150,15 @@ public abstract class PermissionFilter extends HttpFilter if (hasPermission(repository, securityContext, writeRequest)) { + if (logger.isTraceEnabled()) + { + logger.trace("{} access to repository {} for user {} granted", + new Object[] { writeRequest + ? "write" + : "read", repository.getName(), + user.getName() }); + } + chain.doFilter(request, response); } else diff --git a/scm-webapp/src/main/java/sonia/scm/web/security/BasicSecurityContext.java b/scm-webapp/src/main/java/sonia/scm/web/security/BasicSecurityContext.java index f17bb67494..cf1c78f97c 100644 --- a/scm-webapp/src/main/java/sonia/scm/web/security/BasicSecurityContext.java +++ b/scm-webapp/src/main/java/sonia/scm/web/security/BasicSecurityContext.java @@ -124,9 +124,16 @@ public class BasicSecurityContext implements WebSecurityContext HttpServletResponse response, String username, String password) { + if ( logger.isTraceEnabled() ){ + logger.trace("start authentication for user {}", username); + } AuthenticationResult ar = authenticator.authenticate(request, response, username, password); + if ( logger.isTraceEnabled() ){ + logger.trace("authentication ends with {}", ar); + } + if ((ar != null) && (ar.getState() == AuthenticationState.SUCCESS)) { authenticate(request, password, ar); diff --git a/scm-webapp/src/main/java/sonia/scm/web/security/ChainAuthenticatonManager.java b/scm-webapp/src/main/java/sonia/scm/web/security/ChainAuthenticatonManager.java index fcdb2a4d06..2f51ef6cfe 100644 --- a/scm-webapp/src/main/java/sonia/scm/web/security/ChainAuthenticatonManager.java +++ b/scm-webapp/src/main/java/sonia/scm/web/security/ChainAuthenticatonManager.java @@ -130,6 +130,12 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager if (ar == null) { + if (logger.isTraceEnabled()) + { + logger.trace("no authentication result for user {} found in cache", + username); + } + ar = doAuthentication(request, response, username, password); if ((ar != null) && ar.isCacheable()) @@ -157,6 +163,11 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager { for (AuthenticationHandler authenticator : authenticationHandlerSet) { + if (logger.isTraceEnabled()) + { + logger.trace("close authenticator {}", authenticator.getClass()); + } + IOUtil.close(authenticator); } } @@ -172,6 +183,11 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager { for (AuthenticationHandler authenticator : authenticationHandlerSet) { + if (logger.isTraceEnabled()) + { + logger.trace("initialize authenticator {}", authenticator.getClass()); + } + authenticator.init(context); } @@ -200,8 +216,19 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager { AuthenticationResult ar = null; + if (logger.isTraceEnabled()) + { + logger.trace("start authentication chain for user {}", username); + } + for (AuthenticationHandler authenticator : authenticationHandlerSet) { + if (logger.isTraceEnabled()) + { + logger.trace("check authenticator {} for user {}", + authenticator.getClass(), username); + } + try { AuthenticationResult result = authenticator.authenticate(request, From 718938db776129c20d1caa42ca699df0f4e953a2 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Jun 2012 12:28:06 +0200 Subject: [PATCH 147/159] added switch for http debug logging --- scm-webapp/src/main/java/sonia/scm/ScmServletModule.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java b/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java index 8c9847746e..1da04efe6e 100644 --- a/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java +++ b/scm-webapp/src/main/java/sonia/scm/ScmServletModule.java @@ -101,6 +101,7 @@ import sonia.scm.util.DebugServlet; import sonia.scm.util.ScmConfigurationUtil; import sonia.scm.web.cgi.CGIExecutorFactory; import sonia.scm.web.cgi.DefaultCGIExecutorFactory; +import sonia.scm.web.filter.LoggingFilter; import sonia.scm.web.security.AdministrationContext; import sonia.scm.web.security.ApiBasicAuthenticationFilter; import sonia.scm.web.security.AuthenticationManager; @@ -172,6 +173,9 @@ public class ScmServletModule extends ServletModule /** Field description */ public static final String REST_PACKAGE = "sonia.scm.api.rest"; + /** Field description */ + public static final String SYSTEM_PROPERTY_DEBUG_HTTP = "scm.debug.http"; + /** Field description */ public static final String[] PATTERN_STATIC_RESOURCES = new String[] { PATTERN_SCRIPT, @@ -299,6 +303,11 @@ public class ScmServletModule extends ServletModule Names.named(UrlProviderFactory.TYPE_WUI)).toProvider( WebUIUrlProvider.class); + if ("true".equalsIgnoreCase(System.getProperty(SYSTEM_PROPERTY_DEBUG_HTTP))) + { + filter(PATTERN_ALL).through(LoggingFilter.class); + } + /* * filter(PATTERN_PAGE, * PATTERN_STATIC_RESOURCES).through(StaticResourceFilter.class); From 1cdf666c718be7cdfafbb4a266c8870a5058cdd4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Jun 2012 12:49:09 +0200 Subject: [PATCH 148/159] log only text body --- .../sonia/scm/web/filter/LoggingFilter.java | 78 +++++++++++++++---- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java index 6b3e62695e..ae7995a574 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/LoggingFilter.java @@ -35,6 +35,7 @@ package sonia.scm.web.filter; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Strings; import com.google.inject.Singleton; import org.slf4j.Logger; @@ -89,7 +90,7 @@ public class LoggingFilter extends HttpFilter { if (logger.isDebugEnabled()) { - boolean logBody = logger.isTraceEnabled(); + boolean logBody = logger.isTraceEnabled() && isTextRequest(request); BufferedHttpServletRequest bufferedRequest = new BufferedHttpServletRequest(request, logBody); BufferedHttpServletResponse bufferedResponse = @@ -189,7 +190,12 @@ public class LoggingFilter extends HttpFilter if (logger.isTraceEnabled()) { - logger.trace("Content: ".concat(new String(request.getContentBuffer()))); + byte[] contentBuffer = request.getContentBuffer(); + + if ((contentBuffer != null) && (contentBuffer.length > 0)) + { + logger.trace("Content: ".concat(new String(contentBuffer))); + } } } @@ -227,22 +233,68 @@ public class LoggingFilter extends HttpFilter logger.debug("Header: {} = {}", header.getKey(), header.getValue()); } - if (logger.isTraceEnabled()) + if (logger.isTraceEnabled() && isTextRequest(orgResponse)) { byte[] content = response.getContentBuffer(); - ServletOutputStream out = null; - try + if ((content != null) && (content.length > 0)) { - out = orgResponse.getOutputStream(); - out.write(content); - } - finally - { - out.close(); - } + ServletOutputStream out = null; - logger.trace("Content: ".concat(new String(content))); + try + { + out = orgResponse.getOutputStream(); + out.write(content); + } + finally + { + out.close(); + } + + logger.trace("Content: ".concat(new String(content))); + } } } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + */ + private boolean isTextRequest(HttpServletRequest request) + { + return isTextRequest(request.getContentType()); + } + + /** + * Method description + * + * + * @param response + * + * @return + */ + private boolean isTextRequest(HttpServletResponse response) + { + return isTextRequest(response.getContentType()); + } + + /** + * Method description + * + * + * @param contentType + * + * @return + */ + private boolean isTextRequest(String contentType) + { + return !Strings.isNullOrEmpty(contentType) + && contentType.toLowerCase().startsWith("text"); + } } From a8b3b3bb277fd7f9cdb989bd71a03f5beaa336cf Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Jun 2012 14:54:44 +0200 Subject: [PATCH 149/159] fix basic authentication for systems with turkish locale --- .../src/main/java/sonia/scm/util/Util.java | 18 ++++++++++++++++++ .../web/filter/BasicAuthenticationFilter.java | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/util/Util.java b/scm-core/src/main/java/sonia/scm/util/Util.java index e8e9cadc3b..bfa109f4ec 100644 --- a/scm-core/src/main/java/sonia/scm/util/Util.java +++ b/scm-core/src/main/java/sonia/scm/util/Util.java @@ -47,6 +47,7 @@ import java.util.Comparator; import java.util.Date; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -398,6 +399,23 @@ public class Util return parseDate(dateString, null); } + /** + * Method description + * + * + * @param value + * @param start + * + * @return + * + * @since 1.17 + */ + public static boolean startWithIgnoreCase(String value, String start) + { + return (value != null) && (start != null) + && value.toUpperCase(Locale.ENGLISH).startsWith(start); + } + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java index b3fcd1f117..386f27bcd3 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java @@ -120,8 +120,7 @@ public class BasicAuthenticationFilter extends HttpFilter User user = null; String authentication = request.getHeader(HEADER_AUTHORIZATION); - if (Util.isNotEmpty(authentication) - && authentication.toUpperCase().startsWith(AUTHORIZATION_BASIC_PREFIX)) + if (Util.startWithIgnoreCase(authentication, AUTHORIZATION_BASIC_PREFIX)) { if (logger.isTraceEnabled()) { From 161d45bdd24e89888f315e0ea19669a463dbae50 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Jun 2012 15:28:43 +0200 Subject: [PATCH 150/159] close branch issue-195 From 92cabc73f6f846addac680c706ef9d5763175348 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 29 Jun 2012 09:40:21 +0200 Subject: [PATCH 151/159] added locale and timezone to support informations --- .../api/rest/resources/SupportResource.java | 65 +++++++++++++++---- .../src/main/resources/templates/support.html | 2 + 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java index 29f37b6b33..0fac1a6591 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/SupportResource.java @@ -30,6 +30,7 @@ */ + package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- @@ -39,8 +40,11 @@ import com.google.common.collect.Maps; import com.google.inject.Inject; import sonia.scm.SCMContextProvider; +import sonia.scm.Type; import sonia.scm.config.ScmConfiguration; import sonia.scm.plugin.PluginManager; +import sonia.scm.repository.RepositoryHandler; +import sonia.scm.repository.RepositoryManager; import sonia.scm.store.StoreFactory; import sonia.scm.template.TemplateHandler; import sonia.scm.util.SecurityUtil; @@ -51,18 +55,17 @@ import sonia.scm.web.security.WebSecurityContext; import java.io.IOException; import java.io.StringWriter; + import java.util.Collection; import java.util.List; - +import java.util.Locale; import java.util.Map; +import java.util.TimeZone; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import sonia.scm.Type; -import sonia.scm.repository.RepositoryHandler; -import sonia.scm.repository.RepositoryManager; /** * @@ -88,13 +91,16 @@ public class SupportResource * @param configuration * @param pluginManager * @param storeFactory + * @param repositoryManager */ @Inject public SupportResource(WebSecurityContext securityContext, SCMContextProvider context, TemplateHandler templateHandler, ScmConfiguration configuration, - PluginManager pluginManager, StoreFactory storeFactory, RepositoryManager repositoryManager ) + PluginManager pluginManager, + StoreFactory storeFactory, + RepositoryManager repositoryManager) { this.securityContext = securityContext; this.context = context; @@ -105,8 +111,6 @@ public class SupportResource this.repositoryManager = repositoryManager; } - private RepositoryManager repositoryManager; - //~--- get methods ---------------------------------------------------------- /** @@ -139,15 +143,21 @@ public class SupportResource return writer.toString(); } + /** + * Method description + * + * + * @return + */ private List getRepositoryHandlers() { List handlers = Lists.newArrayList(); - - for ( Type type : repositoryManager.getConfiguredTypes() ) + + for (Type type : repositoryManager.getConfiguredTypes()) { - handlers.add( repositoryManager.getHandler(type.getName()) ); + handlers.add(repositoryManager.getHandler(type.getName())); } - + return handlers; } @@ -260,6 +270,8 @@ public class SupportResource container = SystemUtil.getServletContainer().name(); java = System.getProperty("java.vendor").concat("/").concat( System.getProperty("java.version")); + locale = Locale.getDefault().toString(); + timeZone = TimeZone.getDefault().getID(); } //~--- get methods -------------------------------------------------------- @@ -297,6 +309,17 @@ public class SupportResource return java; } + /** + * Method description + * + * + * @return + */ + public String getLocale() + { + return locale; + } + /** * Method description * @@ -308,6 +331,17 @@ public class SupportResource return os; } + /** + * Method description + * + * + * @return + */ + public String getTimeZone() + { + return timeZone; + } + //~--- fields ------------------------------------------------------------- /** Field description */ @@ -319,8 +353,14 @@ public class SupportResource /** Field description */ private String java; + /** Field description */ + private String locale; + /** Field description */ private String os; + + /** Field description */ + private String timeZone; } @@ -408,6 +448,9 @@ public class SupportResource /** Field description */ private PluginManager pluginManager; + /** Field description */ + private RepositoryManager repositoryManager; + /** Field description */ private WebSecurityContext securityContext; diff --git a/scm-webapp/src/main/resources/templates/support.html b/scm-webapp/src/main/resources/templates/support.html index bd34ad2c1c..f22f902d9a 100644 --- a/scm-webapp/src/main/resources/templates/support.html +++ b/scm-webapp/src/main/resources/templates/support.html @@ -134,6 +134,8 @@
  • Architecture: ${system.arch}
  • ServletContainer: ${system.container}
  • Java: ${system.java}
  • +
  • Local: ${system.locale}
  • +
  • TimeZone: ${system.timeZone}
  • Repository Handlers

    From 149c8b4dfec7bca6c064bf1d26aaf45026cdaa9b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 29 Jun 2012 14:23:47 +0200 Subject: [PATCH 152/159] fix javascript errors with ie --- .../js/repository/sonia.repository.changesetpanel.js | 6 +++--- .../main/webapp/resources/js/repository/sonia.repository.js | 4 +--- scm-webapp/src/main/webapp/resources/js/sonia.global.js | 2 +- scm-webapp/src/main/webapp/resources/js/sonia.scm.js | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetpanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetpanel.js index 1d0aeebf8a..7e5dd0fb8e 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetpanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetpanel.js @@ -117,7 +117,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, { }, showCommit: function(){ - if ( console ){ + if ( debug ){ console.debug('open commit for ' + this.revision); } this.openPanel(this.createCommitPanel()); @@ -126,7 +126,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, { }, showDiff: function(){ - if ( console ){ + if ( debug ){ console.debug('open diff for ' + this.revision); } this.openPanel(this.createDiffPanel()); @@ -135,7 +135,7 @@ Sonia.repository.ChangesetPanel = Ext.extend(Ext.Panel, { }, downloadRawDiff: function(){ - if ( console ){ + if ( debug ){ console.debug('open raw diff for ' + this.revision); } window.open(this.createDiffUrl()); diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index 0c3dad29f8..1ed840a02b 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -83,9 +83,7 @@ Sonia.repository.createUrl = function(type, name){ } Sonia.repository.createUrlFromObject = function(repository){ - var url = Sonia.repository.createUrl(repository.type, repository.name); - console.debug(url); - return url; + return Sonia.repository.createUrl(repository.type, repository.name); } /** diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.global.js b/scm-webapp/src/main/webapp/resources/js/sonia.global.js index 6d23c35b92..25b8cb1db0 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.global.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.global.js @@ -29,7 +29,7 @@ * */ // enable debug mode, if console is available -var debug = typeof console != 'undefined'; +var debug = typeof console != 'undefined' && typeof console.debug != 'undefined'; var state = null; var admin = false; diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js index db6e6dd56c..a04f2dea25 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js @@ -523,7 +523,7 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, { css.rel = 'stylesheet'; css.type = 'text/css'; css.href = url; - document.head.appendChild(css); + document.getElementsByTagName('head')[0].appendChild(css); this.stylesheets.push(url); } }, From a97cd8cab62069bf13f2b2f29c080905732b5974 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 29 Jun 2012 14:36:48 +0200 Subject: [PATCH 153/159] fix npe with start revision and without end revision --- .../src/main/java/sonia/scm/repository/spi/GitLogCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 6d7e3c908b..3c9ce9900b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -204,7 +204,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand ObjectId endId = null; - if (!Strings.isNullOrEmpty(request.getStartChangeset())) + if (!Strings.isNullOrEmpty(request.getEndChangeset())) { endId = gr.resolve(request.getEndChangeset()); } @@ -217,7 +217,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand } for (RevCommit commit : cmd.call()) - { + { if (!started && ((startId == null) || commit.getId().equals(startId))) { started = true; From a4ffc376244b609e51bb9ce1910be404fb131969 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 14:58:08 +0200 Subject: [PATCH 154/159] improve logging of changeset converter --- .../java/sonia/scm/repository/GitChangesetConverter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetConverter.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetConverter.java index 549b6103a3..c638f992d8 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetConverter.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetConverter.java @@ -237,9 +237,9 @@ public class GitChangesetConverter implements Closeable } else { - if (logger.isWarnEnabled()) + if (logger.isTraceEnabled()) { - logger.warn("no parent at position 0 for commit {}", commit); + logger.trace("no parent at position 0 for commit {}", commit); } treeWalk.addTree(new EmptyTreeIterator()); @@ -247,9 +247,9 @@ public class GitChangesetConverter implements Closeable } else { - if (logger.isWarnEnabled()) + if (logger.isTraceEnabled()) { - logger.warn("no parent available for commit {}", commit); + logger.trace("no parent available for commit {}", commit); } treeWalk.addTree(new EmptyTreeIterator()); From 9cd1de86d640dd9dffe2ee28dd147bf1ba45a999 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 15:23:11 +0200 Subject: [PATCH 155/159] improve logging of GitUtil --- .../src/main/java/sonia/scm/repository/GitUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java index 0566a48d1e..07ab9709b8 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java @@ -239,9 +239,9 @@ public class GitUtil } } - if (logger.isInfoEnabled()) + if (logger.isDebugEnabled()) { - logger.info("use {}:{} as repository head", head, id); + logger.debug("use {}:{} as repository head", head, id); } return id; From b1904c66153a1f7aca777d4b2950ddeb0f8ea705 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 15:23:46 +0200 Subject: [PATCH 156/159] fix get range from git log command --- .../scm/repository/spi/GitLogCommand.java | 55 +++++++++++-------- .../scm/repository/spi/GitLogCommandTest.java | 17 +++--- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index 3c9ce9900b..dbcc023bd3 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -41,10 +41,18 @@ import com.google.common.collect.Lists; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.NoHeadException; +import org.eclipse.jgit.errors.IncorrectObjectTypeException; +import org.eclipse.jgit.errors.MissingObjectException; +import org.eclipse.jgit.errors.StopWalkException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.revwalk.filter.RevFilter; +import org.eclipse.jgit.treewalk.filter.AndTreeFilter; +import org.eclipse.jgit.treewalk.filter.PathFilter; +import org.eclipse.jgit.treewalk.filter.PathFilterGroup; +import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,6 +69,7 @@ import sonia.scm.util.IOUtil; import java.io.IOException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; /** @@ -177,8 +186,6 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand if (!gr.getAllRefs().isEmpty()) { - converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH); - int counter = 0; int start = request.getPagingStart(); @@ -194,7 +201,6 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand List changesetList = Lists.newArrayList(); int limit = request.getPagingLimit(); - boolean started = false; ObjectId startId = null; if (!Strings.isNullOrEmpty(request.getStartChangeset())) @@ -209,22 +215,36 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand endId = gr.resolve(request.getEndChangeset()); } - org.eclipse.jgit.api.LogCommand cmd = new Git(gr).log().all(); + RevWalk revWalk = new RevWalk(gr); + + converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH); if (!Strings.isNullOrEmpty(request.getPath())) { - cmd = cmd.addPath(request.getPath()); + revWalk.setTreeFilter( + AndTreeFilter.create( + PathFilter.create(request.getPath()), TreeFilter.ANY_DIFF)); } - for (RevCommit commit : cmd.call()) - { - if (!started && ((startId == null) || commit.getId().equals(startId))) + ObjectId head = GitUtil.getRepositoryHead(gr); + + if (head != null) + { + if (startId != null) { - started = true; + revWalk.markStart(revWalk.lookupCommit(startId)); + } + else + { + revWalk.markStart(revWalk.lookupCommit(head)); } - if (started) + Iterator iterator = revWalk.iterator(); + + while (iterator.hasNext()) { + RevCommit commit = iterator.next(); + if ((counter >= start) && ((limit < 0) || (counter < start + limit))) { @@ -248,20 +268,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand repository.getName()); } } - catch (NoHeadException ex) - { - if (logger.isTraceEnabled()) - { - logger.trace("repository seems to be empty", ex); - } - else if (logger.isWarnEnabled()) - { - logger.warn("repository seems to be empty"); - } - - changesets = new ChangesetPagingResult(0, new ArrayList()); - } - catch (GitAPIException ex) + catch (Exception ex) { throw new RepositoryException("could not create change log", ex); } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index 650a9e0c36..5f7f9055fb 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -71,8 +71,8 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase createCommand().getChangesets(new LogCommandRequest()); assertNotNull(result); - assertEquals(5, result.getTotal()); - assertEquals(5, result.getChangesets().size()); + assertEquals(4, result.getTotal()); + assertEquals(4, result.getChangesets().size()); } /** @@ -92,11 +92,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase ChangesetPagingResult result = createCommand().getChangesets(request); assertNotNull(result); - assertEquals(3, result.getTotal()); - assertEquals(3, result.getChangesets().size()); + assertEquals(2, result.getTotal()); + assertEquals(2, result.getChangesets().size()); assertEquals("fcd0ef1831e4002ac43e", result.getChangesets().get(0).getId()); - assertEquals("3f76a12f08a6ba0dc988", result.getChangesets().get(1).getId()); - assertEquals("435df2f061add3589cb3", result.getChangesets().get(2).getId()); + assertEquals("435df2f061add3589cb3", result.getChangesets().get(1).getId()); } /** @@ -116,7 +115,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase ChangesetPagingResult result = createCommand().getChangesets(request); assertNotNull(result); - assertEquals(5, result.getTotal()); + assertEquals(4, result.getTotal()); assertEquals(2, result.getChangesets().size()); Changeset c1 = result.getChangesets().get(0); @@ -148,7 +147,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase ChangesetPagingResult result = createCommand().getChangesets(request); assertNotNull(result); - assertEquals(5, result.getTotal()); + assertEquals(4, result.getTotal()); assertEquals(2, result.getChangesets().size()); Changeset c1 = result.getChangesets().get(0); @@ -159,7 +158,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase Changeset c2 = result.getChangesets().get(1); assertNotNull(c2); - assertEquals("3f76a12f08a6ba0dc988", c2.getId()); + assertEquals("592d797cd36432e59141", c2.getId()); } /** From 1d297cf66ca7702fc1709c9335ee06938de8fcbb Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 15:45:13 +0200 Subject: [PATCH 157/159] [maven-release-plugin] prepare release 1.17 --- maven/pom.xml | 4 ++-- maven/scm-maven-plugin/pom.xml | 4 ++-- maven/scm-plugin-archetype/pom.xml | 4 ++-- pom.xml | 4 ++-- scm-clients/pom.xml | 6 +++--- scm-clients/scm-cli-client/pom.xml | 8 ++++---- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 10 +++++----- scm-core/pom.xml | 4 ++-- scm-dao-orientdb/pom.xml | 8 ++++---- scm-dao-xml/pom.xml | 8 ++++---- scm-plugin-backend/pom.xml | 6 +++--- scm-plugins/pom.xml | 8 ++++---- scm-plugins/scm-git-plugin/pom.xml | 6 +++--- scm-plugins/scm-hg-plugin/pom.xml | 6 +++--- scm-plugins/scm-svn-plugin/pom.xml | 6 +++--- scm-samples/pom.xml | 4 ++-- scm-samples/scm-sample-auth/pom.xml | 6 +++--- scm-samples/scm-sample-hello/pom.xml | 6 +++--- scm-server/pom.xml | 4 ++-- scm-test/pom.xml | 6 +++--- scm-webapp/pom.xml | 18 +++++++++--------- 22 files changed, 70 insertions(+), 70 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index e584ea664d..dfe39e2d73 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm.maven scm-maven-plugins pom - 1.17-SNAPSHOT + 1.17 scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index beea26afd7..f5fc9e0152 100644 --- a/maven/scm-maven-plugin/pom.xml +++ b/maven/scm-maven-plugin/pom.xml @@ -6,12 +6,12 @@ scm-maven-plugins sonia.scm.maven - 1.17-SNAPSHOT + 1.17 sonia.scm.maven scm-maven-plugin - 1.17-SNAPSHOT + 1.17 maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 931bad0a01..636ad26ab6 100644 --- a/maven/scm-plugin-archetype/pom.xml +++ b/maven/scm-plugin-archetype/pom.xml @@ -6,12 +6,12 @@ scm-maven-plugins sonia.scm.maven - 1.17-SNAPSHOT + 1.17 sonia.scm.maven scm-plugin-archetype - 1.17-SNAPSHOT + 1.17 scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 05d787f5bb..987a8955ee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.17-SNAPSHOT + 1.17 The easiest way to share your Git, Mercurial and Subversion repositories over http. @@ -36,7 +36,7 @@ scm:hg:http://bitbucket.org/sdorra/scm-manager scm:hg:https://bitbucket.org/sdorra/scm-manager http://bitbucket.org/sdorra/scm-manager - HEAD + 1.17 diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 2a8f241d6a..f693d3db52 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm.clients scm-clients pom - 1.17-SNAPSHOT + 1.17 scm-clients @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index c3eb4276fa..9a1d2d8314 100644 --- a/scm-clients/scm-cli-client/pom.xml +++ b/scm-clients/scm-cli-client/pom.xml @@ -6,12 +6,12 @@ scm-clients sonia.scm.clients - 1.17-SNAPSHOT + 1.17 sonia.scm.clients scm-cli-client - 1.17-SNAPSHOT + 1.17 scm-cli-client @@ -35,7 +35,7 @@ scm-core sonia.scm - 1.17-SNAPSHOT + 1.17 guice @@ -55,7 +55,7 @@ sonia.scm.clients scm-client-impl - 1.17-SNAPSHOT + 1.17 diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 11c2d5b26b..21112ffe37 100644 --- a/scm-clients/scm-client-api/pom.xml +++ b/scm-clients/scm-client-api/pom.xml @@ -6,13 +6,13 @@ sonia.scm.clients scm-clients - 1.17-SNAPSHOT + 1.17 sonia.scm.clients scm-client-api jar - 1.17-SNAPSHOT + 1.17 scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 4bf887cab0..f0eed30296 100644 --- a/scm-clients/scm-client-impl/pom.xml +++ b/scm-clients/scm-client-impl/pom.xml @@ -6,13 +6,13 @@ sonia.scm.clients scm-clients - 1.17-SNAPSHOT + 1.17 sonia.scm.clients scm-client-impl jar - 1.17-SNAPSHOT + 1.17 scm-client-impl @@ -36,7 +36,7 @@ scm-core sonia.scm - 1.17-SNAPSHOT + 1.17 aopalliance @@ -60,7 +60,7 @@ sonia.scm.clients scm-client-api - 1.17-SNAPSHOT + 1.17 @@ -112,7 +112,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index bedccaf606..b420efb98d 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 8b51c104eb..21924141c2 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-dao-orientdb - 1.17-SNAPSHOT + 1.17 scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index c6d49f47d2..04434e1399 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-dao-xml - 1.17-SNAPSHOT + 1.17 scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 0db75ef201..3e0c199736 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-plugin-backend war - 1.17-SNAPSHOT + 1.17 ${project.artifactId} @@ -42,7 +42,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index f1917c6cf6..e37c73956e 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-plugins pom - 1.17-SNAPSHOT + 1.17 scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.17-SNAPSHOT + 1.17 process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 41cdd07593..c78eb54342 100644 --- a/scm-plugins/scm-git-plugin/pom.xml +++ b/scm-plugins/scm-git-plugin/pom.xml @@ -6,12 +6,12 @@ scm-plugins sonia.scm.plugins - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-git-plugin - 1.17-SNAPSHOT + 1.17 scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -55,7 +55,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index c7375aae1d..d5d969889c 100644 --- a/scm-plugins/scm-hg-plugin/pom.xml +++ b/scm-plugins/scm-hg-plugin/pom.xml @@ -6,12 +6,12 @@ sonia.scm.plugins scm-plugins - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-hg-plugin - 1.17-SNAPSHOT + 1.17 scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -30,7 +30,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index 9bb9a7e32c..e522485253 100644 --- a/scm-plugins/scm-svn-plugin/pom.xml +++ b/scm-plugins/scm-svn-plugin/pom.xml @@ -6,12 +6,12 @@ scm-plugins sonia.scm.plugins - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-svn-plugin - 1.17-SNAPSHOT + 1.17 scm-svn-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Subversion @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index def37d44c7..26e8071ef5 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm.samples scm-samples pom - 1.17-SNAPSHOT + 1.17 scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 209ae3d930..d64141c1fd 100644 --- a/scm-samples/scm-sample-auth/pom.xml +++ b/scm-samples/scm-sample-auth/pom.xml @@ -6,12 +6,12 @@ scm-samples sonia.scm.samples - 1.17-SNAPSHOT + 1.17 sonia.scm.sample scm-sample-auth - 1.17-SNAPSHOT + 1.17 scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 8fc95b1024..03b7335791 100644 --- a/scm-samples/scm-sample-hello/pom.xml +++ b/scm-samples/scm-sample-hello/pom.xml @@ -6,12 +6,12 @@ scm-samples sonia.scm.samples - 1.17-SNAPSHOT + 1.17 sonia.scm.sample scm-sample-hello - 1.17-SNAPSHOT + 1.17 scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 1d8862ff1c..35b8877f20 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-server - 1.17-SNAPSHOT + 1.17 scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index 3b8c0b9728..6ae8522874 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index 96a902f54c..3c7e2ab369 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17-SNAPSHOT + 1.17 sonia.scm scm-webapp war - 1.17-SNAPSHOT + 1.17 scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.17-SNAPSHOT + 1.17 sonia.scm scm-dao-xml - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-hg-plugin - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-svn-plugin - 1.17-SNAPSHOT + 1.17 sonia.scm.plugins scm-git-plugin - 1.17-SNAPSHOT + 1.17 @@ -221,7 +221,7 @@ sonia.scm scm-test - 1.17-SNAPSHOT + 1.17 test @@ -387,7 +387,7 @@ sonia.scm scm-dao-orientdb - 1.17-SNAPSHOT + 1.17 From 994f4ab2488f3044024674e07203501fba9ab2a4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 15:45:13 +0200 Subject: [PATCH 158/159] [maven-release-plugin] copy for tag 1.17 From 374aa7fec0e006d983b95e092b115b8c44781f3e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 1 Jul 2012 15:45:14 +0200 Subject: [PATCH 159/159] [maven-release-plugin] prepare for next development iteration --- maven/pom.xml | 4 ++-- maven/scm-maven-plugin/pom.xml | 4 ++-- maven/scm-plugin-archetype/pom.xml | 4 ++-- pom.xml | 4 ++-- scm-clients/pom.xml | 6 +++--- scm-clients/scm-cli-client/pom.xml | 8 ++++---- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 10 +++++----- scm-core/pom.xml | 4 ++-- scm-dao-orientdb/pom.xml | 8 ++++---- scm-dao-xml/pom.xml | 8 ++++---- scm-plugin-backend/pom.xml | 6 +++--- scm-plugins/pom.xml | 8 ++++---- scm-plugins/scm-git-plugin/pom.xml | 6 +++--- scm-plugins/scm-hg-plugin/pom.xml | 6 +++--- scm-plugins/scm-svn-plugin/pom.xml | 6 +++--- scm-samples/pom.xml | 4 ++-- scm-samples/scm-sample-auth/pom.xml | 6 +++--- scm-samples/scm-sample-hello/pom.xml | 6 +++--- scm-server/pom.xml | 4 ++-- scm-test/pom.xml | 6 +++--- scm-webapp/pom.xml | 18 +++++++++--------- 22 files changed, 70 insertions(+), 70 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index dfe39e2d73..886e45927a 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm.maven scm-maven-plugins pom - 1.17 + 1.18-SNAPSHOT scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index f5fc9e0152..304335efd5 100644 --- a/maven/scm-maven-plugin/pom.xml +++ b/maven/scm-maven-plugin/pom.xml @@ -6,12 +6,12 @@ scm-maven-plugins sonia.scm.maven - 1.17 + 1.18-SNAPSHOT sonia.scm.maven scm-maven-plugin - 1.17 + 1.18-SNAPSHOT maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 636ad26ab6..0b354ee0bb 100644 --- a/maven/scm-plugin-archetype/pom.xml +++ b/maven/scm-plugin-archetype/pom.xml @@ -6,12 +6,12 @@ scm-maven-plugins sonia.scm.maven - 1.17 + 1.18-SNAPSHOT sonia.scm.maven scm-plugin-archetype - 1.17 + 1.18-SNAPSHOT scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 987a8955ee..c09c85f055 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.17 + 1.18-SNAPSHOT The easiest way to share your Git, Mercurial and Subversion repositories over http. @@ -36,7 +36,7 @@ scm:hg:http://bitbucket.org/sdorra/scm-manager scm:hg:https://bitbucket.org/sdorra/scm-manager http://bitbucket.org/sdorra/scm-manager - 1.17 + HEAD diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index f693d3db52..2965268154 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm.clients scm-clients pom - 1.17 + 1.18-SNAPSHOT scm-clients @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 9a1d2d8314..e4c2b720b7 100644 --- a/scm-clients/scm-cli-client/pom.xml +++ b/scm-clients/scm-cli-client/pom.xml @@ -6,12 +6,12 @@ scm-clients sonia.scm.clients - 1.17 + 1.18-SNAPSHOT sonia.scm.clients scm-cli-client - 1.17 + 1.18-SNAPSHOT scm-cli-client @@ -35,7 +35,7 @@ scm-core sonia.scm - 1.17 + 1.18-SNAPSHOT guice @@ -55,7 +55,7 @@ sonia.scm.clients scm-client-impl - 1.17 + 1.18-SNAPSHOT diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 21112ffe37..b113cdbe04 100644 --- a/scm-clients/scm-client-api/pom.xml +++ b/scm-clients/scm-client-api/pom.xml @@ -6,13 +6,13 @@ sonia.scm.clients scm-clients - 1.17 + 1.18-SNAPSHOT sonia.scm.clients scm-client-api jar - 1.17 + 1.18-SNAPSHOT scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index f0eed30296..b0994e6702 100644 --- a/scm-clients/scm-client-impl/pom.xml +++ b/scm-clients/scm-client-impl/pom.xml @@ -6,13 +6,13 @@ sonia.scm.clients scm-clients - 1.17 + 1.18-SNAPSHOT sonia.scm.clients scm-client-impl jar - 1.17 + 1.18-SNAPSHOT scm-client-impl @@ -36,7 +36,7 @@ scm-core sonia.scm - 1.17 + 1.18-SNAPSHOT aopalliance @@ -60,7 +60,7 @@ sonia.scm.clients scm-client-api - 1.17 + 1.18-SNAPSHOT @@ -112,7 +112,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index b420efb98d..141ad66a66 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 21924141c2..16ebe46cf2 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-dao-orientdb - 1.17 + 1.18-SNAPSHOT scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index 04434e1399..d23f2cfe24 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-dao-xml - 1.17 + 1.18-SNAPSHOT scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 3e0c199736..4966149d4a 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-plugin-backend war - 1.17 + 1.18-SNAPSHOT ${project.artifactId} @@ -42,7 +42,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index e37c73956e..ed7a59bff7 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-plugins pom - 1.17 + 1.18-SNAPSHOT scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.17 + 1.18-SNAPSHOT process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index c78eb54342..81bc875c00 100644 --- a/scm-plugins/scm-git-plugin/pom.xml +++ b/scm-plugins/scm-git-plugin/pom.xml @@ -6,12 +6,12 @@ scm-plugins sonia.scm.plugins - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.17 + 1.18-SNAPSHOT scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -55,7 +55,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index d5d969889c..b8e1bc2bef 100644 --- a/scm-plugins/scm-hg-plugin/pom.xml +++ b/scm-plugins/scm-hg-plugin/pom.xml @@ -6,12 +6,12 @@ sonia.scm.plugins scm-plugins - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.17 + 1.18-SNAPSHOT scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -30,7 +30,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index e522485253..1bfd63b639 100644 --- a/scm-plugins/scm-svn-plugin/pom.xml +++ b/scm-plugins/scm-svn-plugin/pom.xml @@ -6,12 +6,12 @@ scm-plugins sonia.scm.plugins - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.17 + 1.18-SNAPSHOT scm-svn-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Subversion @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 26e8071ef5..459bd98d7e 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm.samples scm-samples pom - 1.17 + 1.18-SNAPSHOT scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index d64141c1fd..4869d3f692 100644 --- a/scm-samples/scm-sample-auth/pom.xml +++ b/scm-samples/scm-sample-auth/pom.xml @@ -6,12 +6,12 @@ scm-samples sonia.scm.samples - 1.17 + 1.18-SNAPSHOT sonia.scm.sample scm-sample-auth - 1.17 + 1.18-SNAPSHOT scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 03b7335791..26d772606f 100644 --- a/scm-samples/scm-sample-hello/pom.xml +++ b/scm-samples/scm-sample-hello/pom.xml @@ -6,12 +6,12 @@ scm-samples sonia.scm.samples - 1.17 + 1.18-SNAPSHOT sonia.scm.sample scm-sample-hello - 1.17 + 1.18-SNAPSHOT scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 35b8877f20..b779966ddb 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-server - 1.17 + 1.18-SNAPSHOT scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index 6ae8522874..1c87e3e9d9 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index 3c7e2ab369..93504d5211 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.17 + 1.18-SNAPSHOT sonia.scm scm-webapp war - 1.17 + 1.18-SNAPSHOT scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.17 + 1.18-SNAPSHOT sonia.scm scm-dao-xml - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.17 + 1.18-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.17 + 1.18-SNAPSHOT @@ -221,7 +221,7 @@ sonia.scm scm-test - 1.17 + 1.18-SNAPSHOT test @@ -387,7 +387,7 @@ sonia.scm scm-dao-orientdb - 1.17 + 1.18-SNAPSHOT