From 6f20d75084f145f4eaef9b8d8eb79c2633e352f6 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 20 Aug 2014 10:49:41 +0200 Subject: [PATCH 01/68] fix some missing file extensions for syntax highlighter --- .../sonia.panel.syntaxhighlighterpanel.js | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/panel/sonia.panel.syntaxhighlighterpanel.js b/scm-webapp/src/main/webapp/resources/js/panel/sonia.panel.syntaxhighlighterpanel.js index dd1f88f46a..8dcc40b176 100644 --- a/scm-webapp/src/main/webapp/resources/js/panel/sonia.panel.syntaxhighlighterpanel.js +++ b/scm-webapp/src/main/webapp/resources/js/panel/sonia.panel.syntaxhighlighterpanel.js @@ -30,10 +30,10 @@ */ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { - + syntaxes: [{ name: 'ActionScript3', - aliases: ['as3', 'actionscript3'], + aliases: ['as', 'as3', 'actionscript3'], fileName: 'shBrushAS3.js' },{ name: 'AppleScript', @@ -41,7 +41,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { fileName: 'shBrushAppleScript.js' },{ name: 'Bash/shell', - aliases: ['bash', 'shell'], + aliases: ['sh', 'bash', 'shell'], fileName: 'shBrushBash.js' },{ name: 'ColdFusion', @@ -49,7 +49,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { fileName: 'shBrushColdFusion.js' },{ name: 'C#', - aliases: ['c-sharp', 'csharp'], + aliases: ['cs', 'c-sharp', 'csharp'], fileName: 'shBrushCSharp.js' },{ name: 'C++', @@ -97,7 +97,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { fileName: 'shBrushPhp.js' },{ name: 'Plain Text', - aliases: ['plain', 'text'], + aliases: ['plain', 'text', 'txt', 'log'], fileName: 'shBrushPlain.js' },{ name: 'PowerShell', @@ -132,26 +132,26 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { aliases: ['xml', 'xhtml', 'xslt', 'html', 'xhtml'], fileName: 'shBrushXml.js' }], - + syntax: 'plain', brush: 'plain', brushUrl: 'shBrushPlain.js', theme: 'Netbeans', shPath: 'resources/syntaxhighlighter', contentUrl: null, - + loadErrorTitleText: 'Error', loadErrorMsgText: 'Could not load file', - + contentLoaded: false, scriptsLoaded: false, - + initComponent: function(){ - + if (debug){ console.debug( 'try to find brush for ' + this.syntax ); } - + if ( this.syntax !== 'plain' ){ var s = null; var found = false; @@ -171,7 +171,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { break; } } - + if (! found){ if ( debug ){ console.debug( 'could not find syntax for ' + this.syntax ); @@ -179,9 +179,9 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { this.syntax = 'plain'; } } - + this.brush = this.syntax; - + // load core stylesheet main.loadStylesheet( this.shPath + '/styles/shCore.css'); // load theme stylesheet @@ -189,7 +189,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { console.debug( 'load theme ' + this.theme ); } main.loadStylesheet(this.shPath + '/styles/shCore' + this.theme + '.css'); - + var config = { autoScroll: true, listeners: { @@ -199,11 +199,11 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { } } }; - + Ext.apply(this, Ext.apply(this.initialConfig, config)); Sonia.panel.SyntaxHighlighterPanel.superclass.initComponent.apply(this, arguments); }, - + loadBodyContent: function(){ main.loadScript(this.shPath + '/scripts/shCore.js', this.loadBrush, this); Ext.Ajax.request({ @@ -219,21 +219,21 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { }, failure: function(result){ main.handleRestFailure( - result, - this.loadErrorTitleText, + result, + this.loadErrorTitleText, this.loadErrorMsgText ); } }); }, - + loadBrush: function(){ main.loadScript(this.shPath + '/scripts/' + this.brushUrl, function(){ this.scriptsLoaded = true; this.highlight(); }, this); }, - + highlight: function(){ if (debug){ console.debug('loaded, script: ' + this.scriptsLoaded + ", content: " + this.contentLoaded ); @@ -247,7 +247,7 @@ Sonia.panel.SyntaxHighlighterPanel = Ext.extend(Ext.Panel, { SyntaxHighlighter.vars.discoveredBrushes = null; } } - + }); -Ext.reg('syntaxHighlighterPanel', Sonia.panel.SyntaxHighlighterPanel); \ No newline at end of file +Ext.reg('syntaxHighlighterPanel', Sonia.panel.SyntaxHighlighterPanel); From cb00ed3d758532e63fe69f7da1e909ed4221d76e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Aug 2014 09:03:43 +0200 Subject: [PATCH 02/68] fix scm-server stop method on windows, see issue #623 --- scm-server/src/main/java/sonia/scm/server/ScmServer.java | 8 +++++++- .../src/main/java/sonia/scm/server/ScmServerDaemon.java | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scm-server/src/main/java/sonia/scm/server/ScmServer.java b/scm-server/src/main/java/sonia/scm/server/ScmServer.java index 507e12a37f..76a3a114c9 100644 --- a/scm-server/src/main/java/sonia/scm/server/ScmServer.java +++ b/scm-server/src/main/java/sonia/scm/server/ScmServer.java @@ -52,6 +52,9 @@ public class ScmServer extends Thread /** Field description */ public static final String CONFIGURATION = "/server-config.xml"; + /** Field description */ + static final int GRACEFUL_TIMEOUT = 2000; + //~--- constructors --------------------------------------------------------- /** @@ -113,14 +116,17 @@ public class ScmServer extends Thread } /** - * Method description + * Stop embedded webserver. Use {@link Server#stop()} to fix windows service. * + * @see http://goo.gl/Zfy0Ev */ public void stopServer() { try { + server.setGracefulShutdown(GRACEFUL_TIMEOUT); server.setStopAtShutdown(true); + server.stop(); initialized = false; } catch (Exception ex) diff --git a/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java b/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java index 0799f7e69e..f7df769c30 100644 --- a/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java +++ b/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java @@ -86,7 +86,7 @@ public class ScmServerDaemon implements Daemon public static void stop(String[] args) throws Exception { webserver.stopServer(); - webserver.join(2000l); + webserver.join((long) ScmServer.GRACEFUL_TIMEOUT); } /** @@ -113,7 +113,8 @@ public class ScmServerDaemon implements Daemon public void init(DaemonContext context) throws DaemonInitException, Exception { daemonArgs = context.getArguments(); - // initialize web server and open port. We have to do this in the init + + // initialize web server and open port. We have to do this in the init // method, because this method is started by jsvc with super user privileges. webserver.init(); } From 067c8344a1978ae9a306aef9cd2b2cafa3d45c6a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 28 Aug 2014 16:29:04 +0200 Subject: [PATCH 03/68] close branch issue-623 From f26d693521eb6b8322b622ae57486c1d2e0487c0 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 18 Sep 2014 19:49:55 +0200 Subject: [PATCH 04/68] update mustache to 0.8.16 --- scm-webapp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index c03a6627f2..6332e5a8cd 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -521,7 +521,7 @@ 1.13.1 1.0 3.0.5 - 0.8.15 + 0.8.16 Tomcat From 0158992d933461b0ed7ab1c5c2911877d1be6d40 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 14:20:16 +0200 Subject: [PATCH 05/68] fix some problems with https --- .../src/main/webapp/WEB-INF/ftl/template/footer.html | 6 +++--- .../src/main/webapp/WEB-INF/ftl/template/header.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/footer.html b/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/footer.html index d511f70a38..4dea4d7e1e 100644 --- a/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/footer.html +++ b/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/footer.html @@ -1,6 +1,6 @@ - + - - + + diff --git a/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/header.html b/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/header.html index a1817abde0..0cc0de9fc5 100644 --- a/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/header.html +++ b/scm-plugin-backend/src/main/webapp/WEB-INF/ftl/template/header.html @@ -76,8 +76,8 @@
From 420f44a295aad38ea1195842ab3146e2d021a473 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 18:10:20 +0200 Subject: [PATCH 06/68] update jetty to version 7.6.16.v20140903 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3bd9a00b7..0673df0974 100644 --- a/pom.xml +++ b/pom.xml @@ -433,7 +433,7 @@ 1.18.1 2.6.6 2.3.20 - 7.6.15.v20140411 + 7.6.16.v20140903 1.2.3 From 0c671e9313f1808cd59ca79c0b17b0cfbde3dad5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 19:54:14 +0200 Subject: [PATCH 07/68] improve logging --- .../scm/plugin/AetherAuthenticationSelector.java | 13 +++++++++++++ .../sonia/scm/plugin/AetherDependencyResolver.java | 1 + 2 files changed, 14 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/AetherAuthenticationSelector.java b/scm-webapp/src/main/java/sonia/scm/plugin/AetherAuthenticationSelector.java index 9bc1bdb892..1f264940f8 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/AetherAuthenticationSelector.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/AetherAuthenticationSelector.java @@ -37,6 +37,9 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.sonatype.aether.repository.Authentication; import org.sonatype.aether.repository.AuthenticationSelector; import org.sonatype.aether.repository.RemoteRepository; @@ -55,6 +58,14 @@ import java.util.Map; public class AetherAuthenticationSelector implements AuthenticationSelector { + /** + * the logger for AetherAuthenticationSelector + */ + private static final Logger logger = + LoggerFactory.getLogger(AetherAuthenticationSelector.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -102,6 +113,8 @@ public class AetherAuthenticationSelector implements AuthenticationSelector if (server != null) { + logger.info("use user {} for repository wiht id {}", + server.getUsername(), repository.getId()); authentication = new Authentication(server.getUsername(), server.getPassword()); } diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/AetherDependencyResolver.java b/scm-webapp/src/main/java/sonia/scm/plugin/AetherDependencyResolver.java index 6505a8f5f2..ee0e9b586c 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/AetherDependencyResolver.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/AetherDependencyResolver.java @@ -171,6 +171,7 @@ public class AetherDependencyResolver { if (session == null) { + logger.info("create repository system session"); session = Aether.createRepositorySystemSession(system, localRepository, configuration, advancedPluginConfiguration); } From 03366bada21332a86c0cdb667e2395c9fe71fef7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 19:56:36 +0200 Subject: [PATCH 08/68] use schema less links for javadoc --- scm-core/src/main/javadoc/overview.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/javadoc/overview.html b/scm-core/src/main/javadoc/overview.html index 208a72facb..c6deba5cf3 100644 --- a/scm-core/src/main/javadoc/overview.html +++ b/scm-core/src/main/javadoc/overview.html @@ -39,7 +39,7 @@

- + SCM-Manager

@@ -62,7 +62,7 @@

Architecture

- Architecture Overview + Architecture Overview
From 0f5159bc3917bda609b9400f2412b1502a7b8483 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 19:58:24 +0200 Subject: [PATCH 09/68] [maven-release-plugin] prepare release 1.41 --- 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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index abfd06ef62..a1a52156f8 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm.maven scm-maven-plugins pom - 1.41-SNAPSHOT + 1.41 scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index d675e95acf..b34e754a58 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.41-SNAPSHOT + 1.41 sonia.scm.maven scm-maven-plugin - 1.41-SNAPSHOT + 1.41 maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 818e5d5e55..1675af1caf 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.41-SNAPSHOT + 1.41 sonia.scm.maven scm-plugin-archetype - 1.41-SNAPSHOT + 1.41 scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 0673df0974..4b9f66194a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.41-SNAPSHOT + 1.41 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.41 diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 911d918a1c..b427573444 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm.clients scm-clients pom - 1.41-SNAPSHOT + 1.41 scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.41-SNAPSHOT + 1.41 shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 40044a745a..83794a78e1 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.41-SNAPSHOT + 1.41 sonia.scm.clients scm-cli-client - 1.41-SNAPSHOT + 1.41 scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.41-SNAPSHOT + 1.41 diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 1d4f9396f5..69b741d7af 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.41-SNAPSHOT + 1.41 sonia.scm.clients scm-client-api jar - 1.41-SNAPSHOT + 1.41 scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index ee8f684717..8f18122f49 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.41-SNAPSHOT + 1.41 sonia.scm.clients scm-client-impl jar - 1.41-SNAPSHOT + 1.41 scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.41-SNAPSHOT + 1.41 @@ -64,7 +64,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index f27f3e1b79..3f969b40cb 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 9fb21ee27d..b704778943 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-dao-orientdb - 1.41-SNAPSHOT + 1.41 scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index 86536aede2..331578a1c5 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-dao-xml - 1.41-SNAPSHOT + 1.41 scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index d6f9e2c4da..31dbdd3332 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-plugin-backend war - 1.41-SNAPSHOT + 1.41 ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index d7ee0f6d0d..59c7ba60f6 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-plugins pom - 1.41-SNAPSHOT + 1.41 scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.41-SNAPSHOT + 1.41 process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 4f501908e7..b7a88b4a10 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.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-git-plugin - 1.41-SNAPSHOT + 1.41 scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 61014dfaa3..51c50e159d 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.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-hg-plugin - 1.41-SNAPSHOT + 1.41 scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -36,7 +36,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index cc536e136c..67e9e6b923 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.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-svn-plugin - 1.41-SNAPSHOT + 1.41 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.41-SNAPSHOT + 1.41 test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index d185a77dc5..27234639de 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm.samples scm-samples pom - 1.41-SNAPSHOT + 1.41 scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 8326546081..4e9277363a 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.41-SNAPSHOT + 1.41 sonia.scm.sample scm-sample-auth - 1.41-SNAPSHOT + 1.41 scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 2e57f7f6f6..9976e769f1 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.41-SNAPSHOT + 1.41 sonia.scm.sample scm-sample-hello - 1.41-SNAPSHOT + 1.41 scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 diff --git a/scm-server/pom.xml b/scm-server/pom.xml index c9f7e43447..399b899fbb 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-server - 1.41-SNAPSHOT + 1.41 scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index bb7c18e19e..592e1c585d 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index 6332e5a8cd..854d5d9d54 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm scm-webapp war - 1.41-SNAPSHOT + 1.41 scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 sonia.scm scm-dao-xml - 1.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-hg-plugin - 1.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-svn-plugin - 1.41-SNAPSHOT + 1.41 sonia.scm.plugins scm-git-plugin - 1.41-SNAPSHOT + 1.41 @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.41-SNAPSHOT + 1.41 test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.41-SNAPSHOT + 1.41 tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.41-SNAPSHOT + 1.41 tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.41-SNAPSHOT + 1.41 tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.41-SNAPSHOT + 1.41 diff --git a/support/pom.xml b/support/pom.xml index 99f56dd5d7..aec9819a14 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41-SNAPSHOT + 1.41 sonia.scm.support scm-support pom - 1.41-SNAPSHOT + 1.41 scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index 602e1239a0..d19c58d66b 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.41-SNAPSHOT + 1.41 sonia.scm scm-support-btrace - 1.41-SNAPSHOT + 1.41 jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.41-SNAPSHOT + 1.41 From 491c01466334edd581afe5bdde326d54d51ed4c9 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 19:58:24 +0200 Subject: [PATCH 10/68] [maven-release-plugin] copy for tag 1.41 From 1e7f9ccca9b2f1a248679106c55296ee05397fee Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 28 Sep 2014 19:58:25 +0200 Subject: [PATCH 11/68] [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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index a1a52156f8..28acec9a76 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm.maven scm-maven-plugins pom - 1.41 + 1.42-SNAPSHOT scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index b34e754a58..b0ebd8c3f3 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.41 + 1.42-SNAPSHOT sonia.scm.maven scm-maven-plugin - 1.41 + 1.42-SNAPSHOT maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 1675af1caf..3914a3a467 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.41 + 1.42-SNAPSHOT sonia.scm.maven scm-plugin-archetype - 1.41 + 1.42-SNAPSHOT scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 4b9f66194a..9869cc1097 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.41 + 1.42-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.41 + HEAD diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index b427573444..18ccdb48ad 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm.clients scm-clients pom - 1.41 + 1.42-SNAPSHOT scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.41 + 1.42-SNAPSHOT shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 83794a78e1..9283e283d8 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.41 + 1.42-SNAPSHOT sonia.scm.clients scm-cli-client - 1.41 + 1.42-SNAPSHOT scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.41 + 1.42-SNAPSHOT diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 69b741d7af..f7b11eab71 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.41 + 1.42-SNAPSHOT sonia.scm.clients scm-client-api jar - 1.41 + 1.42-SNAPSHOT scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 8f18122f49..058bde892a 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.41 + 1.42-SNAPSHOT sonia.scm.clients scm-client-impl jar - 1.41 + 1.42-SNAPSHOT scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.41 + 1.42-SNAPSHOT @@ -64,7 +64,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index 3f969b40cb..5668daa4ae 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index b704778943..50081eebe6 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-dao-orientdb - 1.41 + 1.42-SNAPSHOT scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index 331578a1c5..95f98d99fa 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-dao-xml - 1.41 + 1.42-SNAPSHOT scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 31dbdd3332..727ac3f263 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-plugin-backend war - 1.41 + 1.42-SNAPSHOT ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index 59c7ba60f6..59823a33e9 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-plugins pom - 1.41 + 1.42-SNAPSHOT scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.41 + 1.42-SNAPSHOT process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index b7a88b4a10..7a950ce5f9 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.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.41 + 1.42-SNAPSHOT scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 51c50e159d..b7f70b9e61 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.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.41 + 1.42-SNAPSHOT scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -36,7 +36,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index 67e9e6b923..a659cd6364 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.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.41 + 1.42-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.41 + 1.42-SNAPSHOT test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 27234639de..55a765cee4 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm.samples scm-samples pom - 1.41 + 1.42-SNAPSHOT scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 4e9277363a..8de7ea24be 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.41 + 1.42-SNAPSHOT sonia.scm.sample scm-sample-auth - 1.41 + 1.42-SNAPSHOT scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 9976e769f1..c6f890f8c2 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.41 + 1.42-SNAPSHOT sonia.scm.sample scm-sample-hello - 1.41 + 1.42-SNAPSHOT scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 399b899fbb..05d61f3f6d 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-server - 1.41 + 1.42-SNAPSHOT scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index 592e1c585d..161d2064cb 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index 854d5d9d54..be1cbec3ca 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm scm-webapp war - 1.41 + 1.42-SNAPSHOT scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT sonia.scm scm-dao-xml - 1.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.41 + 1.42-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.41 + 1.42-SNAPSHOT @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.41 + 1.42-SNAPSHOT test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.41 + 1.42-SNAPSHOT tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.41 + 1.42-SNAPSHOT tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.41 + 1.42-SNAPSHOT tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.41 + 1.42-SNAPSHOT diff --git a/support/pom.xml b/support/pom.xml index aec9819a14..1c1ba77c19 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.41 + 1.42-SNAPSHOT sonia.scm.support scm-support pom - 1.41 + 1.42-SNAPSHOT scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index d19c58d66b..197cfa8f3f 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.41 + 1.42-SNAPSHOT sonia.scm scm-support-btrace - 1.41 + 1.42-SNAPSHOT jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.41 + 1.42-SNAPSHOT From ef1cbf4deea565f7c384e7e7a9fded0a60e13674 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 7 Oct 2014 20:28:37 +0200 Subject: [PATCH 12/68] use base uri from request for git quick repository view, see issue #631 --- .../java/sonia/scm/web/GitRepositoryViewer.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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 aff932350d..1c01ef2fc1 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 @@ -44,7 +44,6 @@ import com.google.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sonia.scm.config.ScmConfiguration; import sonia.scm.repository.Branch; import sonia.scm.repository.Branches; import sonia.scm.repository.Changeset; @@ -60,6 +59,7 @@ import sonia.scm.template.TemplateEngineFactory; import sonia.scm.url.RepositoryUrlProvider; import sonia.scm.url.UrlProvider; import sonia.scm.url.UrlProviderFactory; +import sonia.scm.util.HttpUtil; import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ @@ -84,7 +84,8 @@ public class GitRepositoryViewer public static final String MIMETYPE_HTML = "text/html"; /** Field description */ - public static final String RESOURCE_GITINDEX = "/sonia/scm/git.index.mustache"; + public static final String RESOURCE_GITINDEX = + "/sonia/scm/git.index.mustache"; /** Field description */ private static final int CHANGESET_PER_BRANCH = 10; @@ -103,16 +104,13 @@ public class GitRepositoryViewer * * @param templateEngineFactory * @param repositoryServiceFactory - * @param configuration */ @Inject public GitRepositoryViewer(TemplateEngineFactory templateEngineFactory, - RepositoryServiceFactory repositoryServiceFactory, - ScmConfiguration configuration) + RepositoryServiceFactory repositoryServiceFactory) { this.templateEngineFactory = templateEngineFactory; this.repositoryServiceFactory = repositoryServiceFactory; - this.configuration = configuration; } //~--- methods -------------------------------------------------------------- @@ -134,7 +132,9 @@ public class GitRepositoryViewer throws RepositoryException, IOException { - String baseUrl = configuration.getBaseUrl(); + String baseUrl = HttpUtil.getCompleteUrl(request); + + logger.trace("render git repository quick view with base url {}", baseUrl); UrlProvider urlProvider = UrlProviderFactory.createUrlProvider(baseUrl, UrlProviderFactory.TYPE_WUI); @@ -452,9 +452,6 @@ public class GitRepositoryViewer //~--- fields --------------------------------------------------------------- - /** Field description */ - private final ScmConfiguration configuration; - /** Field description */ private final RepositoryServiceFactory repositoryServiceFactory; From 920921d19c45df217466fc0c33786256db449bfd Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 9 Oct 2014 13:22:42 +0200 Subject: [PATCH 13/68] implement util class for AutoLoginModules to mark request as completed or send redirects from an AutoLoginModule --- .../sonia/scm/web/filter/AutoLoginFilter.java | 52 ++++---- .../scm/web/filter/AutoLoginModules.java | 111 +++++++++++++++ .../web/filter/BasicAuthenticationFilter.java | 126 +++++++++++------- 3 files changed, 217 insertions(+), 72 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/web/filter/AutoLoginModules.java diff --git a/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginFilter.java b/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginFilter.java index 412a4db515..8f2d5219f6 100644 --- a/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginFilter.java +++ b/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginFilter.java @@ -100,33 +100,37 @@ public class AutoLoginFilter extends HttpFilter { * @return The user or null if no user was found. */ protected User getAuthenticatedUser(HttpServletRequest request, - HttpServletResponse response) { - Subject subject = SecurityUtils.getSubject(); - User user = null; + HttpServletResponse response) + { + Subject subject = SecurityUtils.getSubject(); + User user = null; - if (subject.isAuthenticated() || subject.isRemembered()) { - if (logger.isTraceEnabled()) { - logger.trace("user is allready authenticated"); - } + if (subject.isAuthenticated() || subject.isRemembered()) + { + logger.trace("user is allready authenticated"); + user = subject.getPrincipals().oneByType(User.class); + } + else + { + // Try the known filters first + for (AutoLoginModule filter : autoLoginModules) + { + user = filter.authenticate(request, response, subject); - user = subject.getPrincipals().oneByType(User.class); - } else { - // Try the known filters first - for (AutoLoginModule filter : autoLoginModules) { - user = filter.authenticate(request, response, subject); + if (user != null) + { + logger.trace("user {} successfully authenticated by authentication filter", user.getName()); + break; + } + else if (AutoLoginModules.isComplete(request)) + { + logger.debug("stop auto login chain, because the AutoLoginModule {} marked the request as complete", filter.getClass()); + break; + } + } + } - if (user != null) { - if (logger.isTraceEnabled()) { - logger.trace( - "user {} successfully authenticated by authentication filter", - user.getName()); - } - break; - } - } - } - - return user; + return user; } /** diff --git a/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginModules.java b/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginModules.java new file mode 100644 index 0000000000..ae3010d4be --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/web/filter/AutoLoginModules.java @@ -0,0 +1,111 @@ +/** +* 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.web.filter; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Helper methods for implementations of the {@link AutoLoginModule}. + * + * @author Sebastian Sdorra + * + * @since 1.42 + */ +public final class AutoLoginModules +{ + + /** Field description */ + private static final String FLAG_COMPLETE = + AutoLoginModules.class.getName().concat("complete"); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + */ + private AutoLoginModules() {} + + //~--- methods -------------------------------------------------------------- + + /** + * Mark the request as completed. No further actions will be executed. + * + * @param request http servlet request + */ + public static void markAsComplete(HttpServletRequest request) + { + request.setAttribute(FLAG_COMPLETE, Boolean.TRUE); + } + + /** + * Sends a redirect to the specified url and marks the request as completed. + * This method is useful for SSO solutions which have to redirect the user + * to a central login page. This method must be used in favor of + * {@link HttpServletResponse#sendRedirect(java.lang.String)} which could + * result in an error. + * + * @param request http servlet request + * @param response http servlet response + * @param url redirect target + * + * @throws IOException if client could not be redirected + */ + public static void sendRedirect(HttpServletRequest request, + HttpServletResponse response, String url) + throws IOException + { + markAsComplete(request); + response.sendRedirect(url); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns {@code true} is the request is marked as complete. + * + * @param request http servlet request + * + * @return {@code true} if request is complete + */ + public static boolean isComplete(HttpServletRequest request) + { + return request.getAttribute(FLAG_COMPLETE) != null; + } +} 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 38532ff3ac..408c0ca16e 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 @@ -139,60 +139,17 @@ public class BasicAuthenticationFilter extends AutoLoginFilter throws IOException, ServletException { Subject subject = SecurityUtils.getSubject(); + // get authenticated user or process AutoLoginModule's User user = getAuthenticatedUser(request, response); - // Fallback to basic authentication scheme - if (user == null) + if (AutoLoginModules.isComplete(request)) { - String authentication = request.getHeader(HEADER_AUTHORIZATION); - - if (Util.startWithIgnoreCase(authentication, AUTHORIZATION_BASIC_PREFIX)) - { - if (logger.isTraceEnabled()) - { - logger.trace( - "found basic authorization header, start authentication"); - } - - user = authenticate(request, response, subject, 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 ((configuration != null) - && configuration.isAnonymousAccessEnabled()) - { - if (logger.isTraceEnabled()) - { - logger.trace("anonymous access granted"); - } - - user = SCMContext.ANONYMOUS; - } - } - - if (user == null) - { - if (logger.isTraceEnabled()) - { - logger.trace("could not find user send unauthorized"); - } - - handleUnauthorized(request, response, chain); + logger.debug("request marked as complete from an auto login module"); } else { - chain.doFilter(new SecurityHttpServletRequestWrapper(request, user), - response); + // process with basic authentication + processRequest(request, response, chain, subject, user); } } @@ -331,6 +288,79 @@ public class BasicAuthenticationFilter extends AutoLoginFilter return user; } + /** + * Method description + * + * + * @param request + * @param response + * @param chain + * @param subject + * @param user + * + * @throws IOException + * @throws ServletException + */ + private void processRequest(HttpServletRequest request, + HttpServletResponse response, FilterChain chain, Subject subject, User user) + throws IOException, ServletException + { + + // Fallback to basic authentication scheme + if (user == null) + { + String authentication = request.getHeader(HEADER_AUTHORIZATION); + + if (Util.startWithIgnoreCase(authentication, AUTHORIZATION_BASIC_PREFIX)) + { + if (logger.isTraceEnabled()) + { + logger.trace( + "found basic authorization header, start authentication"); + } + + user = authenticate(request, response, subject, 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 ((configuration != null) + && configuration.isAnonymousAccessEnabled()) + { + if (logger.isTraceEnabled()) + { + logger.trace("anonymous access granted"); + } + + user = SCMContext.ANONYMOUS; + } + } + + if (user == null) + { + if (logger.isTraceEnabled()) + { + logger.trace("could not find user send unauthorized"); + } + + handleUnauthorized(request, response, chain); + } + else + { + chain.doFilter(new SecurityHttpServletRequestWrapper(request, user), + response); + } + } + //~--- fields --------------------------------------------------------------- /** scm main configuration */ From 11f84a38f4d37eb1ba9d9f28b0870a61f46382a1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 9 Oct 2014 16:41:11 +0200 Subject: [PATCH 14/68] added extension point for HttpSessionListener --- .../sonia/scm/HttpSessionListenerHolder.java | 170 ++++++++++++++++++ .../sonia/scm/plugin/DefaultPluginLoader.java | 9 + scm-webapp/src/main/webapp/WEB-INF/web.xml | 4 + 3 files changed, 183 insertions(+) create mode 100644 scm-webapp/src/main/java/sonia/scm/HttpSessionListenerHolder.java diff --git a/scm-webapp/src/main/java/sonia/scm/HttpSessionListenerHolder.java b/scm-webapp/src/main/java/sonia/scm/HttpSessionListenerHolder.java new file mode 100644 index 0000000000..9f4f3c1b50 --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/HttpSessionListenerHolder.java @@ -0,0 +1,170 @@ + +package sonia.scm; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.Sets; +import com.google.inject.Injector; +import com.google.inject.Key; +import com.google.inject.TypeLiteral; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Set; +import javax.servlet.ServletContext; + +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionListener; +import sonia.scm.plugin.ext.Extension; + +/** + * Dispatcher for {@link HttpSessionEvent}. The {@link HttpSessionListenerHolder} + * loads all registered {@link HttpSessionListener}s from the {@link Injector} + * and delegates the events to the them. {@link HttpSessionListener} can be + * registered with the {@link Extension} annotation. + * + * @author Sebastian Sdorra + * @since 1.42 + */ +public class HttpSessionListenerHolder implements HttpSessionListener +{ + + /** key type of the session listeners */ + private static final Key> KEY = + Key.get(new TypeLiteral>() {} + ); + + /** logger for HttpSessionListenerHolder */ + private static final Logger logger = + LoggerFactory.getLogger(HttpSessionListenerHolder.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs a new HttpSessionListenerHolder. + * + */ + public HttpSessionListenerHolder() + { + if (logger.isDebugEnabled()) + { + logger.debug("create instance of {}", + HttpSessionListenerHolder.class.getName()); + } + } + + //~--- methods -------------------------------------------------------------- + + /** + * Delegates the create session event to all registered + * {@ĺink HttpSessionListener}s. + * + * + * @param event session event + */ + @Override + public void sessionCreated(HttpSessionEvent event) + { + if (listenerSet == null) + { + listenerSet = loadListeners(event); + } + + dispatch(event, true); + } + + /** + * Delegates the destroy session event to all registered + * {@ĺink HttpSessionListener}s. + * + * + * @param event session event + */ + @Override + public void sessionDestroyed(HttpSessionEvent event) + { + dispatch(event, false); + } + + /** + * Dispatch session events. + * + * + * @param event session event + * @param create {@code true} if the event is a create event + */ + private void dispatch(HttpSessionEvent event, boolean create) + { + if (listenerSet != null) + { + for (HttpSessionListener listener : listenerSet) + { + if (create) + { + listener.sessionCreated(event); + } + else + { + listener.sessionDestroyed(event); + } + } + } + else + { + logger.warn( + "could not dispatch session event, because holder is not initialized"); + } + } + + /** + * Load listeners from {@link Injector} which is stored in the + * {@link ServletContext}. + * + * + * @param event session event + * + * @return set of session listeners + */ + private synchronized Set loadListeners( + HttpSessionEvent event) + { + Set listeners = null; + HttpSession session = event.getSession(); + + if (session != null) + { + Injector injector = (Injector) session.getServletContext().getAttribute( + Injector.class.getName()); + + if (injector != null) + { + logger.debug("load HttpSessionListeners from injector"); + listeners = injector.getInstance(KEY); + } + else + { + logger.error("could not find injector in servletContext"); + } + + if (listeners == null) + { + listeners = Sets.newHashSet(); + } + } + else + { + logger.warn("received session event without session"); + } + + return listeners; + } + + //~--- fields --------------------------------------------------------------- + + /** listener set */ + private Set listenerSet; +} diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginLoader.java b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginLoader.java index 2d8e3fbc07..77fada9018 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginLoader.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginLoader.java @@ -77,6 +77,7 @@ import java.util.Set; import javax.servlet.ServletContext; import javax.servlet.ServletContextListener; +import javax.servlet.http.HttpSessionListener; import javax.xml.bind.JAXB; @@ -563,12 +564,20 @@ public class DefaultPluginLoader implements PluginLoader //J- extensionPoints = extensionPointCollector.getAnnotatedClasses(); + // add ServletContextListener to list of extension points extensionPoints.add( new AnnotatedClass( Extensions.createExtensionPoint(true), ServletContextListener.class ) ); + // add HttpSessionListener to list of extension points + extensionPoints.add( + new AnnotatedClass( + Extensions.createExtensionPoint(true), + HttpSessionListener.class + ) + ); extensions = extensionCollector.getAnnotatedClasses(); extensions.add( diff --git a/scm-webapp/src/main/webapp/WEB-INF/web.xml b/scm-webapp/src/main/webapp/WEB-INF/web.xml index 877240f765..513c708e80 100644 --- a/scm-webapp/src/main/webapp/WEB-INF/web.xml +++ b/scm-webapp/src/main/webapp/WEB-INF/web.xml @@ -42,6 +42,10 @@ sonia.scm.boot.BootstrapListener + + + sonia.scm.HttpSessionListenerHolder + guiceFilter From 936fb75ce78933de8eabd5cccfb03a74a37b1f33 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 9 Oct 2014 16:45:56 +0200 Subject: [PATCH 15/68] close branch issue-631 From 5fdb474f9523ee6728f447edc21e44ae8d9a0229 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 18 Oct 2014 13:53:55 +0200 Subject: [PATCH 16/68] added comment about POODLE vulnerability to https configuration --- scm-server/src/main/conf/server-config.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scm-server/src/main/conf/server-config.xml b/scm-server/src/main/conf/server-config.xml index f55553ab45..d3424affa3 100644 --- a/scm-server/src/main/conf/server-config.xml +++ b/scm-server/src/main/conf/server-config.xml @@ -142,9 +142,23 @@ http://wiki.eclipse.org/Jetty/Reference/SSL_Connectors --> + - 1.9.5 + 1.10.8 1.3 4.11 From 6256cea4ce3f423772588f63f54791eee92d11c7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 18 Oct 2014 15:14:22 +0200 Subject: [PATCH 18/68] update mustache to version 0.8.17 --- scm-webapp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index be1cbec3ca..d6e66233e6 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -521,7 +521,7 @@ 1.13.1 1.0 3.0.5 - 0.8.16 + 0.8.17 Tomcat From 9b4bfc5cc5a24dc895dae20f542e13d0b0492a85 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 20 Oct 2014 09:34:52 +0200 Subject: [PATCH 19/68] [maven-release-plugin] prepare release 1.42 --- 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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index 28acec9a76..3c6ee65a37 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm.maven scm-maven-plugins pom - 1.42-SNAPSHOT + 1.42 scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index b0ebd8c3f3..55590e027b 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.42-SNAPSHOT + 1.42 sonia.scm.maven scm-maven-plugin - 1.42-SNAPSHOT + 1.42 maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 3914a3a467..0c4f10960c 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.42-SNAPSHOT + 1.42 sonia.scm.maven scm-plugin-archetype - 1.42-SNAPSHOT + 1.42 scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 76205f3d68..67800a8822 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.42-SNAPSHOT + 1.42 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.42 diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 18ccdb48ad..3df344fcbf 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm.clients scm-clients pom - 1.42-SNAPSHOT + 1.42 scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.42-SNAPSHOT + 1.42 shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 9283e283d8..6136167729 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.42-SNAPSHOT + 1.42 sonia.scm.clients scm-cli-client - 1.42-SNAPSHOT + 1.42 scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.42-SNAPSHOT + 1.42 diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index f7b11eab71..7a6090a59b 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.42-SNAPSHOT + 1.42 sonia.scm.clients scm-client-api jar - 1.42-SNAPSHOT + 1.42 scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 058bde892a..a8f0cb2a11 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.42-SNAPSHOT + 1.42 sonia.scm.clients scm-client-impl jar - 1.42-SNAPSHOT + 1.42 scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.42-SNAPSHOT + 1.42 @@ -64,7 +64,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index 5668daa4ae..45592d5085 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 50081eebe6..cb7b2140fb 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-dao-orientdb - 1.42-SNAPSHOT + 1.42 scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index 95f98d99fa..bfcb73ba9c 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-dao-xml - 1.42-SNAPSHOT + 1.42 scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 727ac3f263..46f804d93b 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-plugin-backend war - 1.42-SNAPSHOT + 1.42 ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index 59823a33e9..d495095fe1 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-plugins pom - 1.42-SNAPSHOT + 1.42 scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.42-SNAPSHOT + 1.42 process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 7a950ce5f9..7cf8f76f29 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.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-git-plugin - 1.42-SNAPSHOT + 1.42 scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index b7f70b9e61..3191c54a57 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.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-hg-plugin - 1.42-SNAPSHOT + 1.42 scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -36,7 +36,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index a659cd6364..1ca515ce59 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.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-svn-plugin - 1.42-SNAPSHOT + 1.42 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.42-SNAPSHOT + 1.42 test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 55a765cee4..7959189e0a 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm.samples scm-samples pom - 1.42-SNAPSHOT + 1.42 scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 8de7ea24be..a18905db10 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.42-SNAPSHOT + 1.42 sonia.scm.sample scm-sample-auth - 1.42-SNAPSHOT + 1.42 scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index c6f890f8c2..f4479504d8 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.42-SNAPSHOT + 1.42 sonia.scm.sample scm-sample-hello - 1.42-SNAPSHOT + 1.42 scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 05d61f3f6d..cbc3533021 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-server - 1.42-SNAPSHOT + 1.42 scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index 161d2064cb..ce8251b7cd 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index d6e66233e6..557559eba1 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm scm-webapp war - 1.42-SNAPSHOT + 1.42 scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 sonia.scm scm-dao-xml - 1.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-hg-plugin - 1.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-svn-plugin - 1.42-SNAPSHOT + 1.42 sonia.scm.plugins scm-git-plugin - 1.42-SNAPSHOT + 1.42 @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.42-SNAPSHOT + 1.42 test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.42-SNAPSHOT + 1.42 tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.42-SNAPSHOT + 1.42 tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.42-SNAPSHOT + 1.42 tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.42-SNAPSHOT + 1.42 diff --git a/support/pom.xml b/support/pom.xml index 1c1ba77c19..f9ee81b4f3 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42-SNAPSHOT + 1.42 sonia.scm.support scm-support pom - 1.42-SNAPSHOT + 1.42 scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index 197cfa8f3f..cbc0543ef9 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.42-SNAPSHOT + 1.42 sonia.scm scm-support-btrace - 1.42-SNAPSHOT + 1.42 jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.42-SNAPSHOT + 1.42 From 931dbfef1f6e0d411b224f5670bc0d28e91cc3e8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 20 Oct 2014 09:34:52 +0200 Subject: [PATCH 20/68] [maven-release-plugin] copy for tag 1.42 From 2c614e48025e845670aabd3c9ae8de03b8f207e5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 20 Oct 2014 09:34:53 +0200 Subject: [PATCH 21/68] [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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index 3c6ee65a37..473d1bc51a 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm.maven scm-maven-plugins pom - 1.42 + 1.43-SNAPSHOT scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index 55590e027b..839090e2c5 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.42 + 1.43-SNAPSHOT sonia.scm.maven scm-maven-plugin - 1.42 + 1.43-SNAPSHOT maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 0c4f10960c..e27acf929e 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.42 + 1.43-SNAPSHOT sonia.scm.maven scm-plugin-archetype - 1.42 + 1.43-SNAPSHOT scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 67800a8822..49d2d267ab 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.42 + 1.43-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.42 + HEAD diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 3df344fcbf..87234b5cab 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm.clients scm-clients pom - 1.42 + 1.43-SNAPSHOT scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.42 + 1.43-SNAPSHOT shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 6136167729..2d3e28f780 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.42 + 1.43-SNAPSHOT sonia.scm.clients scm-cli-client - 1.42 + 1.43-SNAPSHOT scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.42 + 1.43-SNAPSHOT diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 7a6090a59b..0a024a8802 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.42 + 1.43-SNAPSHOT sonia.scm.clients scm-client-api jar - 1.42 + 1.43-SNAPSHOT scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index a8f0cb2a11..7bec66f275 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.42 + 1.43-SNAPSHOT sonia.scm.clients scm-client-impl jar - 1.42 + 1.43-SNAPSHOT scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.42 + 1.43-SNAPSHOT @@ -64,7 +64,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index 45592d5085..9850e1d7f4 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index cb7b2140fb..16b9f72d86 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-dao-orientdb - 1.42 + 1.43-SNAPSHOT scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index bfcb73ba9c..04506fca8c 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-dao-xml - 1.42 + 1.43-SNAPSHOT scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 46f804d93b..832ab5f679 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-plugin-backend war - 1.42 + 1.43-SNAPSHOT ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index d495095fe1..100a14e44b 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-plugins pom - 1.42 + 1.43-SNAPSHOT scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.42 + 1.43-SNAPSHOT process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 7cf8f76f29..4238206529 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.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.42 + 1.43-SNAPSHOT scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 3191c54a57..8931ce9e14 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.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.42 + 1.43-SNAPSHOT scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -36,7 +36,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index 1ca515ce59..d7069097d2 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.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.42 + 1.43-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.42 + 1.43-SNAPSHOT test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 7959189e0a..842b0292dd 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm.samples scm-samples pom - 1.42 + 1.43-SNAPSHOT scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index a18905db10..49b2e13326 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.42 + 1.43-SNAPSHOT sonia.scm.sample scm-sample-auth - 1.42 + 1.43-SNAPSHOT scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index f4479504d8..715210f5bd 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.42 + 1.43-SNAPSHOT sonia.scm.sample scm-sample-hello - 1.42 + 1.43-SNAPSHOT scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT diff --git a/scm-server/pom.xml b/scm-server/pom.xml index cbc3533021..389a96db33 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-server - 1.42 + 1.43-SNAPSHOT scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index ce8251b7cd..8e3cb9edc9 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index 557559eba1..b230c7cb7e 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm scm-webapp war - 1.42 + 1.43-SNAPSHOT scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT sonia.scm scm-dao-xml - 1.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.42 + 1.43-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.42 + 1.43-SNAPSHOT @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.42 + 1.43-SNAPSHOT test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.42 + 1.43-SNAPSHOT tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.42 + 1.43-SNAPSHOT tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.42 + 1.43-SNAPSHOT tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.42 + 1.43-SNAPSHOT diff --git a/support/pom.xml b/support/pom.xml index f9ee81b4f3..8e7e484492 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.42 + 1.43-SNAPSHOT sonia.scm.support scm-support pom - 1.42 + 1.43-SNAPSHOT scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index cbc0543ef9..4d8e6bf772 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.42 + 1.43-SNAPSHOT sonia.scm scm-support-btrace - 1.42 + 1.43-SNAPSHOT jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.42 + 1.43-SNAPSHOT From 4436d14a5f2533837045c13dfb195812f8639dc9 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 29 Oct 2014 21:35:10 +0100 Subject: [PATCH 22/68] added support for remote urls to push and pull api --- .../repository/api/PullCommandBuilder.java | 34 ++++++++++++ .../repository/api/PushCommandBuilder.java | 44 ++++++++++++++- .../repository/spi/PullCommandRequest.java | 3 +- .../repository/spi/PushCommandRequest.java | 1 + .../repository/spi/RemoteCommandRequest.java | 55 +++++++++++++++++-- 5 files changed, 131 insertions(+), 6 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/PullCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/PullCommandBuilder.java index 1e170d999e..528c93eef9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/PullCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/PullCommandBuilder.java @@ -50,6 +50,7 @@ import sonia.scm.security.RepositoryPermission; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; +import java.net.URL; /** * The pull command pull changes from a other repository. @@ -83,6 +84,38 @@ public final class PullCommandBuilder //~--- methods -------------------------------------------------------------- + /** + * Pull all changes from the given remote url. + * + * + * @param url remote url + * + * @return informations over the executed pull command + * + * @throws IOException + * @throws RepositoryException + * + * @since 1.43 + */ + public PullResponse pull(String url) + throws IOException, RepositoryException + { + Subject subject = SecurityUtils.getSubject(); + //J- + subject.checkPermission( + new RepositoryPermission(localRepository, PermissionType.WRITE) + ); + //J+ + + URL remoteUrl = new URL(url); + request.reset(); + request.setRemoteUrl(remoteUrl); + + logger.info("pull changes from url {}", url); + + return command.pull(request); + } + /** * Pull all changes from the given remote repository. * @@ -108,6 +141,7 @@ public final class PullCommandBuilder ); //J+ + request.reset(); request.setRemoteRepository(remoteRepository); logger.info("pull changes from {}", remoteRepository); diff --git a/scm-core/src/main/java/sonia/scm/repository/api/PushCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/PushCommandBuilder.java index 5737997442..fabe938ff7 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/PushCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/PushCommandBuilder.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.api; //~--- non-JDK imports -------------------------------------------------------- @@ -37,6 +38,9 @@ package sonia.scm.repository.api; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.repository.PermissionType; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; @@ -48,15 +52,25 @@ import sonia.scm.security.RepositoryPermission; import java.io.IOException; +import java.net.URL; + /** * The push command push changes to a other repository. - * + * * @author Sebastian Sdorra * @since 1.31 */ public final class PushCommandBuilder { + /** + * the logger for PushCommandBuilder + */ + private static final Logger logger = + LoggerFactory.getLogger(PushCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs a new PushCommandBuilder. * @@ -90,11 +104,39 @@ public final class PushCommandBuilder ); //J+ + logger.info("push changes to repository {}", remoteRepository.getId()); + + request.reset(); request.setRemoteRepository(remoteRepository); return command.push(request); } + /** + * Push all changes to the given remote url. + * + * @param url url of a remote repository + * + * @return informations of the executed push command + * + * @throws IOException + * @throws RepositoryException + * + * @since 1.43 + */ + public PushResponse push(String url) throws IOException, RepositoryException + { + + URL remoteUrl = new URL(url); + + logger.info("push changes to url {}", url); + + request.reset(); + request.setRemoteUrl(remoteUrl); + + return command.push(request); + } + //~--- fields --------------------------------------------------------------- /** push command implementation */ diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/PullCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/PullCommandRequest.java index be1305b4db..274e124f5e 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/PullCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/PullCommandRequest.java @@ -33,7 +33,8 @@ package sonia.scm.repository.spi; /** - * + * Request object for {@link PullCommand}. + * * @author Sebastian Sdorra * @since 1.31 */ diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/PushCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/PushCommandRequest.java index d1f51e427e..679e93f1bb 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/PushCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/PushCommandRequest.java @@ -33,6 +33,7 @@ package sonia.scm.repository.spi; /** + * Request object for {@link PushCommand}. * * @author Sebastian Sdorra * @since 1.31 diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RemoteCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/RemoteCommandRequest.java index 949b56efa7..0f3cd909d9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/RemoteCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/RemoteCommandRequest.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -38,12 +39,16 @@ import com.google.common.base.Objects; import sonia.scm.repository.Repository; +//~--- JDK imports ------------------------------------------------------------ + +import java.net.URL; + /** * * @author Sebastian Sdorra * @since 1.31 */ -public abstract class RemoteCommandRequest +public abstract class RemoteCommandRequest implements Resetable { /** @@ -64,7 +69,8 @@ public abstract class RemoteCommandRequest final RemoteCommandRequest other = (RemoteCommandRequest) obj; - return Objects.equal(remoteRepository, other.remoteRepository); + return Objects.equal(remoteRepository, other.remoteRepository) + && Objects.equal(remoteUrl, other.remoteUrl); } /** @@ -73,7 +79,19 @@ public abstract class RemoteCommandRequest @Override public int hashCode() { - return Objects.hashCode(remoteRepository); + return Objects.hashCode(remoteRepository, remoteUrl); + } + + /** + * Resets the request object. + * + * @since 1.43 + */ + @Override + public void reset() + { + remoteRepository = null; + remoteUrl = null; } /** @@ -82,10 +100,10 @@ public abstract class RemoteCommandRequest @Override public String toString() { - //J- return Objects.toStringHelper(this) .add("remoteRepository", remoteRepository) + .add("remoteUrl", remoteUrl) .toString(); //J+ } @@ -102,6 +120,19 @@ public abstract class RemoteCommandRequest this.remoteRepository = remoteRepository; } + /** + * Method description + * + * + * @param remoteUrl + * + * @since 1.43 + */ + public void setRemoteUrl(URL remoteUrl) + { + this.remoteUrl = remoteUrl; + } + //~--- get methods ---------------------------------------------------------- /** @@ -115,8 +146,24 @@ public abstract class RemoteCommandRequest return remoteRepository; } + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + URL getRemoteUrl() + { + return remoteUrl; + } + //~--- fields --------------------------------------------------------------- /** Field description */ protected Repository remoteRepository; + + /** remote url */ + protected URL remoteUrl; } From a6ecd7ba0042ed635fd46b21782bfa3699370fe3 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 1 Nov 2014 12:32:21 +0100 Subject: [PATCH 23/68] implement push/pull for remote urls --- ...java => AbstractGitPushOrPullCommand.java} | 81 +++++++- .../scm/repository/spi/GitPullCommand.java | 190 ++++++++++++++++-- .../scm/repository/spi/GitPushCommand.java | 28 +-- .../repository/spi/GitPushCommandTest.java | 6 - .../spi/AbstractHgPushOrPullCommand.java | 99 +++++++++ .../scm/repository/spi/HgPullCommand.java | 29 +-- .../scm/repository/spi/HgPushCommand.java | 29 +-- 7 files changed, 396 insertions(+), 66 deletions(-) rename scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/{AbstractPushOrPullCommand.java => AbstractGitPushOrPullCommand.java} (76%) create mode 100644 scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractPushOrPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java similarity index 76% rename from scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractPushOrPullCommand.java rename to scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java index dfddfc1cc0..04838403f3 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractPushOrPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java @@ -48,6 +48,7 @@ import org.eclipse.jgit.transport.RemoteRefUpdate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import sonia.scm.repository.GitRepositoryHandler; import sonia.scm.repository.RepositoryException; //~--- JDK imports ------------------------------------------------------------ @@ -61,17 +62,17 @@ import java.util.Collection; * * @author Sebastian Sdorra */ -public abstract class AbstractPushOrPullCommand extends AbstractGitCommand +public abstract class AbstractGitPushOrPullCommand extends AbstractGitCommand { /** Field description */ private static final String SCHEME = "scm://"; /** - * the logger for AbstractPushOrPullCommand + * the logger for AbstractGitPushOrPullCommand */ private static final Logger logger = - LoggerFactory.getLogger(AbstractPushOrPullCommand.class); + LoggerFactory.getLogger(AbstractGitPushOrPullCommand.class); //~--- constructors --------------------------------------------------------- @@ -79,36 +80,38 @@ public abstract class AbstractPushOrPullCommand extends AbstractGitCommand * Constructs ... * * + * @param handler * @param context * @param repository */ - public AbstractPushOrPullCommand(GitContext context, - sonia.scm.repository.Repository repository) + protected AbstractGitPushOrPullCommand(GitRepositoryHandler handler, + GitContext context, sonia.scm.repository.Repository repository) { super(context, repository); + this.handler = handler; } //~--- methods -------------------------------------------------------------- /** * Method description - * + * * @param source - * @param target + * @param remoteUrl * * @return * * @throws IOException * @throws RepositoryException */ - protected long push(Repository source, File target) + protected long push(Repository source, String remoteUrl) throws IOException, RepositoryException { Git git = Git.wrap(source); org.eclipse.jgit.api.PushCommand push = git.push(); push.setPushAll().setPushTags(); - push.setRemote(SCHEME.concat(target.getAbsolutePath())); + push.setRemote(remoteUrl); long counter = -1; @@ -158,6 +161,61 @@ public abstract class AbstractPushOrPullCommand extends AbstractGitCommand return remoteRepository; } + /** + * Method description + * + * + * @param request + * + * @return + */ + protected String getRemoteUrl(RemoteCommandRequest request) + { + String url; + sonia.scm.repository.Repository remRepo = request.getRemoteRepository(); + + if (remRepo != null) + { + url = getRemoteUrl(remRepo); + } + else if (request.getRemoteUrl() != null) + { + url = request.getRemoteUrl().toExternalForm(); + } + else + { + throw new IllegalArgumentException("repository or url is requiered"); + } + + return url; + } + + /** + * Method description + * + * + * @param directory + * + * @return + */ + protected String getRemoteUrl(File directory) + { + return SCHEME.concat(directory.getAbsolutePath()); + } + + /** + * Method description + * + * + * @param repository + * + * @return + */ + protected String getRemoteUrl(sonia.scm.repository.Repository repository) + { + return getRemoteUrl(handler.getDirectory(repository)); + } + //~--- methods -------------------------------------------------------------- /** @@ -231,4 +289,9 @@ public abstract class AbstractPushOrPullCommand extends AbstractGitCommand return counter; } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + protected GitRepositoryHandler handler; } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java index ac2ebbfb77..0c4795c619 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java @@ -36,8 +36,19 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- import com.google.common.base.Preconditions; +import com.google.common.collect.Iterables; import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.transport.FetchResult; +import org.eclipse.jgit.transport.RefSpec; +import org.eclipse.jgit.transport.TagOpt; +import org.eclipse.jgit.transport.TrackingRefUpdate; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import sonia.scm.repository.GitRepositoryHandler; import sonia.scm.repository.GitUtil; @@ -50,27 +61,37 @@ import sonia.scm.repository.api.PullResponse; import java.io.File; import java.io.IOException; +import java.net.URL; + /** * * @author Sebastian Sdorra */ -public class GitPullCommand extends AbstractPushOrPullCommand +public class GitPullCommand extends AbstractGitPushOrPullCommand implements PullCommand { + /** Field description */ + private static final String REF_SPEC = "refs/heads/*:refs/heads/*"; + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(GitPullCommand.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * * - * @param repositoryHandler + * @param handler * @param context * @param repository */ - public GitPullCommand(GitRepositoryHandler repositoryHandler, - GitContext context, Repository repository) + public GitPullCommand(GitRepositoryHandler handler, GitContext context, + Repository repository) { - super(context, repository); - this.repositoryHandler = repositoryHandler; + super(handler, context, repository); } //~--- methods -------------------------------------------------------------- @@ -90,18 +111,127 @@ public class GitPullCommand extends AbstractPushOrPullCommand public PullResponse pull(PullCommandRequest request) throws IOException, RepositoryException { - Repository sourceRepository = getRemoteRepository(request); + PullResponse response; + Repository sourceRepository = request.getRemoteRepository(); - File sourceDirectory = repositoryHandler.getDirectory(sourceRepository); + if (sourceRepository != null) + { + response = pullFromScmRepository(sourceRepository); + } + else if (request.getRemoteUrl() != null) + { + response = pullFromUrl(request.getRemoteUrl()); + } + else + { + throw new IllegalArgumentException("repository or url is required"); + } + + return response; + } + + /** + * Method description + * + * + * @param git + * @param result + * @param fetch + * + * @return + * + * @throws RepositoryException + */ + private PullResponse convert(Git git, FetchResult fetch) + throws RepositoryException + { + long counter = 0l; + + for (TrackingRefUpdate tru : fetch.getTrackingRefUpdates()) + { + counter += count(git, tru); + } + + return new PullResponse(counter); + } + + /** + * Method description + * + * + * @param git + * @param tru + * + * @return + */ + private long count(Git git, TrackingRefUpdate tru) + { + long counter = 0; + + try + { + org.eclipse.jgit.api.LogCommand log = git.log(); + ObjectId oldId = tru.getOldObjectId(); + + if (oldId != null) + { + log.not(oldId); + } + + ObjectId newId = tru.getNewObjectId(); + + if (newId != null) + { + log.add(newId); + + Iterable commits = log.call(); + + if (commits != null) + { + counter += Iterables.size(commits); + } + } + else + { + logger.warn("update without new object id"); + } + + } + catch (Exception ex) + { + logger.error("could not count pushed/pulled changesets", ex); + } + + return counter; + } + + /** + * Method description + * + * + * @param sourceRepository + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private PullResponse pullFromScmRepository(Repository sourceRepository) + throws IOException, RepositoryException + { + File sourceDirectory = handler.getDirectory(sourceRepository); Preconditions.checkArgument(sourceDirectory.exists(), "source repository directory does not exists"); - File targetDirectory = repositoryHandler.getDirectory(repository); + File targetDirectory = handler.getDirectory(repository); Preconditions.checkArgument(sourceDirectory.exists(), "target repository directory does not exists"); + logger.debug("pull changes from {} to {}", + sourceDirectory.getAbsolutePath(), repository.getId()); + PullResponse response = null; org.eclipse.jgit.lib.Repository source = null; @@ -109,7 +239,7 @@ public class GitPullCommand extends AbstractPushOrPullCommand try { source = Git.open(sourceDirectory).getRepository(); - response = new PullResponse(push(source, targetDirectory)); + response = new PullResponse(push(source, getRemoteUrl(targetDirectory))); } finally { @@ -119,8 +249,42 @@ public class GitPullCommand extends AbstractPushOrPullCommand return response; } - //~--- fields --------------------------------------------------------------- + /** + * Method description + * + * + * @param url + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private PullResponse pullFromUrl(URL url) + throws IOException, RepositoryException + { + logger.debug("pull changes from {} to {}", url, repository.getId()); - /** Field description */ - private GitRepositoryHandler repositoryHandler; + PullResponse response; + Git git = Git.wrap(open()); + + try + { + //J- + FetchResult result = git.fetch() + .setRefSpecs(new RefSpec(REF_SPEC)) + .setRemote(url.toExternalForm()) + .setTagOpt(TagOpt.FETCH_TAGS) + .call(); + //J+ + + response = convert(git, result); + } + catch (GitAPIException ex) + { + throw new RepositoryException("error durring pull", ex); + } + + return response; + } } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java index d291860b6d..c64465194a 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPushCommand.java @@ -30,11 +30,13 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- -import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import sonia.scm.repository.GitRepositoryHandler; import sonia.scm.repository.Repository; @@ -43,17 +45,22 @@ import sonia.scm.repository.api.PushResponse; //~--- JDK imports ------------------------------------------------------------ -import java.io.File; import java.io.IOException; /** * * @author Sebastian Sdorra */ -public class GitPushCommand extends AbstractPushOrPullCommand +public class GitPushCommand extends AbstractGitPushOrPullCommand implements PushCommand { + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(GitPushCommand.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -65,7 +72,7 @@ public class GitPushCommand extends AbstractPushOrPullCommand public GitPushCommand(GitRepositoryHandler handler, GitContext context, Repository repository) { - super(context, repository); + super(handler, context, repository); this.handler = handler; } @@ -86,17 +93,10 @@ public class GitPushCommand extends AbstractPushOrPullCommand public PushResponse push(PushCommandRequest request) throws IOException, RepositoryException { - Repository target = getRemoteRepository(request); - File targetDirectory = handler.getDirectory(target); + String remoteUrl = getRemoteUrl(request); - Preconditions.checkArgument(targetDirectory.exists(), - "target repository directory does not exists"); + logger.debug("push changes from {} to {}", repository.getId(), remoteUrl); - return new PushResponse(push(open(), targetDirectory)); + return new PushResponse(push(open(), remoteUrl)); } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private GitRepositoryHandler handler; } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java index 83fb7e61e5..bf82193e84 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitPushCommandTest.java @@ -37,7 +37,6 @@ package sonia.scm.repository.spi; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.revwalk.RevCommit; -import org.eclipse.jgit.transport.ScmTransportProtocol; import org.junit.Test; @@ -106,9 +105,4 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase return new GitPushCommand(handler, new GitContext(outgoingDirectory), outgoingRepository); } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private ScmTransportProtocol proto; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java new file mode 100644 index 0000000000..a3b159fbfb --- /dev/null +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.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 sonia.scm.repository.HgRepositoryHandler; +import sonia.scm.repository.Repository; + +/** + * + * @author Sebastian Sdorra + */ +public class AbstractHgPushOrPullCommand extends AbstractCommand +{ + + /** + * Constructs ... + * + * + * @param handler + * @param context + * @param repository + */ + protected AbstractHgPushOrPullCommand(HgRepositoryHandler handler, + HgCommandContext context, Repository repository) + { + super(context, repository); + this.handler = handler; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + */ + protected String getRemoteUrl(RemoteCommandRequest request) + { + String url; + Repository repo = request.getRemoteRepository(); + + if (repo != null) + { + url = + handler.getDirectory(request.getRemoteRepository()).getAbsolutePath(); + } + else if (request.getRemoteUrl() != null) + { + url = request.getRemoteUrl().toExternalForm(); + } + else + { + throw new IllegalArgumentException("url or repository is required"); + } + + return url; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + protected final HgRepositoryHandler handler; +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java index 0553fa667d..de407b621d 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPullCommand.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -37,6 +38,9 @@ package sonia.scm.repository.spi; import com.aragost.javahg.Changeset; import com.aragost.javahg.commands.ExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; @@ -44,7 +48,6 @@ import sonia.scm.repository.api.PullResponse; //~--- JDK imports ------------------------------------------------------------ -import java.io.File; import java.io.IOException; import java.util.Collections; @@ -54,9 +57,16 @@ import java.util.List; * * @author Sebastian Sdorra */ -public class HgPullCommand extends AbstractCommand implements PullCommand +public class HgPullCommand extends AbstractHgPushOrPullCommand + implements PullCommand { + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(HgPullCommand.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -68,8 +78,7 @@ public class HgPullCommand extends AbstractCommand implements PullCommand public HgPullCommand(HgRepositoryHandler handler, HgCommandContext context, Repository repository) { - super(context, repository); - this.handler = handler; + super(handler, context, repository); } //~--- methods -------------------------------------------------------------- @@ -89,14 +98,15 @@ public class HgPullCommand extends AbstractCommand implements PullCommand public PullResponse pull(PullCommandRequest request) throws RepositoryException, IOException { - File remoteRepository = handler.getDirectory(request.getRemoteRepository()); + String url = getRemoteUrl(request); + + logger.debug("pull changes from {} to {}", url, getRepository().getId()); List result = Collections.EMPTY_LIST; try { - result = com.aragost.javahg.commands.PullCommand.on(open()).execute( - remoteRepository.getAbsolutePath()); + result = com.aragost.javahg.commands.PullCommand.on(open()).execute(url); } catch (ExecutionException ex) { @@ -105,9 +115,4 @@ public class HgPullCommand extends AbstractCommand implements PullCommand return new PullResponse(result.size()); } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private HgRepositoryHandler handler; } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java index 5025914484..69644efe27 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgPushCommand.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- @@ -37,6 +38,9 @@ package sonia.scm.repository.spi; import com.aragost.javahg.Changeset; import com.aragost.javahg.commands.ExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryException; @@ -44,7 +48,6 @@ import sonia.scm.repository.api.PushResponse; //~--- JDK imports ------------------------------------------------------------ -import java.io.File; import java.io.IOException; import java.util.Collections; @@ -54,9 +57,16 @@ import java.util.List; * * @author Sebastian Sdorra */ -public class HgPushCommand extends AbstractCommand implements PushCommand +public class HgPushCommand extends AbstractHgPushOrPullCommand + implements PushCommand { + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(HgPushCommand.class); + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -68,8 +78,7 @@ public class HgPushCommand extends AbstractCommand implements PushCommand public HgPushCommand(HgRepositoryHandler handler, HgCommandContext context, Repository repository) { - super(context, repository); - this.handler = handler; + super(handler, context, repository); } //~--- methods -------------------------------------------------------------- @@ -89,14 +98,15 @@ public class HgPushCommand extends AbstractCommand implements PushCommand public PushResponse push(PushCommandRequest request) throws RepositoryException, IOException { - File remoteRepository = handler.getDirectory(request.getRemoteRepository()); + String url = getRemoteUrl(request); + + logger.debug("push changes from {} to {}", getRepository().getId(), url); List result = Collections.EMPTY_LIST; try { - result = com.aragost.javahg.commands.PushCommand.on(open()).execute( - remoteRepository.getAbsolutePath()); + result = com.aragost.javahg.commands.PushCommand.on(open()).execute(url); } catch (ExecutionException ex) { @@ -105,9 +115,4 @@ public class HgPushCommand extends AbstractCommand implements PushCommand return new PushResponse(result.size()); } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private HgRepositoryHandler handler; } From 695242883ed403801e30d061be6f3a41ba92d916 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 1 Nov 2014 12:34:16 +0100 Subject: [PATCH 24/68] added api for bundle/unbundle command to repository api --- .../repository/api/BundleCommandBuilder.java | 111 ++++++++++++++ .../scm/repository/api/BundleResponse.java | 41 ++++++ .../sonia/scm/repository/api/Command.java | 7 +- .../scm/repository/api/RepositoryService.java | 43 +++++- .../api/UnbundleCommandBuilder.java | 111 ++++++++++++++ .../scm/repository/api/UnbundleResponse.java | 41 ++++++ .../repository/spi/ArchiveCommandRequest.java | 136 ++++++++++++++++++ .../scm/repository/spi/BundleCommand.java | 66 +++++++++ .../repository/spi/BundleCommandRequest.java | 41 ++++++ .../spi/RepositoryServiceProvider.java | 26 ++++ .../scm/repository/spi/UnbundleCommand.java | 66 +++++++++ .../spi/UnbundleCommandRequest.java | 41 ++++++ 12 files changed, 728 insertions(+), 2 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java new file mode 100644 index 0000000000..f2a2d93ddc --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java @@ -0,0 +1,111 @@ +/** + * 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.spi.BundleCommand; +import sonia.scm.repository.spi.BundleCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public final class BundleCommandBuilder +{ + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(BundleCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param bundleCommand + * @param repository + */ + public BundleCommandBuilder(BundleCommand bundleCommand, + Repository repository) + { + this.bundleCommand = bundleCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param outputFile + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(File outputFile) + throws IOException, RepositoryException + { + BundleCommandRequest request = new BundleCommandRequest(); + + request.setArchive(outputFile); + logger.info("create bundle at {} for repository {}", outputFile, + repository.getId()); + + return bundleCommand.bundle(request); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final BundleCommand bundleCommand; + + /** Field description */ + private final Repository repository; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java new file mode 100644 index 0000000000..473161963d --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java @@ -0,0 +1,41 @@ +/** + * 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; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class BundleResponse {} 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 index baf228fa94..ccb0d8c2c0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/Command.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/Command.java @@ -56,5 +56,10 @@ public enum Command /** * @since 1.31 */ - INCOMING, OUTGOING, PUSH, PULL; + INCOMING, OUTGOING, PUSH, PULL, + + /** + * @since 1.43 + */ + BUNDLE, UNBUNDLE; } 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 6155174476..5ae4b33c33 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 @@ -83,6 +83,8 @@ import java.io.IOException; * @apiviz.uses sonia.scm.repository.api.OutgoingCommandBuilder * @apiviz.uses sonia.scm.repository.api.PullCommandBuilder * @apiviz.uses sonia.scm.repository.api.PushCommandBuilder + * @apiviz.uses sonia.scm.repository.api.BundleCommandBuilder + * @apiviz.uses sonia.scm.repository.api.UnbundleCommandBuilder */ public final class RepositoryService implements Closeable { @@ -204,6 +206,25 @@ public final class RepositoryService implements Closeable repository, preProcessorUtil); } + /** + * The bundle command creates an archive from the repository. + * + * @return instance of {@link BundleCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + * @since 1.43 + */ + public BundleCommandBuilder getBundleCommand() + { + if (logger.isDebugEnabled()) + { + logger.debug("create bundle command for repository {}", + repository.getName()); + } + + return new BundleCommandBuilder(provider.getBundleCommand(), repository); + } + /** * The cat command show the content of a given file. * @@ -370,6 +391,26 @@ public final class RepositoryService implements Closeable repository); } + /** + * The unbundle command restores a repository from the given bundle. + * + * @return instance of {@link UnbundleCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + * @since 1.43 + */ + public UnbundleCommandBuilder getUnbundleCommand() + { + if (logger.isDebugEnabled()) + { + logger.debug("create bundle command for repository {}", + repository.getName()); + } + + return new UnbundleCommandBuilder(provider.getUnbundleCommand(), + repository); + } + /** * Returns true if the command is supported by the repository service. * @@ -390,7 +431,7 @@ public final class RepositoryService implements Closeable * @param feature feature * * @return true if the feature is supported - * + * * @since 1.25 */ public boolean isSupported(Feature feature) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java new file mode 100644 index 0000000000..7da034ade9 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java @@ -0,0 +1,111 @@ +/** + * 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.spi.UnbundleCommand; +import sonia.scm.repository.spi.UnbundleCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public final class UnbundleCommandBuilder +{ + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(UnbundleCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param unbundleCommand + * @param repository + */ + public UnbundleCommandBuilder(UnbundleCommand unbundleCommand, + Repository repository) + { + this.unbundleCommand = unbundleCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param inputFile + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(File inputFile) + throws IOException, RepositoryException + { + UnbundleCommandRequest request = new UnbundleCommandRequest(); + + request.setArchive(inputFile); + + logger.info("unbundle archive {} at {}", inputFile, repository.getId()); + + return unbundleCommand.unbundle(request); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final Repository repository; + + /** Field description */ + private final UnbundleCommand unbundleCommand; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java new file mode 100644 index 0000000000..12c8cbff2f --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java @@ -0,0 +1,41 @@ +/** + * 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; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class UnbundleResponse {} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java new file mode 100644 index 0000000000..478afc6cf0 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java @@ -0,0 +1,136 @@ +/** + * 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.File; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public abstract class ArchiveCommandRequest +{ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final ArchiveCommandRequest other = (ArchiveCommandRequest) obj; + + return Objects.equal(archive, other.archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("archive", archive) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public File getArchive() + { + return archive; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param archive + */ + public void setArchive(File archive) + { + this.archive = archive; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private File archive; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java new file mode 100644 index 0000000000..69cf3be387 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java @@ -0,0 +1,66 @@ +/** +* 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.RepositoryException; +import sonia.scm.repository.api.BundleResponse; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public interface BundleCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(BundleCommandRequest request) + throws IOException, RepositoryException;; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java new file mode 100644 index 0000000000..6ebd054035 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java @@ -0,0 +1,41 @@ +/** + * 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.43 + */ +public class BundleCommandRequest extends ArchiveCommandRequest {} 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 f29af95ef2..02a667237d 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 @@ -115,6 +115,19 @@ public abstract class RepositoryServiceProvider implements Closeable throw new CommandNotSupportedException(Command.BROWSE); } + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + public BundleCommand getBundleCommand() + { + throw new CommandNotSupportedException(Command.BUNDLE); + } + /** * Method description * @@ -217,4 +230,17 @@ public abstract class RepositoryServiceProvider implements Closeable { throw new CommandNotSupportedException(Command.TAGS); } + + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + public UnbundleCommand getUnbundleCommand() + { + throw new CommandNotSupportedException(Command.UNBUNDLE); + } } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java new file mode 100644 index 0000000000..5a3ac0b786 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java @@ -0,0 +1,66 @@ +/** + * 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.RepositoryException; +import sonia.scm.repository.api.UnbundleResponse; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public interface UnbundleCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(UnbundleCommandRequest request) + throws IOException, RepositoryException;; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java new file mode 100644 index 0000000000..57400d0f9a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java @@ -0,0 +1,41 @@ +/** + * 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.43 + */ +public class UnbundleCommandRequest extends ArchiveCommandRequest {} From 514e82498a6181dadf6a879a6740056e4bf238be Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 1 Nov 2014 12:35:33 +0100 Subject: [PATCH 25/68] implement bundle/unbundle command for subversion repository provider --- .../scm/repository/spi/SvnBundleCommand.java | 148 +++++++++++++++++ .../spi/SvnRepositoryServiceProvider.java | 33 +++- .../repository/spi/SvnUnbundleCommand.java | 155 ++++++++++++++++++ 3 files changed, 333 insertions(+), 3 deletions(-) create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java create mode 100644 scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java new file mode 100644 index 0000000000..d514a51ac1 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java @@ -0,0 +1,148 @@ +/** +* 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 org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.wc.SVNClientManager; +import org.tmatesoft.svn.core.wc.SVNRevision; +import org.tmatesoft.svn.core.wc.admin.SVNAdminClient; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnUtil; +import sonia.scm.repository.api.BundleResponse; + +import static com.google.common.base.Preconditions.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBundleCommand extends AbstractSvnCommand + implements BundleCommand +{ + + /** + * Constructs ... + * + * + * @param context + * @param repository + */ + public SvnBundleCommand(SvnContext context, Repository repository) + { + super(context, repository); + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param adminClient + * @param repository + * @param target + * + * @throws IOException + * @throws SVNException + */ + private static void dump(SVNAdminClient adminClient, File repository, + File target) + throws SVNException, IOException + { + OutputStream outputStream = null; + + try + { + outputStream = new FileOutputStream(target); + adminClient.doDump(repository, outputStream, SVNRevision.create(-1l), + SVNRevision.HEAD, false, false); + } + finally + { + Closeables.close(outputStream, true); + } + } + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + @Override + public BundleResponse bundle(BundleCommandRequest request) + throws IOException, RepositoryException + { + File archive = checkNotNull(request.getArchive(), "archive is required"); + + SVNClientManager clientManager = null; + + try + { + clientManager = SVNClientManager.newInstance(); + + SVNAdminClient adminClient = clientManager.getAdminClient(); + + dump(adminClient, context.getDirectory(), archive); + } + catch (SVNException ex) + { + throw new IOException("could not create dump", ex); + } + finally + { + SvnUtil.dispose(clientManager); + } + + return new BundleResponse(); + } +} 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 5c1907da7b..24180bfe9e 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 @@ -56,9 +56,12 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider { /** Field description */ - public static final Set COMMANDS = ImmutableSet.of(Command.BLAME, - Command.BROWSE, Command.CAT, - Command.DIFF, Command.LOG); + //J- + public static final Set COMMANDS = ImmutableSet.of( + Command.BLAME, Command.BROWSE, Command.CAT, Command.DIFF, + Command.LOG, Command.BUNDLE, Command.UNBUNDLE + ); + //J+ //~--- constructors --------------------------------------------------------- @@ -116,6 +119,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider return new SvnBrowseCommand(context, repository); } + /** + * Method description + * + * + * @return + */ + @Override + public BundleCommand getBundleCommand() + { + return new SvnBundleCommand(context, repository); + } + /** * Method description * @@ -164,6 +179,18 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider return COMMANDS; } + /** + * Method description + * + * + * @return + */ + @Override + public UnbundleCommand getUnbundleCommand() + { + return new SvnUnbundleCommand(context, repository); + } + //~--- fields --------------------------------------------------------------- /** Field description */ diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java new file mode 100644 index 0000000000..e83d0664e0 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java @@ -0,0 +1,155 @@ +/** +* 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.wc.SVNClientManager; +import org.tmatesoft.svn.core.wc.admin.SVNAdminClient; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.SvnUtil; +import sonia.scm.repository.api.UnbundleResponse; + +import static com.google.common.base.Preconditions.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnUnbundleCommand extends AbstractSvnCommand + implements UnbundleCommand +{ + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(SvnUnbundleCommand.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param context + * @param repository + */ + public SvnUnbundleCommand(SvnContext context, Repository repository) + { + super(context, repository); + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + */ + @Override + public UnbundleResponse unbundle(UnbundleCommandRequest request) + throws IOException + { + File archive = checkNotNull(request.getArchive(), "archive is required"); + + logger.debug("archive repository {} to {}", context.getDirectory(), + archive); + + SVNClientManager clientManager = null; + + try + { + clientManager = SVNClientManager.newInstance(); + + SVNAdminClient adminClient = clientManager.getAdminClient(); + + restore(adminClient, archive, context.getDirectory()); + } + catch (SVNException ex) + { + throw new IOException("could not restore dump", ex); + } + finally + { + SvnUtil.dispose(clientManager); + } + + return new UnbundleResponse(); + } + + /** + * Method description + * + * + * @param adminClient + * @param dump + * @param repository + * + * @throws IOException + * @throws SVNException + */ + private void restore(SVNAdminClient adminClient, File dump, File repository) + throws SVNException, IOException + { + InputStream inputStream = null; + + try + { + inputStream = new FileInputStream(dump); + adminClient.doLoad(repository, inputStream); + } + finally + { + Closeables.close(inputStream, true); + } + } +} From 75c244fcdbd9d5897f13298527872432f5e9cdcd Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Nov 2014 10:44:17 +0100 Subject: [PATCH 26/68] improve bundle/unbundle api, by using ByteSource and ByteSink --- .../repository/api/BundleCommandBuilder.java | 80 ++++++++++- .../scm/repository/api/BundleResponse.java | 2 +- .../api/UnbundleCommandBuilder.java | 78 +++++++++- .../scm/repository/api/UnbundleResponse.java | 2 +- .../repository/spi/ArchiveCommandRequest.java | 136 ------------------ .../scm/repository/spi/BundleCommand.java | 2 +- .../repository/spi/BundleCommandRequest.java | 80 ++++++++++- .../scm/repository/spi/UnbundleCommand.java | 2 +- .../spi/UnbundleCommandRequest.java | 80 ++++++++++- .../spi/AbstractHgPushOrPullCommand.java | 2 +- .../scm/repository/spi/SvnBundleCommand.java | 11 +- .../repository/spi/SvnUnbundleCommand.java | 12 +- 12 files changed, 326 insertions(+), 161 deletions(-) delete mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java index f2a2d93ddc..864ce62de1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java @@ -35,6 +35,11 @@ package sonia.scm.repository.api; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.ByteSink; +import com.google.common.io.ByteStreams; +import com.google.common.io.Files; +import com.google.common.io.OutputSupplier; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,14 +48,17 @@ import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.BundleCommand; import sonia.scm.repository.spi.BundleCommandRequest; +import static com.google.common.base.Preconditions.*; + //~--- JDK imports ------------------------------------------------------------ import java.io.File; import java.io.IOException; +import java.io.OutputStream; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public final class BundleCommandBuilder @@ -92,15 +100,81 @@ public final class BundleCommandBuilder public BundleResponse bundle(File outputFile) throws IOException, RepositoryException { - BundleCommandRequest request = new BundleCommandRequest(); + checkArgument((outputFile != null) &&!outputFile.exists(), + "file is null or exists already"); + + BundleCommandRequest request = + new BundleCommandRequest(Files.asByteSink(outputFile)); - request.setArchive(outputFile); logger.info("create bundle at {} for repository {}", outputFile, repository.getId()); return bundleCommand.bundle(request); } + /** + * Method description + * + * + * @param outputStream + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(OutputStream outputStream) + throws IOException, RepositoryException + { + checkNotNull(outputStream, "output stream is required"); + + logger.info("bundle {} to output stream", repository.getId()); + + return bundleCommand.bundle( + new BundleCommandRequest(asByteSink(outputStream))); + } + + /** + * Method description + * + * + * @param sink + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(ByteSink sink) + throws IOException, RepositoryException + { + checkNotNull(sink, "byte sink is required"); + logger.info("bundle {} to byte sink"); + + return bundleCommand.bundle(new BundleCommandRequest(sink)); + } + + /** + * Method description + * + * + * @param outputStream + * + * @return + */ + private ByteSink asByteSink(final OutputStream outputStream) + { + return ByteStreams.asByteSink(new OutputSupplier() + { + + @Override + public OutputStream getOutput() throws IOException + { + return outputStream; + } + }); + } + //~--- fields --------------------------------------------------------------- /** Field description */ diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java index 473161963d..ee0b51a06d 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java @@ -35,7 +35,7 @@ package sonia.scm.repository.api; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public class BundleResponse {} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java index 7da034ade9..7ae836e682 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java @@ -35,6 +35,11 @@ package sonia.scm.repository.api; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.ByteSource; +import com.google.common.io.ByteStreams; +import com.google.common.io.Files; +import com.google.common.io.InputSupplier; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,14 +48,17 @@ import sonia.scm.repository.RepositoryException; import sonia.scm.repository.spi.UnbundleCommand; import sonia.scm.repository.spi.UnbundleCommandRequest; +import static com.google.common.base.Preconditions.*; + //~--- JDK imports ------------------------------------------------------------ import java.io.File; import java.io.IOException; +import java.io.InputStream; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public final class UnbundleCommandBuilder @@ -92,15 +100,79 @@ public final class UnbundleCommandBuilder public UnbundleResponse unbundle(File inputFile) throws IOException, RepositoryException { - UnbundleCommandRequest request = new UnbundleCommandRequest(); + checkArgument((inputFile != null) && inputFile.exists(), + "existing file is required"); - request.setArchive(inputFile); + UnbundleCommandRequest request = + new UnbundleCommandRequest(Files.asByteSource(inputFile)); logger.info("unbundle archive {} at {}", inputFile, repository.getId()); return unbundleCommand.unbundle(request); } + /** + * Method description + * + * + * @param inputStream + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(InputStream inputStream) + throws IOException, RepositoryException + { + checkNotNull(inputStream, "input stream is required"); + logger.info("unbundle archive from stream"); + + return unbundleCommand.unbundle( + new UnbundleCommandRequest(asByteSource(inputStream))); + } + + /** + * Method description + * + * + * @param byteSource + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(ByteSource byteSource) + throws IOException, RepositoryException + { + checkNotNull(byteSource, "byte source is required"); + logger.info("unbundle from byte source"); + + return unbundleCommand.unbundle(new UnbundleCommandRequest(byteSource)); + } + + /** + * Method description + * + * + * @param inputStream + * + * @return + */ + private ByteSource asByteSource(final InputStream inputStream) + { + return ByteStreams.asByteSource(new InputSupplier() + { + + @Override + public InputStream getInput() throws IOException + { + return inputStream; + } + }); + } + //~--- fields --------------------------------------------------------------- /** Field description */ diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java index 12c8cbff2f..bf5c115ff8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java @@ -35,7 +35,7 @@ package sonia.scm.repository.api; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public class UnbundleResponse {} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java deleted file mode 100644 index 478afc6cf0..0000000000 --- a/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * 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.File; - -/** - * - * @author Sebastian Sdorra - * @since 1.43 - */ -public abstract class ArchiveCommandRequest -{ - - /** - * Method description - * - * - * @param obj - * - * @return - */ - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - - if (getClass() != obj.getClass()) - { - return false; - } - - final ArchiveCommandRequest other = (ArchiveCommandRequest) obj; - - return Objects.equal(archive, other.archive); - } - - /** - * Method description - * - * - * @return - */ - @Override - public int hashCode() - { - return Objects.hashCode(archive); - } - - /** - * Method description - * - * - * @return - */ - @Override - public String toString() - { - //J- - return Objects.toStringHelper(this) - .add("archive", archive) - .toString(); - //J+ - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - public File getArchive() - { - return archive; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param archive - */ - public void setArchive(File archive) - { - this.archive = archive; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private File archive; -} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java index 69cf3be387..44500b5709 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java @@ -44,7 +44,7 @@ import java.io.IOException; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public interface BundleCommand diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java index 6ebd054035..f354ae94a1 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java @@ -33,9 +33,85 @@ package sonia.scm.repository.spi; +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; +import com.google.common.io.ByteSink; + /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ -public class BundleCommandRequest extends ArchiveCommandRequest {} +public final class BundleCommandRequest +{ + + /** + * Constructs ... + * + * + * @param archive + */ + public BundleCommandRequest(ByteSink archive) + { + this.archive = archive; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final BundleCommandRequest other = (BundleCommandRequest) obj; + + return Objects.equal(archive, other.archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(archive); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + ByteSink getArchive() + { + return archive; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final ByteSink archive; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java index 5a3ac0b786..6861e481fe 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java @@ -44,7 +44,7 @@ import java.io.IOException; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ public interface UnbundleCommand diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java index 57400d0f9a..0378a385c0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java @@ -33,9 +33,85 @@ package sonia.scm.repository.spi; +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Objects; +import com.google.common.io.ByteSource; + /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra * @since 1.43 */ -public class UnbundleCommandRequest extends ArchiveCommandRequest {} +public final class UnbundleCommandRequest +{ + + /** + * Constructs ... + * + * + * @param archive + */ + public UnbundleCommandRequest(ByteSource archive) + { + this.archive = archive; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final UnbundleCommandRequest other = (UnbundleCommandRequest) obj; + + return Objects.equal(archive, other.archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(archive); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + ByteSource getArchive() + { + return archive; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final ByteSource archive; +} diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java index a3b159fbfb..43fb759433 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/AbstractHgPushOrPullCommand.java @@ -40,7 +40,7 @@ import sonia.scm.repository.Repository; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra */ public class AbstractHgPushOrPullCommand extends AbstractCommand { diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java index d514a51ac1..bf02cc7d0e 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java @@ -35,6 +35,7 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.ByteSink; import com.google.common.io.Closeables; import org.tmatesoft.svn.core.SVNException; @@ -52,13 +53,12 @@ import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra */ public class SvnBundleCommand extends AbstractSvnCommand implements BundleCommand @@ -90,14 +90,14 @@ public class SvnBundleCommand extends AbstractSvnCommand * @throws SVNException */ private static void dump(SVNAdminClient adminClient, File repository, - File target) + ByteSink target) throws SVNException, IOException { OutputStream outputStream = null; try { - outputStream = new FileOutputStream(target); + outputStream = target.openBufferedStream(); adminClient.doDump(repository, outputStream, SVNRevision.create(-1l), SVNRevision.HEAD, false, false); } @@ -122,7 +122,8 @@ public class SvnBundleCommand extends AbstractSvnCommand public BundleResponse bundle(BundleCommandRequest request) throws IOException, RepositoryException { - File archive = checkNotNull(request.getArchive(), "archive is required"); + ByteSink archive = checkNotNull(request.getArchive(), + "archive is required"); SVNClientManager clientManager = null; diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java index e83d0664e0..f7479caeaa 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java @@ -35,6 +35,7 @@ package sonia.scm.repository.spi; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.io.ByteSource; import com.google.common.io.Closeables; import org.slf4j.Logger; @@ -53,13 +54,12 @@ import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** * - * @author Sebastian Sdorra + * @author Sebastian Sdorra */ public class SvnUnbundleCommand extends AbstractSvnCommand implements UnbundleCommand @@ -99,7 +99,8 @@ public class SvnUnbundleCommand extends AbstractSvnCommand public UnbundleResponse unbundle(UnbundleCommandRequest request) throws IOException { - File archive = checkNotNull(request.getArchive(), "archive is required"); + ByteSource archive = checkNotNull(request.getArchive(), + "archive is required"); logger.debug("archive repository {} to {}", context.getDirectory(), archive); @@ -137,14 +138,15 @@ public class SvnUnbundleCommand extends AbstractSvnCommand * @throws IOException * @throws SVNException */ - private void restore(SVNAdminClient adminClient, File dump, File repository) + private void restore(SVNAdminClient adminClient, ByteSource dump, + File repository) throws SVNException, IOException { InputStream inputStream = null; try { - inputStream = new FileInputStream(dump); + inputStream = dump.openBufferedStream(); adminClient.doLoad(repository, inputStream); } finally From ab1d6284670f21b6ae4be7daf60b5fad9d0f29b8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Nov 2014 10:52:47 +0100 Subject: [PATCH 27/68] exclude old guava dependency from scm-hg-plugin --- scm-plugins/scm-hg-plugin/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 8931ce9e14..699bc2f6a8 100644 --- a/scm-plugins/scm-hg-plugin/pom.xml +++ b/scm-plugins/scm-hg-plugin/pom.xml @@ -29,6 +29,12 @@ com.aragost.javahg javahg 0.7 + + + com.google.guava + guava + + From 38c0e357e267d15f73bc6897a66894a78953a9f4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Nov 2014 16:33:15 +0100 Subject: [PATCH 28/68] unit tests for svn bundle/unbundle commands --- .../repository/spi/SvnBundleCommandTest.java | 90 +++++++++++ .../spi/SvnUnbundleCommandTest.java | 141 ++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java create mode 100644 scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java new file mode 100644 index 0000000000..a7b5a17687 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2014, 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.ByteSink; +import com.google.common.io.Files; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.api.BundleResponse; + +import static org.hamcrest.Matchers.*; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnBundleCommandTest extends AbstractSvnCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testBundle() throws IOException, RepositoryException + { + File file = temp.newFile(); + ByteSink sink = Files.asByteSink(file); + BundleCommandRequest req = new BundleCommandRequest(sink); + BundleResponse res = new SvnBundleCommand(createContext(), + repository).bundle(req); + + assertNotNull(res); + assertTrue("file does not exists", file.exists()); + assertThat(file.length(), greaterThan(0l)); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Rule + public TemporaryFolder temp = new TemporaryFolder(); +} diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java new file mode 100644 index 0000000000..18d784ade2 --- /dev/null +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2014, 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.Files; + +import org.junit.Test; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.io.SVNRepositoryFactory; + +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.SvnUtil; +import sonia.scm.repository.api.UnbundleResponse; + +import static org.hamcrest.Matchers.*; + +import static org.junit.Assert.*; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + */ +public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase +{ + + /** + * Method description + * + * + * @throws IOException + * @throws RepositoryException + * @throws SVNException + */ + @Test + public void testUnbundle() + throws IOException, RepositoryException, SVNException + { + File bundle = bundle(); + SvnContext ctx = createEmptyContext(); + //J- + UnbundleResponse res = new SvnUnbundleCommand( + ctx, + repository + ).unbundle( + new UnbundleCommandRequest( + Files.asByteSource(bundle) + ) + ); + //J+ + + assertNotNull(res); + + SVNRepository repo = ctx.open(); + + assertThat(repo.getLatestRevision(), is(5l)); + SvnUtil.closeSession(repo); + } + + /** + * Method description + * + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + private File bundle() throws IOException, RepositoryException + { + File file = tempFolder.newFile(); + + //J- + new SvnBundleCommand( + createContext(), + repository + ).bundle( + new BundleCommandRequest( + Files.asByteSink(file) + ) + ); + //J+ + + return file; + } + + /** + * Method description + * + * + * @return + * + * @throws IOException + * @throws SVNException + */ + private SvnContext createEmptyContext() throws IOException, SVNException + { + File folder = tempFolder.newFolder(); + + SVNRepositoryFactory.createLocalRepository(folder, true, true); + + return new SvnContext(folder); + } +} From 1b7ab0a35d1210bd8a34096dca8698805a33b848 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Nov 2014 17:31:06 +0100 Subject: [PATCH 29/68] javadoc --- .../repository/api/BundleCommandBuilder.java | 44 +++++++++---------- .../scm/repository/api/BundleResponse.java | 1 + .../api/UnbundleCommandBuilder.java | 38 ++++++++-------- .../scm/repository/api/UnbundleResponse.java | 1 + .../scm/repository/spi/BundleCommand.java | 9 ++-- .../repository/spi/BundleCommandRequest.java | 23 ++++------ .../scm/repository/spi/UnbundleCommand.java | 9 ++-- .../spi/UnbundleCommandRequest.java | 23 ++++------ 8 files changed, 70 insertions(+), 78 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java index 864ce62de1..c8ac199e16 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java @@ -57,6 +57,9 @@ import java.io.IOException; import java.io.OutputStream; /** + * The bundle command dumps a repository to a byte source such as a file. The + * created bundle can be restored to an empty repository with the + * {@link UnbundleCommandBuilder}. * * @author Sebastian Sdorra * @since 1.43 @@ -64,21 +67,20 @@ import java.io.OutputStream; public final class BundleCommandBuilder { - /** Field description */ + /** logger for BundleCommandBuilder */ private static final Logger logger = LoggerFactory.getLogger(BundleCommandBuilder.class); //~--- constructors --------------------------------------------------------- /** - * Constructs ... + * Constructs a new {@link BundleCommandBuilder}. * * - * @param bundleCommand - * @param repository + * @param bundleCommand bundle command implementation + * @param repository repository */ - public BundleCommandBuilder(BundleCommand bundleCommand, - Repository repository) + BundleCommandBuilder(BundleCommand bundleCommand, Repository repository) { this.bundleCommand = bundleCommand; this.repository = repository; @@ -87,12 +89,11 @@ public final class BundleCommandBuilder //~--- methods -------------------------------------------------------------- /** - * Method description + * Dumps the repository to the given {@link File}. * + * @param outputFile output file * - * @param outputFile - * - * @return + * @return bundle response * * @throws IOException * @throws RepositoryException @@ -113,12 +114,12 @@ public final class BundleCommandBuilder } /** - * Method description + * Dumps the repository to the given {@link OutputStream}. * * - * @param outputStream + * @param outputStream output stream * - * @return + * @return bundle response * * @throws IOException * @throws RepositoryException @@ -135,12 +136,11 @@ public final class BundleCommandBuilder } /** - * Method description + * Dumps the repository to the given {@link ByteSink}. * + * @param sink byte sink * - * @param sink - * - * @return + * @return bundle response * * @throws IOException * @throws RepositoryException @@ -155,12 +155,12 @@ public final class BundleCommandBuilder } /** - * Method description + * Converts an {@link OutputStream} into a {@link ByteSink}. * * - * @param outputStream + * @param outputStream ouput stream to convert * - * @return + * @return converted byte sink */ private ByteSink asByteSink(final OutputStream outputStream) { @@ -177,9 +177,9 @@ public final class BundleCommandBuilder //~--- fields --------------------------------------------------------------- - /** Field description */ + /** bundle command implementation */ private final BundleCommand bundleCommand; - /** Field description */ + /** repository */ private final Repository repository; } diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java index ee0b51a06d..0ad17ce700 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java @@ -34,6 +34,7 @@ package sonia.scm.repository.api; /** + * Response of {@link BundleCommandBuilder}. * * @author Sebastian Sdorra * @since 1.43 diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java index 7ae836e682..6e94073244 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java @@ -57,6 +57,8 @@ import java.io.IOException; import java.io.InputStream; /** + * The unbundle command can restore an empty repository from a bundle. The + * bundle can be created with the {@link BundleCommandBuilder}. * * @author Sebastian Sdorra * @since 1.43 @@ -64,18 +66,18 @@ import java.io.InputStream; public final class UnbundleCommandBuilder { - /** Field description */ + /** logger for UnbundleCommandBuilder */ private static final Logger logger = LoggerFactory.getLogger(UnbundleCommandBuilder.class); //~--- constructors --------------------------------------------------------- /** - * Constructs ... + * Constructs a new UnbundleCommandBuilder. * * - * @param unbundleCommand - * @param repository + * @param unbundleCommand unbundle command implementation + * @param repository repository */ public UnbundleCommandBuilder(UnbundleCommand unbundleCommand, Repository repository) @@ -87,12 +89,12 @@ public final class UnbundleCommandBuilder //~--- methods -------------------------------------------------------------- /** - * Method description + * Restores the repository from the given bundle. * * - * @param inputFile + * @param inputFile input file * - * @return + * @return unbundle response * * @throws IOException * @throws RepositoryException @@ -112,12 +114,12 @@ public final class UnbundleCommandBuilder } /** - * Method description + * Restores the repository from the given bundle. * * - * @param inputStream + * @param inputStream input stream * - * @return + * @return unbundle response * * @throws IOException * @throws RepositoryException @@ -133,12 +135,12 @@ public final class UnbundleCommandBuilder } /** - * Method description + * Restores the repository from the given bundle. * * - * @param byteSource + * @param byteSource byte source * - * @return + * @return unbundle response * * @throws IOException * @throws RepositoryException @@ -153,12 +155,12 @@ public final class UnbundleCommandBuilder } /** - * Method description + * Converts an {@link InputStream} into a {@link ByteSource}. * * - * @param inputStream + * @param inputStream input stream * - * @return + * @return byte source */ private ByteSource asByteSource(final InputStream inputStream) { @@ -175,9 +177,9 @@ public final class UnbundleCommandBuilder //~--- fields --------------------------------------------------------------- - /** Field description */ + /** repository */ private final Repository repository; - /** Field description */ + /** unbundle command implementation */ private final UnbundleCommand unbundleCommand; } diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java index bf5c115ff8..bc2a897fd9 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java @@ -34,6 +34,7 @@ package sonia.scm.repository.api; /** + * Response of {@link UnbundleCommandBuilder}. * * @author Sebastian Sdorra * @since 1.43 diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java index 44500b5709..8a0f21a714 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java @@ -43,6 +43,7 @@ import sonia.scm.repository.api.BundleResponse; import java.io.IOException; /** + * Service provider implementation for the bundle command. * * @author Sebastian Sdorra * @since 1.43 @@ -51,16 +52,16 @@ public interface BundleCommand { /** - * Method description + * The bundle command dumps a repository to a byte source such as a file. * * - * @param request + * @param request bundle command request * - * @return + * @return bundle response * * @throws IOException * @throws RepositoryException */ public BundleResponse bundle(BundleCommandRequest request) - throws IOException, RepositoryException;; + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java index f354ae94a1..4315b39621 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java @@ -39,6 +39,7 @@ import com.google.common.base.Objects; import com.google.common.io.ByteSink; /** + * Request for the bundle command. * * @author Sebastian Sdorra * @since 1.43 @@ -47,10 +48,10 @@ public final class BundleCommandRequest { /** - * Constructs ... + * Constructs a new bundle command request. * * - * @param archive + * @param archive byte sink archive */ public BundleCommandRequest(ByteSink archive) { @@ -60,12 +61,7 @@ public final class BundleCommandRequest //~--- methods -------------------------------------------------------------- /** - * Method description - * - * - * @param obj - * - * @return + * {@inheritDoc} */ @Override public boolean equals(Object obj) @@ -86,10 +82,7 @@ public final class BundleCommandRequest } /** - * Method description - * - * - * @return + * {@inheritDoc} */ @Override public int hashCode() @@ -100,10 +93,10 @@ public final class BundleCommandRequest //~--- get methods ---------------------------------------------------------- /** - * Method description + * Returns the archive as {@link ByteSink}. * * - * @return + * @return {@link ByteSink} archive. */ ByteSink getArchive() { @@ -112,6 +105,6 @@ public final class BundleCommandRequest //~--- fields --------------------------------------------------------------- - /** Field description */ + /** byte sink archive */ private final ByteSink archive; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java index 6861e481fe..4777e0c11b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java @@ -43,6 +43,7 @@ import sonia.scm.repository.api.UnbundleResponse; import java.io.IOException; /** + * Service provider implementation for the unbundle command. * * @author Sebastian Sdorra * @since 1.43 @@ -51,16 +52,16 @@ public interface UnbundleCommand { /** - * Method description + * The unbundle command can restore an empty repository from a bundle. * * - * @param request + * @param request unbundle request * - * @return + * @return unbundle response * * @throws IOException * @throws RepositoryException */ public UnbundleResponse unbundle(UnbundleCommandRequest request) - throws IOException, RepositoryException;; + throws IOException, RepositoryException; } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java index 0378a385c0..b9e9a5182b 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java @@ -39,6 +39,7 @@ import com.google.common.base.Objects; import com.google.common.io.ByteSource; /** + * Request object for the unbundle command. * * @author Sebastian Sdorra * @since 1.43 @@ -47,10 +48,10 @@ public final class UnbundleCommandRequest { /** - * Constructs ... + * Constructs a new unbundle command request. * * - * @param archive + * @param archive byte source archive */ public UnbundleCommandRequest(ByteSource archive) { @@ -60,12 +61,7 @@ public final class UnbundleCommandRequest //~--- methods -------------------------------------------------------------- /** - * Method description - * - * - * @param obj - * - * @return + * {@inheritDoc} */ @Override public boolean equals(Object obj) @@ -86,10 +82,7 @@ public final class UnbundleCommandRequest } /** - * Method description - * - * - * @return + * {@inheritDoc} */ @Override public int hashCode() @@ -100,10 +93,10 @@ public final class UnbundleCommandRequest //~--- get methods ---------------------------------------------------------- /** - * Method description + * Returns the archive as {@link ByteSource}. * * - * @return + * @return {@link ByteSource} archive */ ByteSource getArchive() { @@ -112,6 +105,6 @@ public final class UnbundleCommandRequest //~--- fields --------------------------------------------------------------- - /** Field description */ + /** byte source archive */ private final ByteSource archive; } From 3e6ef0ce653addc7db470716916f2841d3e84ad1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Nov 2014 17:55:59 +0100 Subject: [PATCH 30/68] return changeset count for bundle and unbundle command --- ...stractBundleOrUnbundleCommandResponse.java | 121 ++++++++++++++++++ .../scm/repository/api/BundleResponse.java | 18 ++- .../scm/repository/api/UnbundleResponse.java | 17 ++- .../scm/repository/spi/SvnBundleCommand.java | 5 +- .../repository/spi/SvnUnbundleCommand.java | 6 +- .../repository/spi/SvnBundleCommandTest.java | 3 +- .../spi/SvnUnbundleCommandTest.java | 3 +- 7 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/AbstractBundleOrUnbundleCommandResponse.java diff --git a/scm-core/src/main/java/sonia/scm/repository/api/AbstractBundleOrUnbundleCommandResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/AbstractBundleOrUnbundleCommandResponse.java new file mode 100644 index 0000000000..36ae6f89ad --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/AbstractBundleOrUnbundleCommandResponse.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) 2014, 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; + +/** + * Abstract class for bundle or unbundle command. + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public abstract class AbstractBundleOrUnbundleCommandResponse +{ + + /** + * Constructs a new bundle/unbundle response. + * + * + * @param changesetCount count of bundled/unbundled changesets + */ + protected AbstractBundleOrUnbundleCommandResponse(long changesetCount) + { + this.changesetCount = changesetCount; + } + + //~--- methods -------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final AbstractBundleOrUnbundleCommandResponse other = + (AbstractBundleOrUnbundleCommandResponse) obj; + + return Objects.equal(changesetCount, other.changesetCount); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + return Objects.hashCode(changesetCount); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("changesetCount", changesetCount) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns the count of bundled/unbundled changesets. + * + * + * @return count of bundled/unbundled changesets + */ + public long getChangesetCount() + { + return changesetCount; + } + + //~--- fields --------------------------------------------------------------- + + /** count of bundled/unbundled changesets */ + private final long changesetCount; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java index 0ad17ce700..8cad1edc65 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java @@ -34,9 +34,23 @@ package sonia.scm.repository.api; /** - * Response of {@link BundleCommandBuilder}. + * Response of bundle command. * * @author Sebastian Sdorra * @since 1.43 */ -public class BundleResponse {} +public final class BundleResponse + extends AbstractBundleOrUnbundleCommandResponse +{ + + /** + * Constructs a new bundle response. + * + * + * @param changesetCount count of bundled changesets + */ + public BundleResponse(long changesetCount) + { + super(changesetCount); + } +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java index bc2a897fd9..0c177ba699 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java @@ -34,9 +34,22 @@ package sonia.scm.repository.api; /** - * Response of {@link UnbundleCommandBuilder}. + * Response of unbundle command. * * @author Sebastian Sdorra * @since 1.43 */ -public class UnbundleResponse {} +public class UnbundleResponse extends AbstractBundleOrUnbundleCommandResponse +{ + + /** + * Constructs a new unbundle response. + * + * + * @param changesetCount count of unbundled changesets + */ + public UnbundleResponse(long changesetCount) + { + super(changesetCount); + } +} diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java index bf02cc7d0e..af9dbe5fda 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnBundleCommand.java @@ -125,6 +125,8 @@ public class SvnBundleCommand extends AbstractSvnCommand ByteSink archive = checkNotNull(request.getArchive(), "archive is required"); + BundleResponse response; + SVNClientManager clientManager = null; try @@ -134,6 +136,7 @@ public class SvnBundleCommand extends AbstractSvnCommand SVNAdminClient adminClient = clientManager.getAdminClient(); dump(adminClient, context.getDirectory(), archive); + response = new BundleResponse(context.open().getLatestRevision()); } catch (SVNException ex) { @@ -144,6 +147,6 @@ public class SvnBundleCommand extends AbstractSvnCommand SvnUtil.dispose(clientManager); } - return new BundleResponse(); + return response; } } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java index f7479caeaa..f8ebfc765a 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnUnbundleCommand.java @@ -105,6 +105,8 @@ public class SvnUnbundleCommand extends AbstractSvnCommand logger.debug("archive repository {} to {}", context.getDirectory(), archive); + UnbundleResponse response; + SVNClientManager clientManager = null; try @@ -114,6 +116,8 @@ public class SvnUnbundleCommand extends AbstractSvnCommand SVNAdminClient adminClient = clientManager.getAdminClient(); restore(adminClient, archive, context.getDirectory()); + + response = new UnbundleResponse(context.open().getLatestRevision()); } catch (SVNException ex) { @@ -124,7 +128,7 @@ public class SvnUnbundleCommand extends AbstractSvnCommand SvnUtil.dispose(clientManager); } - return new UnbundleResponse(); + return response; } /** diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java index a7b5a17687..57fde186cf 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnBundleCommandTest.java @@ -77,7 +77,8 @@ public class SvnBundleCommandTest extends AbstractSvnCommandTestBase BundleResponse res = new SvnBundleCommand(createContext(), repository).bundle(req); - assertNotNull(res); + assertThat(res, notNullValue()); + assertThat(res.getChangesetCount(), is(5l)); assertTrue("file does not exists", file.exists()); assertThat(file.length(), greaterThan(0l)); } diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java index 18d784ade2..2c59797296 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/spi/SvnUnbundleCommandTest.java @@ -86,7 +86,8 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase ); //J+ - assertNotNull(res); + assertThat(res, notNullValue()); + assertThat(res.getChangesetCount(), is(5l)); SVNRepository repo = ctx.open(); From c7007e7bd0132e1a68f02bc34e4bbd96cc9869ff Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 3 Nov 2014 17:07:49 +0100 Subject: [PATCH 31/68] javadoc and rest docs --- .../scm/api/rest/resources/KeyResource.java | 7 +- .../resources/RepositoryImportResource.java | 76 +++++++++++++------ 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/KeyResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/KeyResource.java index 619a8e9a2a..3a6e10a51f 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/KeyResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/KeyResource.java @@ -37,6 +37,8 @@ import com.google.inject.Inject; import org.apache.shiro.SecurityUtils; +import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle; + import sonia.scm.security.KeyGenerator; import sonia.scm.security.Role; @@ -54,6 +56,7 @@ import javax.ws.rs.core.MediaType; * @since 1.41 */ @Path("security/key") +@ExternallyManagedLifecycle public class KeyResource { @@ -72,7 +75,7 @@ public class KeyResource //~--- methods -------------------------------------------------------------- /** - * Generates a unique key. This method can only executed with administration + * Generates a unique key. This method can only executed with administration * privileges.
*
*
    @@ -93,6 +96,6 @@ public class KeyResource //~--- fields --------------------------------------------------------------- - /** Field description */ + /** key generator */ private final KeyGenerator keyGenerator; } diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index b3a994112a..ffa1087f45 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -36,7 +36,6 @@ package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- import com.google.inject.Inject; -import com.google.inject.Singleton; import org.codehaus.enunciate.jaxrs.TypeHint; import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle; @@ -47,12 +46,15 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.Type; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RepositoryHandler; import sonia.scm.repository.RepositoryManager; import sonia.scm.util.SecurityUtil; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -65,12 +67,13 @@ import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; /** + * Rest resource for importing repositories. * * @author Sebastian Sdorra */ -@Singleton @Path("import/repositories") @ExternallyManagedLifecycle public class RepositoryImportResource @@ -85,11 +88,9 @@ public class RepositoryImportResource //~--- constructors --------------------------------------------------------- /** - * Constructs ... + * Constructs a new repository import resource. * - * - * @param manager - * @param securityContextProvider + * @param manager repository manager */ @Inject public RepositoryImportResource(RepositoryManager manager) @@ -100,19 +101,26 @@ public class RepositoryImportResource //~--- methods -------------------------------------------------------------- /** - * Method description + * Imports repositories of the given type from the configured repository + * directory. This method requires admin privileges.
    + *
    + * Status codes: + *
      + *
    • 200 ok, successful
    • + *
    • 400 bad request, the import feature is not + * supported by this type of repositories.
    • + *
    • 500 internal server error
    • + *
    * + * @param type repository type * - * @param type - * - * @return + * @return imported repositories */ @POST @Path("{type}") @TypeHint(Repository[].class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public GenericEntity> importRepositories( - @PathParam("type") String type) + public Response importRepositories(@PathParam("type") String type) { SecurityUtil.assertIsAdmin(); @@ -144,7 +152,15 @@ public class RepositoryImportResource } } } - catch (Exception ex) + catch (NotSupportedFeatuerException ex) + { + throw new WebApplicationException(ex, Response.Status.BAD_REQUEST); + } + catch (IOException ex) + { + throw new WebApplicationException(ex); + } + catch (RepositoryException ex) { throw new WebApplicationException(ex); } @@ -154,22 +170,33 @@ public class RepositoryImportResource logger.warn("could not find handler for type {}", type); } - return new GenericEntity>(repositories) {} - ; + //J- + return Response.ok( + new GenericEntity>(repositories) {} + ).build(); + //J+ } //~--- get methods ---------------------------------------------------------- /** - * Method description + * Returns a list of repository types, which support the import feature. + * This method requires admin privileges.
    + *
    + * Status codes: + *
      + *
    • 200 ok, successful
    • + *
    • 400 bad request, the import feature is not + * supported by this type of repositories.
    • + *
    • 500 internal server error
    • + *
    * - * - * @return + * @return list of repository types */ @GET @TypeHint(Type[].class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public GenericEntity> getImportableTypes() + public Response getImportableTypes() { SecurityUtil.assertIsAdmin(); @@ -208,12 +235,15 @@ public class RepositoryImportResource } } - return new GenericEntity>(types) {} - ; + //J- + return Response.ok( + new GenericEntity>(types) {} + ).build(); + //J+ } //~--- fields --------------------------------------------------------------- - /** Field description */ - private RepositoryManager manager; + /** repository manager */ + private final RepositoryManager manager; } From c2cfe2194593cb307250e4e4507f0ff6a39ccae1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 4 Nov 2014 15:54:38 +0100 Subject: [PATCH 32/68] do not try to convert git changesets from a receive command of type delete --- .../repository/GitHookChangesetCollector.java | 154 +++++++++--------- 1 file changed, 73 insertions(+), 81 deletions(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java index 58b7ea0d75..7ba8b7106b 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java @@ -37,8 +37,8 @@ package sonia.scm.repository; import com.google.common.collect.Lists; +import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevSort; import org.eclipse.jgit.revwalk.RevWalk; @@ -52,8 +52,9 @@ import sonia.scm.util.IOUtil; //~--- JDK imports ------------------------------------------------------------ +import java.io.IOException; + import java.util.List; -import java.util.Map; /** * @@ -109,76 +110,27 @@ public class GitHookChangesetCollector for (ReceiveCommand rc : receiveCommands) { - //J- - logger.trace("handle receive command, type={}, ref={}, result={}", - new Object[] { - rc.getType(), - rc.getRefName(), - rc.getResult() - } - ); - //J+ - - ObjectId newId = rc.getNewId(); - - String branch = GitUtil.getBranch(rc.getRefName()); - - walk.reset(); - walk.sort(RevSort.TOPO); - walk.sort(RevSort.REVERSE, true); - - if (logger.isTraceEnabled()) + if (rc.getType() != ReceiveCommand.Type.DELETE) { - logger.trace("mark {} as start for rev walk", newId.getName()); - } - - walk.markStart(walk.parseCommit(newId)); - - ObjectId oldId = rc.getOldId(); - - if ((oldId != null) &&!oldId.equals(ObjectId.zeroId())) - { - if (logger.isTraceEnabled()) + try { - logger.trace("mark {} as uninteresting for rev walk", - oldId.getName()); + collectChangesets(changesets, converter, walk, rc); } - - walk.markUninteresting(walk.parseCommit(oldId)); - } - - for (ObjectId id : getExistingObjects(rpack)) - { - if (logger.isTraceEnabled()) + catch (IOException ex) { - logger.trace("mark {} as uninteresting for rev walk", id.getName()); + StringBuilder builder = new StringBuilder(); + + builder.append("could not handle receive command, type="); + builder.append(rc.getType()).append(", ref="); + builder.append(rc.getRefName()).append(", result="); + builder.append(rc.getResult()); + logger.error(builder.toString(), ex); } - - walk.markUninteresting(walk.parseCommit(id)); } - - RevCommit commit = walk.next(); - - List branches = Lists.newArrayList(branch); - - while (commit != null) + else { - - // parse commit body to avoid npe - walk.parseBody(commit); - - Changeset changeset = converter.createChangeset(commit, branches); - - if (logger.isTraceEnabled()) - { - logger.trace("retrive commit {} for hook", changeset.getId()); - } - - changesets.add(changeset); - - commit = walk.next(); + logger.debug("skip delete of branch {}", rc.getRefName()); } - } } @@ -195,38 +147,78 @@ public class GitHookChangesetCollector return changesets; } - //~--- get methods ---------------------------------------------------------- - /** * Method description * * - * @param rpack + * @param changesets + * @param converter + * @param walk + * @param rc * - * @return + * @throws IOException + * @throws IncorrectObjectTypeException */ - private List getExistingObjects(ReceivePack rpack) + private void collectChangesets(List changesets, + GitChangesetConverter converter, RevWalk walk, ReceiveCommand rc) + throws IncorrectObjectTypeException, IOException { - List existingObjects = Lists.newArrayList(); - - if (existingObjects == null) - { - Map refs = rpack.getRepository().getAllRefs(); - - for (Ref r : refs.values()) - { - existingObjects.add(r.getObjectId()); + //J- + logger.trace("handle receive command, type={}, ref={}, result={}", + new Object[] { + rc.getType(), + rc.getRefName(), + rc.getResult() } + ); + //J+ + + ObjectId newId = rc.getNewId(); + + String branch = GitUtil.getBranch(rc.getRefName()); + + walk.reset(); + walk.sort(RevSort.TOPO); + walk.sort(RevSort.REVERSE, true); + + logger.trace("mark {} as start for rev walk", newId.getName()); + + walk.markStart(walk.parseCommit(newId)); + + ObjectId oldId = rc.getOldId(); + + if ((oldId != null) &&!oldId.equals(ObjectId.zeroId())) + { + logger.trace("mark {} as uninteresting for rev walk", oldId.getName()); + + walk.markUninteresting(walk.parseCommit(oldId)); } - return existingObjects; + RevCommit commit = walk.next(); + + List branches = Lists.newArrayList(branch); + + while (commit != null) + { + + // parse commit body to avoid npe + walk.parseBody(commit); + + Changeset changeset = converter.createChangeset(commit, branches); + + logger.trace("retrive commit {} for hook", changeset.getId()); + + changesets.add(changeset); + + commit = walk.next(); + } } //~--- fields --------------------------------------------------------------- /** Field description */ - private List receiveCommands; + private final List receiveCommands; /** Field description */ - private ReceivePack rpack; + private final ReceivePack rpack; } From 83b56ad5e44663b62c5758912d80ba6793bc50ff Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 18 Nov 2014 18:26:06 +0100 Subject: [PATCH 33/68] update jersey to version 1.18.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 49d2d267ab..c879a04202 100644 --- a/pom.xml +++ b/pom.xml @@ -430,7 +430,7 @@ 1.1.2 2.5 3.0 - 1.18.1 + 1.18.2 2.6.6 2.3.20 7.6.16.v20140903 @@ -441,7 +441,7 @@ 3.4.1.201406201815-r 1.8.5-scm2 - + 15.0 From 659da861f2edf89d200ee240f453607f44d34240 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 25 Nov 2014 08:13:48 +0100 Subject: [PATCH 34/68] create default accounts only, if no other user exists in the dao --- .../sonia/scm/user/DefaultUserManager.java | 7 +- .../scm/user/DefaultUserManagerTest.java | 95 ++++++++++++++++--- 2 files changed, 88 insertions(+), 14 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java b/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java index 3b82269bde..4dce1df549 100644 --- a/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java +++ b/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java @@ -102,7 +102,6 @@ public class DefaultUserManager extends AbstractUserManager * Constructs ... * * - * @param scurityContextProvider * @param userDAO * @param userListenerProvider */ @@ -234,8 +233,8 @@ public class DefaultUserManager extends AbstractUserManager public void init(SCMContextProvider context) { - // TODO improve - if (!userDAO.contains("scmadmin") &&!userDAO.contains("anonymous")) + // create default account only, if no other account is available + if (userDAO.getAll().isEmpty()) { createDefaultAccounts(); } @@ -531,6 +530,8 @@ public class DefaultUserManager extends AbstractUserManager { try { + logger.info("create default accounts"); + JAXBContext context = JAXBContext.newInstance(User.class); Unmarshaller unmarshaller = context.createUnmarshaller(); diff --git a/scm-webapp/src/test/java/sonia/scm/user/DefaultUserManagerTest.java b/scm-webapp/src/test/java/sonia/scm/user/DefaultUserManagerTest.java index d18dac8bb6..426cf21ded 100644 --- a/scm-webapp/src/test/java/sonia/scm/user/DefaultUserManagerTest.java +++ b/scm-webapp/src/test/java/sonia/scm/user/DefaultUserManagerTest.java @@ -35,20 +35,27 @@ package sonia.scm.user; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.collect.Lists; import com.google.inject.Provider; +import org.junit.Before; +import org.junit.Test; + import sonia.scm.store.JAXBStoreFactory; import sonia.scm.store.StoreFactory; import sonia.scm.user.xml.XmlUserDAO; import sonia.scm.util.MockUtil; +import static org.junit.Assert.*; + import static org.mockito.Mockito.*; //~--- JDK imports ------------------------------------------------------------ +import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; -import org.junit.Before; /** * @@ -56,11 +63,6 @@ import org.junit.Before; */ public class DefaultUserManagerTest extends UserManagerTestBase { - - @Before - public void setAdminSubject(){ - setSubject(MockUtil.createAdminSubject()); - } /** * Method description @@ -71,16 +73,87 @@ public class DefaultUserManagerTest extends UserManagerTestBase @Override public UserManager createManager() { - StoreFactory factory = new JAXBStoreFactory(); + return new DefaultUserManager(createXmlUserDAO(), createListenerProvider()); + } - factory.init(contextProvider); + /** + * Method description + * + */ + @Test + public void testDefaultAccountAfterFristStart() + { + UserDAO userDAO = mock(UserDAO.class); + List users = Lists.newArrayList(new User("tuser")); + when(userDAO.getAll()).thenReturn(users); + + UserManager userManager = new DefaultUserManager(userDAO, + createListenerProvider()); + + userManager.init(contextProvider); + verify(userDAO, never()).add(any(User.class)); + } + + /** + * Method description + * + */ + @Test + public void testDefaultAccountCreation() + { + UserDAO userDAO = mock(UserDAO.class); + + when(userDAO.getAll()).thenReturn(Collections.EMPTY_LIST); + + UserManager userManager = new DefaultUserManager(userDAO, + createListenerProvider()); + + userManager.init(contextProvider); + verify(userDAO, times(2)).add(any(User.class)); + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + */ + @Before + public void setAdminSubject() + { + setSubject(MockUtil.createAdminSubject()); + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + private Provider> createListenerProvider() + { Provider> listenerProvider = mock(Provider.class); when(listenerProvider.get()).thenReturn(new HashSet()); - XmlUserDAO userDAO = new XmlUserDAO(factory); - - return new DefaultUserManager(userDAO, listenerProvider); + return listenerProvider; + } + + /** + * Method description + * + * + * @return + */ + private XmlUserDAO createXmlUserDAO() + { + StoreFactory factory = new JAXBStoreFactory(); + + factory.init(contextProvider); + + return new XmlUserDAO(factory); } } From fa40264997050729579c7c8f95e0f88a4631f473 Mon Sep 17 00:00:00 2001 From: Yuri Konotopov Date: Tue, 25 Nov 2014 19:35:56 +0300 Subject: [PATCH 35/68] Added utf-8 response encoding for git quick commit view --- .../src/main/java/sonia/scm/web/GitRepositoryViewer.java | 1 + 1 file changed, 1 insertion(+) 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 1c01ef2fc1..969e00888b 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 @@ -158,6 +158,7 @@ public class GitRepositoryViewer try { + response.setCharacterEncoding("UTF-8"); writer = response.getWriter(); template.execute(writer, env); } From a35e839688ba6d222088fcaad94797026ffa0871 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Nov 2014 13:56:27 +0100 Subject: [PATCH 36/68] improve import rest api to handle imports of external repositories via url --- .../resources/RepositoryImportResource.java | 320 +++++++++++++++++- 1 file changed, 315 insertions(+), 5 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index ffa1087f45..f3b470409c 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -35,8 +35,12 @@ package sonia.scm.api.rest.resources; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Objects; +import com.google.common.base.Strings; import com.google.inject.Inject; +import org.apache.shiro.SecurityUtils; + import org.codehaus.enunciate.jaxrs.TypeHint; import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle; @@ -46,28 +50,46 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.Type; import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryAllreadyExistExeption; import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RepositoryHandler; import sonia.scm.repository.RepositoryManager; -import sonia.scm.util.SecurityUtil; +import sonia.scm.repository.RepositoryType; +import sonia.scm.repository.api.Command; +import sonia.scm.repository.api.RepositoryService; +import sonia.scm.repository.api.RepositoryServiceFactory; +import sonia.scm.security.Role; +import sonia.scm.util.IOUtil; + +import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; +import java.net.URI; + import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; +import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; /** * Rest resource for importing repositories. @@ -91,15 +113,90 @@ public class RepositoryImportResource * Constructs a new repository import resource. * * @param manager repository manager + * @param serviceFactory */ @Inject - public RepositoryImportResource(RepositoryManager manager) + public RepositoryImportResource(RepositoryManager manager, + RepositoryServiceFactory serviceFactory) { this.manager = manager; + this.serviceFactory = serviceFactory; } //~--- methods -------------------------------------------------------------- + /** + * Imports a external repository which is accessible via url. The method can + * only be used, if the repository type supports the {@link Command#PULL}. The + * method will return a location header with the url to the imported + * repository. + * + * Status codes: + *
      + *
    • 201 created
    • + *
    • 400 bad request, the import by url feature is not supported by this + * type of repositories or the parameters are not valid.
    • + *
    • 500 internal server error
    • + *
    + * + * @param uriInfo uri info + * @param type repository type + * @param request request object + * + * @return empty response with location header which points to the imported + * repository + */ + @POST + @Path("{type}/url") + @TypeHint(Repository.class) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response importFromUrl(@Context UriInfo uriInfo, + @PathParam("type") String type, UrlImportRequest request) + { + SecurityUtils.getSubject().checkRole(Role.ADMIN); + checkNotNull(request, "request is required"); + checkArgument(!Strings.isNullOrEmpty(request.getName()), + "request does not contain name of the repository"); + checkArgument(!Strings.isNullOrEmpty(request.getUrl()), + "request does not contain url of the remote repository"); + + RepositoryHandler handler = manager.getHandler(type); + + if (handler == null) + { + logger.warn("no handler for type {} found", type); + + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + Type t = handler.getType(); + + checkSupport(t, Command.PULL, request); + + Repository repository = create(type, request.getName()); + RepositoryService service = null; + + try + { + service = serviceFactory.create(repository); + service.getPullCommand().pull(request.getUrl()); + } + catch (RepositoryException ex) + { + handleImportFailure(ex, repository); + } + catch (IOException ex) + { + handleImportFailure(ex, repository); + } + finally + { + IOUtil.close(service); + } + + return buildResponse(uriInfo, repository); + } + /** * Imports repositories of the given type from the configured repository * directory. This method requires admin privileges.
    @@ -122,7 +219,7 @@ public class RepositoryImportResource @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response importRepositories(@PathParam("type") String type) { - SecurityUtil.assertIsAdmin(); + SecurityUtils.getSubject().checkRole(Role.ADMIN); List repositories = new ArrayList(); RepositoryHandler handler = manager.getHandler(type); @@ -180,7 +277,9 @@ public class RepositoryImportResource //~--- get methods ---------------------------------------------------------- /** - * Returns a list of repository types, which support the import feature. + * Returns a list of repository types, which support the directory import + * feature. + * * This method requires admin privileges.
    *
    * Status codes: @@ -188,6 +287,7 @@ public class RepositoryImportResource *
  • 200 ok, successful
  • *
  • 400 bad request, the import feature is not * supported by this type of repositories.
  • + *
  • 409 conflict, a repository with the name already exists.
  • *
  • 500 internal server error
  • *
* @@ -198,7 +298,7 @@ public class RepositoryImportResource @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response getImportableTypes() { - SecurityUtil.assertIsAdmin(); + SecurityUtils.getSubject().checkRole(Role.ADMIN); List types = new ArrayList(); Collection handlerTypes = manager.getTypes(); @@ -242,8 +342,218 @@ public class RepositoryImportResource //J+ } + //~--- methods -------------------------------------------------------------- + + /** + * Build rest response for repository. + * + * + * @param uriInfo uri info + * @param repository imported repository + * + * @return rest response + */ + private Response buildResponse(UriInfo uriInfo, Repository repository) + { + URI location = uriInfo.getBaseUriBuilder().path( + RepositoryResource.class).path(repository.getId()).build(); + + return Response.created(location).build(); + } + + /** + * Check repository type for support for the given command. + * + * + * @param type repository type + * @param cmd command + * @param request request object + */ + private void checkSupport(Type type, Command cmd, Object request) + { + if (!(type instanceof RepositoryType)) + { + logger.warn("type {} is not a repository type", type.getName()); + + throw new WebApplicationException(Response.Status.BAD_REQUEST); + } + + Set cmds = ((RepositoryType) type).getSupportedCommands(); + + if (!cmds.contains(cmd)) + { + logger.warn("type {} does not support this type of import: {}", + type.getName(), request); + + throw new WebApplicationException(Response.Status.BAD_REQUEST); + } + } + + /** + * Creates a new repository with the given name and type. + * + * + * @param type repository type + * @param name repository name + * + * @return newly created repository + */ + private Repository create(String type, String name) + { + Repository repository = null; + + try + { + repository = new Repository(null, type, name); + manager.create(repository); + } + catch (RepositoryAllreadyExistExeption ex) + { + logger.warn("a {} repository with the name {} already exists", ex); + + throw new WebApplicationException(Response.Status.CONFLICT); + } + catch (RepositoryException ex) + { + handleGenericCreationFailure(ex, type, name); + } + catch (IOException ex) + { + handleGenericCreationFailure(ex, type, name); + } + + return repository; + } + + /** + * Handle creation failures. + * + * + * @param ex exception + * @param type repository type + * @param name name of the repository + */ + private void handleGenericCreationFailure(Exception ex, String type, + String name) + { + logger.error(String.format("could not create repository {} with type {}", + type, name), ex); + + throw new WebApplicationException(ex); + } + + /** + * Handle import failures. + * + * + * @param ex exception + * @param repository repository + */ + private void handleImportFailure(Exception ex, Repository repository) + { + logger.error("import for repository failed, delete repository", ex); + + try + { + manager.delete(repository); + } + catch (IOException e) + { + logger.error("can not delete repository", e); + } + catch (RepositoryException e) + { + logger.error("can not delete repository", e); + } + + throw new WebApplicationException(ex, + Response.Status.INTERNAL_SERVER_ERROR); + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Request for importing external repositories which are accessible via url. + */ + @XmlRootElement(name = "import") + @XmlAccessorType(XmlAccessType.FIELD) + public static class UrlImportRequest + { + + /** + * Constructs ... + * + */ + public UrlImportRequest() {} + + /** + * Constructs a new {@link UrlImportRequest} + * + * + * @param name name of the repository + * @param url external url of the repository + */ + public UrlImportRequest(String name, String url) + { + this.name = name; + this.url = url; + } + + //~--- methods ------------------------------------------------------------ + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("name", name) + .add("url", url) + .toString(); + //J+ + } + + //~--- get methods -------------------------------------------------------- + + /** + * Returns name of the repository. + * + * + * @return name of the repository + */ + public String getName() + { + return name; + } + + /** + * Returns external url of the repository. + * + * + * @return external url of the repository + */ + public String getUrl() + { + return url; + } + + //~--- fields ------------------------------------------------------------- + + /** name of the repository */ + private String name; + + /** external url of the repository */ + private String url; + } + + //~--- fields --------------------------------------------------------------- /** repository manager */ private final RepositoryManager manager; + + /** repository service factory */ + private final RepositoryServiceFactory serviceFactory; } From 525eb58631fa1594ac8820546c38a9932dc3b690 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Nov 2014 14:35:37 +0100 Subject: [PATCH 37/68] added rest endpoint to start a directory import for all supported repository types --- .../resources/RepositoryImportResource.java | 219 ++++++++++++------ 1 file changed, 143 insertions(+), 76 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index f3b470409c..d6d7e3110e 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -129,7 +129,7 @@ public class RepositoryImportResource * Imports a external repository which is accessible via url. The method can * only be used, if the repository type supports the {@link Command#PULL}. The * method will return a location header with the url to the imported - * repository. + * repository. This method requires admin privileges.
* * Status codes: *
    @@ -173,6 +173,8 @@ public class RepositoryImportResource checkSupport(t, Command.PULL, request); + logger.info("start {} import for external url {}", type, request.getUrl()); + Repository repository = create(type, request.getName()); RepositoryService service = null; @@ -222,49 +224,44 @@ public class RepositoryImportResource SecurityUtils.getSubject().checkRole(Role.ADMIN); List repositories = new ArrayList(); - RepositoryHandler handler = manager.getHandler(type); - if (handler != null) + importFromDirectory(repositories, type); + + //J- + return Response.ok( + new GenericEntity>(repositories) {} + ).build(); + //J+ + } + + /** + * Imports repositories of all supported types from the configured repository + * directories. This method requires admin privileges.
    + *
    + * Status codes: + *
      + *
    • 200 ok, successful
    • + *
    • 400 bad request, the import feature is not + * supported by this type of repositories.
    • + *
    • 500 internal server error
    • + *
    + * + * @return imported repositories + */ + @POST + @TypeHint(Repository[].class) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response importRepositories() + { + SecurityUtils.getSubject().checkRole(Role.ADMIN); + + logger.info("start directory import for all supported repository types"); + + List repositories = new ArrayList(); + + for (Type t : findImportableTypes()) { - try - { - List repositoryNames = - handler.getImportHandler().importRepositories(manager); - - if (repositoryNames != null) - { - for (String repositoryName : repositoryNames) - { - Repository repository = manager.get(type, repositoryName); - - if (repository != null) - { - repositories.add(repository); - } - else if (logger.isWarnEnabled()) - { - logger.warn("could not find imported repository {}", - repositoryName); - } - } - } - } - catch (NotSupportedFeatuerException ex) - { - throw new WebApplicationException(ex, Response.Status.BAD_REQUEST); - } - catch (IOException ex) - { - throw new WebApplicationException(ex); - } - catch (RepositoryException ex) - { - throw new WebApplicationException(ex); - } - } - else if (logger.isWarnEnabled()) - { - logger.warn("could not find handler for type {}", type); + importFromDirectory(repositories, t.getName()); } //J- @@ -300,40 +297,7 @@ public class RepositoryImportResource { SecurityUtils.getSubject().checkRole(Role.ADMIN); - List types = new ArrayList(); - Collection handlerTypes = manager.getTypes(); - - for (Type t : handlerTypes) - { - RepositoryHandler handler = manager.getHandler(t.getName()); - - if (handler != null) - { - try - { - if (handler.getImportHandler() != null) - { - types.add(t); - } - } - catch (NotSupportedFeatuerException ex) - { - if (logger.isTraceEnabled()) - { - logger.trace("import handler is not supported", ex); - } - else if (logger.isInfoEnabled()) - { - logger.info("{} handler does not support import of repositories", - t.getName()); - } - } - } - else if (logger.isWarnEnabled()) - { - logger.warn("could not find handler for type {}", t.getName()); - } - } + List types = findImportableTypes(); //J- return Response.ok( @@ -425,6 +389,52 @@ public class RepositoryImportResource return repository; } + /** + * Method description + * + * + * @return + */ + private List findImportableTypes() + { + List types = new ArrayList(); + Collection handlerTypes = manager.getTypes(); + + for (Type t : handlerTypes) + { + RepositoryHandler handler = manager.getHandler(t.getName()); + + if (handler != null) + { + try + { + if (handler.getImportHandler() != null) + { + types.add(t); + } + } + catch (NotSupportedFeatuerException ex) + { + if (logger.isTraceEnabled()) + { + logger.trace("import handler is not supported", ex); + } + else if (logger.isInfoEnabled()) + { + logger.info("{} handler does not support import of repositories", + t.getName()); + } + } + } + else if (logger.isWarnEnabled()) + { + logger.warn("could not find handler for type {}", t.getName()); + } + } + + return types; + } + /** * Handle creation failures. * @@ -470,6 +480,63 @@ public class RepositoryImportResource Response.Status.INTERNAL_SERVER_ERROR); } + /** + * Import repositories from a specific type. + * + * + * @param repositories repository list + * @param type type of repository + */ + private void importFromDirectory(List repositories, String type) + { + RepositoryHandler handler = manager.getHandler(type); + + if (handler != null) + { + logger.info("start directory import for repository type {}", type); + + try + { + List repositoryNames = + handler.getImportHandler().importRepositories(manager); + + if (repositoryNames != null) + { + for (String repositoryName : repositoryNames) + { + Repository repository = manager.get(type, repositoryName); + + if (repository != null) + { + repositories.add(repository); + } + else if (logger.isWarnEnabled()) + { + logger.warn("could not find imported repository {}", + repositoryName); + } + } + } + } + catch (NotSupportedFeatuerException ex) + { + throw new WebApplicationException(ex, Response.Status.BAD_REQUEST); + } + catch (IOException ex) + { + throw new WebApplicationException(ex); + } + catch (RepositoryException ex) + { + throw new WebApplicationException(ex); + } + } + else + { + throw new WebApplicationException(Response.Status.BAD_REQUEST); + } + } + //~--- inner classes -------------------------------------------------------- /** From 0a06885967f89863ea64cf01c6caf4be7d921ad1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Nov 2014 16:54:50 +0100 Subject: [PATCH 38/68] added rest endpoint to handle imports of repository bundles such as svn dumps --- .../resources/RepositoryImportResource.java | 159 ++++++++++++++++-- 1 file changed, 147 insertions(+), 12 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index d6d7e3110e..cf8ebdb261 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -37,6 +37,7 @@ package sonia.scm.api.rest.resources; import com.google.common.base.Objects; import com.google.common.base.Strings; +import com.google.common.io.Files; import com.google.inject.Inject; import org.apache.shiro.SecurityUtils; @@ -65,7 +66,11 @@ import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ +import com.sun.jersey.multipart.FormDataParam; + +import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.URI; @@ -90,6 +95,7 @@ import javax.ws.rs.core.UriInfo; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import sonia.scm.repository.api.UnbundleCommandBuilder; /** * Rest resource for importing repositories. @@ -125,6 +131,123 @@ public class RepositoryImportResource //~--- methods -------------------------------------------------------------- + /** + * Imports a repository type specific bundle. The bundle file is uploaded to + * the server which is running scm-manager. After the upload has finished, the + * bundle file is passed to the {@link UnbundleCommandBuilder}. This method + * requires admin privileges.
    + * + * Status codes: + *
      + *
    • 201 created
    • + *
    • 400 bad request, the import bundle feature is not supported by this + * type of repositories or the parameters are not valid.
    • + *
    • 500 internal server error
    • + *
    • 409 conflict, a repository with the name already exists.
    • + *
    + * + * @param uriInfo uri info + * @param type repository type + * @param name name of the repository + * @param inputStream input bundle + * + * @return empty response with location header which points to the imported + * repository + */ + @POST + @Path("{type}/bundle") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public Response importFromBundle(@Context UriInfo uriInfo, + @PathParam("type") String type, @FormDataParam("name") String name, + @FormDataParam("bundle") InputStream inputStream) + { + SecurityUtils.getSubject().checkRole(Role.ADMIN); + + checkArgument(!Strings.isNullOrEmpty(name), + "request does not contain name of the repository"); + checkNotNull(inputStream, "bundle inputStream is required"); + + Repository repository; + + try + { + File file = File.createTempFile("scm-import-", ".bundle"); + long length = Files.asByteSink(file).writeFrom(inputStream); + + logger.debug("copied {} bytes to temp", length); + + Type t = type(type); + + checkSupport(t, Command.UNBUNDLE, "bundle"); + + repository = create(type, name); + + RepositoryService service = null; + + try + { + service = serviceFactory.create(repository); + service.getUnbundleCommand().unbundle(file); + } + catch (RepositoryException ex) + { + handleImportFailure(ex, repository); + } + catch (IOException ex) + { + handleImportFailure(ex, repository); + } + finally + { + IOUtil.close(service); + } + } + catch (IOException ex) + { + logger.warn("could not create temporary file", ex); + + throw new WebApplicationException(ex); + } + + return buildResponse(uriInfo, repository); + } + + /** + * This method works exactly like + * {@link #importFromBundle(UriInfo, String, String, InputStream)}, but this + * method returns an html content-type. The method exists only for a + * workaround of the javascript ui extjs. This method requires admin + * privileges.
    + * + * Status codes: + *
      + *
    • 201 created
    • + *
    • 400 bad request, the import bundle feature is not supported by this + * type of repositories or the parameters are not valid.
    • + *
    • 500 internal server error
    • + *
    • 409 conflict, a repository with the name already exists.
    • + *
    + * + * + * @param uriInfo uri info + * @param type repository type + * @param name name of the repository + * @param inputStream input bundle + * + * @return empty response with location header which points to the imported + * repository + */ + @POST + @Path("{type}/bundle.html") + @Consumes(MediaType.MULTIPART_FORM_DATA) + @Produces(MediaType.TEXT_HTML) + public Response importFromBundleUI(@Context UriInfo uriInfo, + @PathParam("type") String type, @FormDataParam("name") String name, + @FormDataParam("bundle") InputStream inputStream) + { + return importFromBundle(uriInfo, type, name, inputStream); + } + /** * Imports a external repository which is accessible via url. The method can * only be used, if the repository type supports the {@link Command#PULL}. The @@ -136,6 +259,7 @@ public class RepositoryImportResource *
  • 201 created
  • *
  • 400 bad request, the import by url feature is not supported by this * type of repositories or the parameters are not valid.
  • + *
  • 409 conflict, a repository with the name already exists.
  • *
  • 500 internal server error
  • *
* @@ -148,7 +272,6 @@ public class RepositoryImportResource */ @POST @Path("{type}/url") - @TypeHint(Repository.class) @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response importFromUrl(@Context UriInfo uriInfo, @PathParam("type") String type, UrlImportRequest request) @@ -160,16 +283,7 @@ public class RepositoryImportResource checkArgument(!Strings.isNullOrEmpty(request.getUrl()), "request does not contain url of the remote repository"); - RepositoryHandler handler = manager.getHandler(type); - - if (handler == null) - { - logger.warn("no handler for type {} found", type); - - throw new WebApplicationException(Response.Status.NOT_FOUND); - } - - Type t = handler.getType(); + Type t = type(type); checkSupport(t, Command.PULL, request); @@ -284,7 +398,6 @@ public class RepositoryImportResource *
  • 200 ok, successful
  • *
  • 400 bad request, the import feature is not * supported by this type of repositories.
  • - *
  • 409 conflict, a repository with the name already exists.
  • *
  • 500 internal server error
  • * * @@ -537,6 +650,28 @@ public class RepositoryImportResource } } + /** + * Method description + * + * + * @param type + * + * @return + */ + private Type type(String type) + { + RepositoryHandler handler = manager.getHandler(type); + + if (handler == null) + { + logger.warn("no handler for type {} found", type); + + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + return handler.getType(); + } + //~--- inner classes -------------------------------------------------------- /** From d898b311b248c71017056afe0dfbe0f1c938ee53 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Nov 2014 16:57:13 +0100 Subject: [PATCH 39/68] improve bundle import execution order --- .../resources/RepositoryImportResource.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index cf8ebdb261..6107abcd1b 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -59,6 +59,7 @@ import sonia.scm.repository.RepositoryType; import sonia.scm.repository.api.Command; import sonia.scm.repository.api.RepositoryService; import sonia.scm.repository.api.RepositoryServiceFactory; +import sonia.scm.repository.api.UnbundleCommandBuilder; import sonia.scm.security.Role; import sonia.scm.util.IOUtil; @@ -95,7 +96,6 @@ import javax.ws.rs.core.UriInfo; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; -import sonia.scm.repository.api.UnbundleCommandBuilder; /** * Rest resource for importing repositories. @@ -134,7 +134,7 @@ public class RepositoryImportResource /** * Imports a repository type specific bundle. The bundle file is uploaded to * the server which is running scm-manager. After the upload has finished, the - * bundle file is passed to the {@link UnbundleCommandBuilder}. This method + * bundle file is passed to the {@link UnbundleCommandBuilder}. This method * requires admin privileges.
    * * Status codes: @@ -145,7 +145,7 @@ public class RepositoryImportResource *
  • 500 internal server error
  • *
  • 409 conflict, a repository with the name already exists.
  • * - * + * * @param uriInfo uri info * @param type repository type * @param name name of the repository @@ -171,11 +171,6 @@ public class RepositoryImportResource try { - File file = File.createTempFile("scm-import-", ".bundle"); - long length = Files.asByteSink(file).writeFrom(inputStream); - - logger.debug("copied {} bytes to temp", length); - Type t = type(type); checkSupport(t, Command.UNBUNDLE, "bundle"); @@ -184,8 +179,13 @@ public class RepositoryImportResource RepositoryService service = null; + File file = File.createTempFile("scm-import-", ".bundle"); + try { + long length = Files.asByteSink(file).writeFrom(inputStream); + + logger.info("copied {} bytes to temp, start bundle import", length); service = serviceFactory.create(repository); service.getUnbundleCommand().unbundle(file); } @@ -200,6 +200,7 @@ public class RepositoryImportResource finally { IOUtil.close(service); + IOUtil.delete(file); } } catch (IOException ex) @@ -213,10 +214,10 @@ public class RepositoryImportResource } /** - * This method works exactly like + * This method works exactly like * {@link #importFromBundle(UriInfo, String, String, InputStream)}, but this - * method returns an html content-type. The method exists only for a - * workaround of the javascript ui extjs. This method requires admin + * method returns an html content-type. The method exists only for a + * workaround of the javascript ui extjs. This method requires admin * privileges.
    * * Status codes: @@ -227,7 +228,7 @@ public class RepositoryImportResource *
  • 500 internal server error
  • *
  • 409 conflict, a repository with the name already exists.
  • * - * + * * * @param uriInfo uri info * @param type repository type From 264fa5fe0c286af5a56ba47b745e8597b57afdbc Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Nov 2014 20:10:36 +0100 Subject: [PATCH 40/68] load advanced plugin configuration from plugin directory and from root of scm home --- .../scm/plugin/DefaultPluginManager.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginManager.java b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginManager.java index 98479f77ec..b2250a3c21 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginManager.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginManager.java @@ -102,6 +102,9 @@ public class DefaultPluginManager private static final String ADVANCED_CONFIGURATION = "advanced-configuration.xml"; + /** Field description */ + private static final String DIRECTORY_PLUGINS = "plugins"; + /** the logger for DefaultPluginManager */ private static final Logger logger = LoggerFactory.getLogger(DefaultPluginManager.class); @@ -153,7 +156,7 @@ public class DefaultPluginManager throw new ConfigurationException(ex); } - File file = new File(context.getBaseDirectory(), ADVANCED_CONFIGURATION); + File file = findAdvancedConfiguration(); if (file.exists()) { @@ -541,6 +544,25 @@ public class DefaultPluginManager } } + /** + * Method description + * + * + * @return + */ + private File findAdvancedConfiguration() + { + File directory = new File(context.getBaseDirectory(), DIRECTORY_PLUGINS); + File file = new File(directory, ADVANCED_CONFIGURATION); + + if (!file.exists()) + { + file = new File(context.getBaseDirectory(), ADVANCED_CONFIGURATION); + } + + return file; + } + /** * Method description * From 054ea07a3486f1746bbb628c03a9ec7eb21cbe1e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 27 Nov 2014 15:48:09 +0100 Subject: [PATCH 41/68] start implementation of new repository import wizard --- .../sonia.repository.importwindow.js | 433 ++++++++++++------ 1 file changed, 286 insertions(+), 147 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 53ea0dcf19..617eef95aa 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -31,9 +31,52 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ - titleText: 'Import Repositories', - okText: 'Ok', - closeText: 'Close', + title: 'Repository Import Wizard', + + initComponent: function(){ + + this.addEvents('finish'); + + var config = { + title: this.title, + layout: 'fit', + width: 420, + height: 140, + closable: true, + resizable: true, + plain: true, + border: false, + modal: true, + bodyCssClass: 'x-panel-mc', + items: [{ + id: 'scmRepositoryImportWizard', + xtype: 'scmRepositoryImportWizard', + listeners: { + finish: { + fn: this.onFinish, + scope: this + } + } + }] + }; + + Ext.apply(this, Ext.apply(this.initialConfig, config)); + Sonia.repository.ImportWindow.superclass.initComponent.apply(this, arguments); + }, + + onFinish: function(config){ + this.fireEvent('finish', config); + this.close(); + } + +}); + +Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { + + // text + backText: 'Back', + nextText: 'Next', + finishText: 'Finish', // cache importForm: null, @@ -42,114 +85,220 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ importJobsFinished: 0, importJobs: 0, + // settings + repositoryType: null, + initComponent: function(){ - this.imported = []; - this.importJobsFinished = 0; - this.importJobs = 0; + this.addEvents('finish'); + + + var importedStore = new Ext.data.JsonStore({ + fields: ['type', 'name'] + }); + // store.loadData(this.imported); + + var importedColModel = new Ext.grid.ColumnModel({ + defaults: { + sortable: true, + scope: this + }, + columns: [ + {id: 'name', header: 'Name', dataIndex: 'name'}, + {id: 'type', header: 'Type', dataIndex: 'type'} + ] + }); + + var types = []; + + Ext.each(state.repositoryTypes, function(repositoryType){ + console.log(repositoryType); + types.push({ + boxLabel: repositoryType.displayName, + name: 'repositoryType', + inputValue: repositoryType.name, + checked: false + }); + }); var config = { - layout:'fit', - width:300, - height:170, - closable: true, - resizable: false, - plain: true, - border: false, - modal: true, - title: this.titleText, - items: [{ - id: 'importRepositoryForm', - frame: true, - xtype: 'form', - defaultType: 'checkbox' - }], - buttons: [{ - id: 'startRepositoryImportButton', - text: this.okText, - formBind: true, - scope: this, - handler: this.importRepositories + layout: 'card', + activeItem: 0, + bodyStyle: 'padding: 5px', + defaults: { + bodyCssClass: 'x-panel-mc', + border: false, + labelWidth: 120, + width: 250 + }, + bbar: ['->',{ + id: 'move-prev', + text: this.backText, + handler: this.navHandler.createDelegate(this, [-1]), + disabled: true, + scope: this },{ - text: this.closeText, - scope: this, - handler: this.close + id: 'move-next', + text: this.nextText, + handler: this.navHandler.createDelegate(this, [1]), + disabled: true, + scope: this + },{ + id: 'finish', + text: this.finishText, + handler: this.applyChanges, + disabled: true, + scope: this }], - listeners: { - afterrender: { - fn: this.readImportableTypes, - scope: this + items: [{ + id: 'repositoryTypeLayout', + items: [{ + id: 'chooseRepositoryType', + xtype: 'radiogroup', + name: 'chooseRepositoryType', + columns: 1, + items: [types], + listeners: { + change: function(){ + Ext.getCmp('move-next').setDisabled(false); + } + } + }] + },{ + id: 'importTypeLayout', + items: [{ + id: 'chooseImportType', + xtype: 'radiogroup', + name: 'chooseImportType', + columns: 1, + items: [{ + id: 'importTypeDirectory', + boxLabel: 'Import from directory', + name: 'importType', + inputValue: 'directory', + disabled: false + },{ + id: 'importTypeURL', + boxLabel: 'Import from URL', + name: 'importType', + inputValue: 'url', + checked: false, + disabled: true + },{ + id: 'importTypeFile', + boxLabel: 'Import from File', + name: 'importType', + inputValue: 'file', + checked: false, + disabled: true + }], + listeners: { + change: function(){ + Ext.getCmp('move-next').setDisabled(false); + } + } + }] + },{ + id: 'importUrlLayout', + layout: 'form', + defaults: { + width: 250 + }, + items: [{ + id: 'importUrlName', + xtype: 'textfield', + fieldLabel: 'Repository name', + name: 'importUrlName', + type: 'textfield', + disabled: false + },{ + id: 'importUrl', + xtype: 'textfield', + fieldLabel: 'Import URL', + name: 'importUrl', + disabled: false + }] + },{ + id: 'importFileLayout', + layout: 'form', + defaults: { + width: 250 + }, + items: [{ + id: 'importFileName', + xtype: 'textfield', + fieldLabel: 'Repository name', + name: 'importFileName', + type: 'textfield', + disabled: false + },{ + id: 'importFile', + xtype: 'textfield', + fieldLabel: 'Import File', + name: 'importFile', + disabled: false + }] + },{ + id: 'importFinishedLayout', + layout: 'form', + defaults: { + width: 250 + }, + items: [{ + id: 'importedGrid', + xtype: 'grid', + autoExpandColumn: 'name', + store: importedStore, + colModel: importedColModel, + height: 100 + }] + }] + }; + + Ext.apply(this, Ext.apply(this.initialConfig, config)); + Sonia.repository.ImportPanel.superclass.initComponent.apply(this, arguments); + }, + + navHandler: function(direction){ + var layout = this.getLayout(); + var id = layout.activeItem.id; + + var next = -1; + + if ( id === 'repositoryTypeLayout' && direction === 1 ){ + this.repositoryType = Ext.getCmp('chooseRepositoryType').getValue().getRawValue(); + console.log('rt: ' + this.repositoryType); + this.enableAvailableImportTypes(); + next = 1; + } + else if ( id === 'importTypeLayout' && direction === -1 ){ + next = 0; + Ext.getCmp('move-prev').setDisabled(true); + Ext.getCmp('move-next').setDisabled(false); + } + else if ( id === 'importTypeLayout' && direction === 1 ){ + var v = Ext.getCmp('chooseImportType').getValue(); + if ( v ){ + switch (v.getRawValue()){ + case 'directory': + this.importFromDirectory(layout); + break; + case 'url': + next = 2; + break; + case 'file': + next = 3; + break; } } - }; - Ext.apply(this, Ext.apply(this.initialConfig, config)); - Sonia.repository.ImportWindow.superclass.initComponent.apply(this, arguments); - }, - - readImportableTypes: function(){ - if (debug){ - console.debug('read importable types'); + } + else if ( (id === 'importUrlLayout' || id === 'importFileLayout') && direction === -1 ) + { + next = 1; } - Ext.Ajax.request({ - url: restUrl + 'import/repositories.json', - method: 'GET', - scope: this, - success: function(response){ - var obj = Ext.decode(response.responseText); - this.renderTypeCheckboxes(obj); - this.doLayout(); - }, - failure: function(result){ - main.handleRestFailure( - result, - this.errorTitleText, - this.errorMsgText - ); - } - }); - - }, - - renderTypeCheckboxes: function(types){ - Ext.each(types, function(type){ - this.renderCheckbox(type); - }, this); - }, - - getImportForm: function(){ - if (!this.importForm){ - this.importForm = Ext.getCmp('importRepositoryForm'); + if ( next >= 0 ){ + layout.setActiveItem(next); } - return this.importForm; - }, - - renderCheckbox: function(type){ - this.getImportForm().add({ - xtype: 'checkbox', - name: 'type', - fieldLabel: type.displayName, - inputValue: type.name - }); - }, - - importRepositories: function(){ - if (debug){ - console.debug('start import of repositories'); - } - var form = this.getImportForm().getForm(); - var values = form.getValues().type; - if ( values ){ - if ( Ext.isArray(values) ){ - this.importJobs = values.length; - } else { - this.importJobs = 1; - } - } else { - this.importJobs = 0; - } - Ext.each(values, function(value){ - this.importRepositoriesOfType(value); - }, this); }, appendImported: function(repositories){ @@ -161,60 +310,22 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ if (debug){ console.debug( 'import of ' + this.importJobsFinished + ' jobs finished' ); } - this.printImported(); + Ext.getCmp('importedGrid').getStore().loadData(this.imported); + Ext.getCmp('move-next').setDisabled(true); + Ext.getCmp('move-prev').setDisabled(true); + Ext.getCmp('finish').setDisabled(false); } }, - printImported: function(){ - var store = new Ext.data.JsonStore({ - fields: ['type', 'name'] - }); - store.loadData(this.imported); - - var colModel = new Ext.grid.ColumnModel({ - defaults: { - sortable: true, - scope: this - }, - columns: [ - {id: 'name', header: 'Name', dataIndex: 'name'}, - {id: 'type', header: 'Type', dataIndex: 'type'} - ] - }); - - this.getImportForm().add({ - xtype: 'grid', - autoExpandColumn: 'name', - store: store, - colModel: colModel, - height: 100 - }); - var h = this.getHeight(); - this.setHeight( h + 100 ); - this.doLayout(); - - // reload repositories panel - var panel = Ext.getCmp('repositories'); - if (panel){ - panel.getGrid().reload(); - } - }, - - importRepositoriesOfType: function(type){ - if (debug){ - console.debug('start import of ' + type + ' repositories'); - } - var b = Ext.getCmp('startRepositoryImportButton'); - if ( b ){ - b.setDisabled(true); - } + importFromDirectory: function(layout){ Ext.Ajax.request({ - url: restUrl + 'import/repositories/' + type + '.json', + url: restUrl + 'import/repositories/' + this.repositoryType + '.json', method: 'POST', scope: this, success: function(response){ var obj = Ext.decode(response.responseText); this.appendImported(obj); + layout.setActiveItem(4); }, failure: function(result){ main.handleRestFailure( @@ -224,6 +335,34 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ ); } }); + }, + + enableAvailableImportTypes: function(){ + var type = null; + Ext.each(state.repositoryTypes, function(repositoryType){ + if (repositoryType.name === this.repositoryType){ + type = repositoryType; + } + }, this); + + if ( type !== null ){ + Ext.getCmp('chooseImportType').setValue(null); + Ext.getCmp('move-next').setDisabled(true); + Ext.getCmp('move-prev').setDisabled(false); + Ext.getCmp('importTypeURL').setDisabled(type.supportedCommands.indexOf('PULL') < 0); + Ext.getCmp('importTypeFile').setDisabled(type.supportedCommands.indexOf('UNBUNDLE') < 0); + } + }, + + applyChanges: function(){ + var panel = Ext.getCmp('repositories'); + if (panel){ + panel.getGrid().reload(); + } + this.fireEvent('finish'); } -}); \ No newline at end of file +}); + +// register xtype +Ext.reg('scmRepositoryImportWizard', Sonia.repository.ImportPanel); \ No newline at end of file From c5bb3c70b633a0df3416d7062524bdaa63ad7f5a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 28 Nov 2014 13:58:18 +0100 Subject: [PATCH 42/68] improve layout of import wizard --- scm-webapp/src/main/webapp/index.mustache | 1 + .../src/main/webapp/resources/css/style.css | 14 ++++ .../resources/js/override/ext.form.field.js | 3 + .../sonia.repository.importwindow.js | 80 ++++++++++++++----- .../resources/js/util/sonia.util.tip.js | 77 ++++++++++++++++++ 5 files changed, 157 insertions(+), 18 deletions(-) create mode 100644 scm-webapp/src/main/webapp/resources/js/util/sonia.util.tip.js diff --git a/scm-webapp/src/main/webapp/index.mustache b/scm-webapp/src/main/webapp/index.mustache index e29c2cd556..4c2c3c913c 100644 --- a/scm-webapp/src/main/webapp/index.mustache +++ b/scm-webapp/src/main/webapp/index.mustache @@ -77,6 +77,7 @@ + diff --git a/scm-webapp/src/main/webapp/resources/css/style.css b/scm-webapp/src/main/webapp/resources/css/style.css index 2ce002295c..355e8afcbe 100644 --- a/scm-webapp/src/main/webapp/resources/css/style.css +++ b/scm-webapp/src/main/webapp/resources/css/style.css @@ -105,6 +105,11 @@ a.scm-link:hover { margin-left: 2px; } +.scm-form-fileupload-help-button { + position: absolute; + right: -19px; +} + .scm-nav-item { cursor: pointer; } @@ -238,3 +243,12 @@ div.noscript-container h1 { .unhealthy { color: red; } + +/** import **/ +.import-fu { + margin-right: 24px; +} + +.import-fu input { + width: 215px; +} diff --git a/scm-webapp/src/main/webapp/resources/js/override/ext.form.field.js b/scm-webapp/src/main/webapp/resources/js/override/ext.form.field.js index 548599e3a0..61abb54b88 100644 --- a/scm-webapp/src/main/webapp/resources/js/override/ext.form.field.js +++ b/scm-webapp/src/main/webapp/resources/js/override/ext.form.field.js @@ -77,6 +77,9 @@ Ext.override(Ext.form.Field, { cls = 'scm-form-combo-help-button'; } break; + case 'fileuploadfield': + cls = 'scm-form-fileupload-help-button'; + break; case 'textarea': cls = 'scm-form-textarea-help-button'; break; diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 617eef95aa..233b491f67 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -41,7 +41,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ title: this.title, layout: 'fit', width: 420, - height: 140, + height: 190, closable: true, resizable: true, plain: true, @@ -85,6 +85,21 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { importJobsFinished: 0, importJobs: 0, + // help text + importTypeDirectoryHelpText: 'Imports all repositories that are located at the repository folder of SCM-Manager.', + importTypeURLHelpText: 'Imports a repository from a remote url.', + importTypeFileHelpText: 'Imports a repository from a file (e.g. SVN dump).', + + importUrlNameHelpText: 'The name of the repository in SCM-Manager.', + importUrlHelpText: 'The source url of the repository.', + + importFileNameHelpText: 'The name of the repository in SCM-Manager.', + importFileHelpText: 'Choose the dump file you want to import to SCM-Manager.', + + // tips + tipRepositoryType: 'Choose your repository type for the import.', + tipImportType: 'Select the type of import. Note: Not all repository types support all options.', + // settings repositoryType: null, @@ -108,11 +123,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { ] }); - var types = []; + var typeItems = []; Ext.each(state.repositoryTypes, function(repositoryType){ - console.log(repositoryType); - types.push({ + typeItems.push({ boxLabel: repositoryType.displayName, name: 'repositoryType', inputValue: repositoryType.name, @@ -120,6 +134,16 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }); }); + typeItems = typeItems.sort(function(a, b){ + return a.boxLabel > b.boxLabel; + }); + + typeItems.push({ + xtype: 'scmTip', + content: this.tipRepositoryType, + width: '100%' + }); + var config = { layout: 'card', activeItem: 0, @@ -156,7 +180,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { xtype: 'radiogroup', name: 'chooseRepositoryType', columns: 1, - items: [types], + items: [typeItems], listeners: { change: function(){ Ext.getCmp('move-next').setDisabled(false); @@ -175,21 +199,28 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { boxLabel: 'Import from directory', name: 'importType', inputValue: 'directory', - disabled: false + disabled: false, + helpText: this.importTypeDirectoryHelpText },{ id: 'importTypeURL', - boxLabel: 'Import from URL', + boxLabel: 'Import from url', name: 'importType', inputValue: 'url', checked: false, - disabled: true + disabled: true, + helpText: this.importTypeURLHelpText },{ id: 'importTypeFile', - boxLabel: 'Import from File', + boxLabel: 'Import from file', name: 'importType', inputValue: 'file', checked: false, - disabled: true + disabled: true, + helpText: this.importTypeFileHelpText + },{ + xtype: 'scmTip', + content: this.tipImportType, + width: '100%' }], listeners: { change: function(){ @@ -209,33 +240,46 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { fieldLabel: 'Repository name', name: 'importUrlName', type: 'textfield', - disabled: false + disabled: false, + helpText: this.importUrlNameHelpText },{ id: 'importUrl', xtype: 'textfield', fieldLabel: 'Import URL', name: 'importUrl', - disabled: false + disabled: false, + helpText: this.importUrlHelpText + },{ + xtype: 'scmTip', + content: 'Please insert name and remote url of the repository.', + width: '100%' }] },{ id: 'importFileLayout', layout: 'form', - defaults: { - width: 250 - }, items: [{ id: 'importFileName', xtype: 'textfield', fieldLabel: 'Repository name', name: 'importFileName', type: 'textfield', - disabled: false + width: 250, + helpText: this.importFileNameHelpText },{ id: 'importFile', - xtype: 'textfield', + xtype: 'fileuploadfield', fieldLabel: 'Import File', + ctCls: 'import-fu', name: 'importFile', - disabled: false + helpText: this.importFileHelpText, + cls: 'import-fu', + buttonCfg: { + iconCls: 'upload-icon' + } + },{ + xtype: 'scmTip', + content: 'Please insert name and upload the repository file.', + width: '100%' }] },{ id: 'importFinishedLayout', diff --git a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.tip.js b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.tip.js new file mode 100644 index 0000000000..18cadb9884 --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.tip.js @@ -0,0 +1,77 @@ +/* + * 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 + * + */ + +Sonia.util.Tip = Ext.extend(Ext.BoxComponent, { + + tpl: new Ext.XTemplate('\ +
    \ +
    \ +
    \ +
    \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ + {content}\ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    '), + + constructor: function(config) { + config = config || {}; + var cl = 'scm-tip'; + if (config['class']){ + cl += ' ' + config['class']; + } + config.xtype = 'box'; + this.html = this.tpl.apply({content: config.content}); + Sonia.util.Tip.superclass.constructor.apply(this, arguments); + } + +}); + +// register xtype +Ext.reg('scmTip', Sonia.util.Tip); \ No newline at end of file From 9a7c5e643ca69a2ba3a6474c24709fa06ca04151 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 28 Nov 2014 14:19:55 +0100 Subject: [PATCH 43/68] implemented ui for repository import from url --- .../sonia.repository.importwindow.js | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 233b491f67..975ec04bf0 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -230,7 +230,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }] },{ id: 'importUrlLayout', - layout: 'form', + xtype: 'form', defaults: { width: 250 }, @@ -238,7 +238,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { id: 'importUrlName', xtype: 'textfield', fieldLabel: 'Repository name', - name: 'importUrlName', + name: 'name', type: 'textfield', disabled: false, helpText: this.importUrlNameHelpText @@ -246,7 +246,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { id: 'importUrl', xtype: 'textfield', fieldLabel: 'Import URL', - name: 'importUrl', + name: 'url', disabled: false, helpText: this.importUrlHelpText },{ @@ -339,6 +339,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { { next = 1; } + else if ( id === 'importUrlLayout' && direction === 1 ){ + var panel = Ext.getCmp('importUrlLayout'); + this.importFromUrl(layout, panel.getForm().getValues()); + } if ( next >= 0 ){ layout.setActiveItem(next); @@ -361,6 +365,29 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } }, + importFromUrl: function(layout, repository){ + Ext.Ajax.request({ + url: restUrl + 'import/repositories/' + this.repositoryType + '/url.json', + method: 'POST', + scope: this, + jsonData: repository, + success: function(){ + this.appendImported([{ + name: repository.name, + type: this.repositoryType + }]); + layout.setActiveItem(4); + }, + failure: function(result){ + main.handleRestFailure( + result, + this.errorTitleText, + this.errorMsgText + ); + } + }); + }, + importFromDirectory: function(layout){ Ext.Ajax.request({ url: restUrl + 'import/repositories/' + this.repositoryType + '.json', From 45a6bf518374308c5a9673383c2ea92a9e236398 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 28 Nov 2014 14:51:25 +0100 Subject: [PATCH 44/68] implemented ui for repository import from file --- .../resources/RepositoryImportResource.java | 136 +++++++++++------- .../sonia.repository.importwindow.js | 47 ++++-- 2 files changed, 121 insertions(+), 62 deletions(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index 6107abcd1b..1c9d2f673c 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -50,6 +50,7 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.Type; +import sonia.scm.api.rest.RestActionUploadResult; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryAllreadyExistExeption; import sonia.scm.repository.RepositoryException; @@ -161,54 +162,7 @@ public class RepositoryImportResource @PathParam("type") String type, @FormDataParam("name") String name, @FormDataParam("bundle") InputStream inputStream) { - SecurityUtils.getSubject().checkRole(Role.ADMIN); - - checkArgument(!Strings.isNullOrEmpty(name), - "request does not contain name of the repository"); - checkNotNull(inputStream, "bundle inputStream is required"); - - Repository repository; - - try - { - Type t = type(type); - - checkSupport(t, Command.UNBUNDLE, "bundle"); - - repository = create(type, name); - - RepositoryService service = null; - - File file = File.createTempFile("scm-import-", ".bundle"); - - try - { - long length = Files.asByteSink(file).writeFrom(inputStream); - - logger.info("copied {} bytes to temp, start bundle import", length); - service = serviceFactory.create(repository); - service.getUnbundleCommand().unbundle(file); - } - catch (RepositoryException ex) - { - handleImportFailure(ex, repository); - } - catch (IOException ex) - { - handleImportFailure(ex, repository); - } - finally - { - IOUtil.close(service); - IOUtil.delete(file); - } - } - catch (IOException ex) - { - logger.warn("could not create temporary file", ex); - - throw new WebApplicationException(ex); - } + Repository repository = doImportFromBundle(type, name, inputStream); return buildResponse(uriInfo, repository); } @@ -230,7 +184,6 @@ public class RepositoryImportResource * * * - * @param uriInfo uri info * @param type repository type * @param name name of the repository * @param inputStream input bundle @@ -242,11 +195,25 @@ public class RepositoryImportResource @Path("{type}/bundle.html") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.TEXT_HTML) - public Response importFromBundleUI(@Context UriInfo uriInfo, - @PathParam("type") String type, @FormDataParam("name") String name, + public Response importFromBundleUI(@PathParam("type") String type, + @FormDataParam("name") String name, @FormDataParam("bundle") InputStream inputStream) { - return importFromBundle(uriInfo, type, name, inputStream); + Response response; + + try + { + doImportFromBundle(type, name, inputStream); + response = Response.ok(new RestActionUploadResult(true)).build(); + } + catch (WebApplicationException ex) + { + logger.warn("error durring bundle import", ex); + response = Response.fromResponse(ex.getResponse()).entity( + new RestActionUploadResult(false)).build(); + } + + return response; } /** @@ -503,6 +470,71 @@ public class RepositoryImportResource return repository; } + /** + * Start bundle import. + * + * + * @param type repository type + * @param name name of the repository + * @param inputStream bundle stream + * + * @return imported repository + */ + private Repository doImportFromBundle(String type, String name, + InputStream inputStream) + { + SecurityUtils.getSubject().checkRole(Role.ADMIN); + + checkArgument(!Strings.isNullOrEmpty(name), + "request does not contain name of the repository"); + checkNotNull(inputStream, "bundle inputStream is required"); + + Repository repository; + + try + { + Type t = type(type); + + checkSupport(t, Command.UNBUNDLE, "bundle"); + + repository = create(type, name); + + RepositoryService service = null; + + File file = File.createTempFile("scm-import-", ".bundle"); + + try + { + long length = Files.asByteSink(file).writeFrom(inputStream); + + logger.info("copied {} bytes to temp, start bundle import", length); + service = serviceFactory.create(repository); + service.getUnbundleCommand().unbundle(file); + } + catch (RepositoryException ex) + { + handleImportFailure(ex, repository); + } + catch (IOException ex) + { + handleImportFailure(ex, repository); + } + finally + { + IOUtil.close(service); + IOUtil.delete(file); + } + } + catch (IOException ex) + { + logger.warn("could not create temporary file", ex); + + throw new WebApplicationException(ex); + } + + return repository; + } + /** * Method description * diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 975ec04bf0..43d870517f 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -78,9 +78,6 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { nextText: 'Next', finishText: 'Finish', - // cache - importForm: null, - imported: [], importJobsFinished: 0, importJobs: 0, @@ -105,7 +102,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { initComponent: function(){ this.addEvents('finish'); - + + // fix initialization bug + this.imported = []; + this.importJobsFinished = 0; + this.importJobs = 0; var importedStore = new Ext.data.JsonStore({ fields: ['type', 'name'] @@ -256,12 +257,13 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }] },{ id: 'importFileLayout', - layout: 'form', + xtype: 'form', + fileUpload: true, items: [{ id: 'importFileName', xtype: 'textfield', fieldLabel: 'Repository name', - name: 'importFileName', + name: 'name', type: 'textfield', width: 250, helpText: this.importFileNameHelpText @@ -270,7 +272,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { xtype: 'fileuploadfield', fieldLabel: 'Import File', ctCls: 'import-fu', - name: 'importFile', + name: 'bundle', helpText: this.importFileHelpText, cls: 'import-fu', buttonCfg: { @@ -339,9 +341,13 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { { next = 1; } - else if ( id === 'importUrlLayout' && direction === 1 ){ - var panel = Ext.getCmp('importUrlLayout'); - this.importFromUrl(layout, panel.getForm().getValues()); + else if ( id === 'importUrlLayout' && direction === 1 ) + { + this.importFromUrl(layout, Ext.getCmp('importUrlLayout').getForm().getValues()); + } + else if ( id === 'importFileLayout' && direction === 1 ) + { + this.importFromFile(layout, Ext.getCmp('importFileLayout').getForm()); } if ( next >= 0 ){ @@ -365,6 +371,27 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } }, + importFromFile: function(layout, form){ + form.submit({ + url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html', + scope: this, + success: function(form, action){ + this.appendImported([{ + name: form.getValues().name, + type: this.repositoryType + }]); + layout.setActiveItem(4); + }, + failure: function(form, action){ + main.handleRestFailure( + action.response, + this.errorTitleText, + this.errorMsgText + ); + } + }); + }, + importFromUrl: function(layout, repository){ Ext.Ajax.request({ url: restUrl + 'import/repositories/' + this.repositoryType + '/url.json', From d0bf865c3d141bf32b4a9639e8d7599988fa8732 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 28 Nov 2014 15:25:20 +0100 Subject: [PATCH 45/68] improve form validation of repository import wizard --- .../sonia.repository.importwindow.js | 66 +++++++++++++++++-- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 43d870517f..8f5132607e 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -73,7 +73,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { - // text + // text backText: 'Back', nextText: 'Next', finishText: 'Finish', @@ -97,9 +97,16 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { tipRepositoryType: 'Choose your repository type for the import.', tipImportType: 'Select the type of import. Note: Not all repository types support all options.', + // cache + nextButton: null, + prevButton: null, + // settings repositoryType: null, + // active card + activeForm: null, + initComponent: function(){ this.addEvents('finish'); @@ -107,6 +114,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { this.imported = []; this.importJobsFinished = 0; this.importJobs = 0; + this.activeForm = null; var importedStore = new Ext.data.JsonStore({ fields: ['type', 'name'] @@ -232,23 +240,31 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { },{ id: 'importUrlLayout', xtype: 'form', + monitorValid: true, defaults: { width: 250 }, + listeners: { + clientvalidation: { + fn: this.urlFormValidityMonitor, + scope: this + } + }, items: [{ id: 'importUrlName', xtype: 'textfield', fieldLabel: 'Repository name', - name: 'name', - type: 'textfield', - disabled: false, + name: 'name', + allowBlank: false, + vtype: 'repositoryName', helpText: this.importUrlNameHelpText },{ id: 'importUrl', xtype: 'textfield', fieldLabel: 'Import URL', name: 'url', - disabled: false, + allowBlank: false, + vtype: 'url', helpText: this.importUrlHelpText },{ xtype: 'scmTip', @@ -259,6 +275,13 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { id: 'importFileLayout', xtype: 'form', fileUpload: true, + monitorValid: true, + listeners: { + clientvalidation: { + fn: this.urlFormValidityMonitor, + scope: this + } + }, items: [{ id: 'importFileName', xtype: 'textfield', @@ -266,6 +289,8 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { name: 'name', type: 'textfield', width: 250, + allowBlank: false, + vtype: 'repositoryName', helpText: this.importFileNameHelpText },{ id: 'importFile', @@ -273,6 +298,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { fieldLabel: 'Import File', ctCls: 'import-fu', name: 'bundle', + allowBlank: false, helpText: this.importFileHelpText, cls: 'import-fu', buttonCfg: { @@ -305,6 +331,8 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }, navHandler: function(direction){ + this.activeForm = null; + var layout = this.getLayout(); var id = layout.activeItem.id; @@ -322,6 +350,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { Ext.getCmp('move-next').setDisabled(false); } else if ( id === 'importTypeLayout' && direction === 1 ){ + Ext.getCmp('move-next').setDisabled(false); var v = Ext.getCmp('chooseImportType').getValue(); if ( v ){ switch (v.getRawValue()){ @@ -330,9 +359,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { break; case 'url': next = 2; + this.activeForm = 'url'; break; case 'file': next = 3; + this.activeForm = 'file'; break; } } @@ -355,6 +386,31 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } }, + getNextButton: function(){ + if (!this.nextButton){ + this.nextButton = Ext.getCmp('move-next'); + } + return this.nextButton; + }, + + getPrevButton: function(){ + if (!this.prevButton){ + this.prevButton = Ext.getCmp('move-prev'); + } + return this.prevButton; + }, + + urlFormValidityMonitor: function(form, valid){ + if (this.activeForm === 'url' || this.activeForm === 'file'){ + var nbt = this.getNextButton(); + if (valid && nbt.disabled){ + nbt.setDisabled(false); + } else if (!valid && !nbt.disabled){ + nbt.setDisabled(true); + } + } + }, + appendImported: function(repositories){ for (var i=0; i Date: Fri, 28 Nov 2014 15:35:36 +0100 Subject: [PATCH 46/68] added loading indicator to repository import wizard --- .../sonia.repository.importwindow.js | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 8f5132607e..aa097626ab 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -278,7 +278,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { monitorValid: true, listeners: { clientvalidation: { - fn: this.urlFormValidityMonitor, + fn: this.fileFormValidityMonitor, scope: this } }, @@ -399,15 +399,37 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } return this.prevButton; }, + + showLoadingBox: function(){ + return Ext.MessageBox.show({ + title: 'Loading', + msg: 'Import repository', + width: 300, + wait: true, + animate: true, + progress: true, + closable: false + }); + }, urlFormValidityMonitor: function(form, valid){ - if (this.activeForm === 'url' || this.activeForm === 'file'){ - var nbt = this.getNextButton(); - if (valid && nbt.disabled){ - nbt.setDisabled(false); - } else if (!valid && !nbt.disabled){ - nbt.setDisabled(true); - } + if (this.activeForm === 'url'){ + this.formValidityMonitor(form, valid); + } + }, + + fileFormValidityMonitor: function(form, valid){ + if (this.activeForm === 'file'){ + this.formValidityMonitor(form, valid); + } + }, + + formValidityMonitor: function(form, valid){ + var nbt = this.getNextButton(); + if (valid && nbt.disabled){ + nbt.setDisabled(false); + } else if (!valid && !nbt.disabled){ + nbt.setDisabled(true); } }, @@ -428,6 +450,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }, importFromFile: function(layout, form){ + var lbox = this.showLoadingBox(); form.submit({ url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html', scope: this, @@ -436,9 +459,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { name: form.getValues().name, type: this.repositoryType }]); + lbox.hide(); layout.setActiveItem(4); }, failure: function(form, action){ + lbox.hide(); main.handleRestFailure( action.response, this.errorTitleText, @@ -449,6 +474,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }, importFromUrl: function(layout, repository){ + var lbox = this.showLoadingBox(); Ext.Ajax.request({ url: restUrl + 'import/repositories/' + this.repositoryType + '/url.json', method: 'POST', @@ -459,9 +485,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { name: repository.name, type: this.repositoryType }]); + lbox.hide(); layout.setActiveItem(4); }, failure: function(result){ + lbox.hide(); main.handleRestFailure( result, this.errorTitleText, @@ -472,6 +500,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }, importFromDirectory: function(layout){ + var lbox = this.showLoadingBox(); Ext.Ajax.request({ url: restUrl + 'import/repositories/' + this.repositoryType + '.json', method: 'POST', @@ -479,9 +508,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { success: function(response){ var obj = Ext.decode(response.responseText); this.appendImported(obj); + lbox.hide(); layout.setActiveItem(4); }, failure: function(result){ + lbox.hide(); main.handleRestFailure( result, this.errorTitleText, From 89d92d59627520010b5313db256aabb178e7a9e4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 29 Nov 2014 11:44:16 +0100 Subject: [PATCH 47/68] implemented AdvancedImportHandler which gives more control over the import result than ImportHandler --- .../scm/repository/AbstactImportHandler.java | 199 +++++++++++---- .../scm/repository/AdvancedImportHandler.java | 58 +++++ .../sonia/scm/repository/ImportResult.java | 230 ++++++++++++++++++ 3 files changed, 436 insertions(+), 51 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/AdvancedImportHandler.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/ImportResult.java diff --git a/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java b/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java index 124e712c5b..e8bb551da8 100644 --- a/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java +++ b/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java @@ -35,23 +35,28 @@ package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Throwables; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import sonia.scm.repository.ImportResult.Builder; + //~--- JDK imports ------------------------------------------------------------ import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.List; /** + * Abstract base class for directory based {@link ImportHandler} and + * {@link AdvancedImportHandler}. * * @author Sebastian Sdorra * @since 1.12 */ -public abstract class AbstactImportHandler implements ImportHandler +public abstract class AbstactImportHandler implements AdvancedImportHandler { /** @@ -63,80 +68,65 @@ public abstract class AbstactImportHandler implements ImportHandler //~--- get methods ---------------------------------------------------------- /** - * Method description + * Returns array of repository directory names. * * - * @return + * @return repository directory names */ protected abstract String[] getDirectoryNames(); /** - * Method description + * Returns repository handler. * * - * @return + * @return repository handler */ protected abstract AbstractRepositoryHandler getRepositoryHandler(); //~--- methods -------------------------------------------------------------- /** - * Method description - * - * - * @param manager - * - * - * @return - * @throws IOException - * @throws RepositoryException + * {@inheritDoc} */ @Override public List importRepositories(RepositoryManager manager) throws IOException, RepositoryException { - List imported = new ArrayList(); - - if (logger.isTraceEnabled()) - { - logger.trace("search for repositories to import"); - } - - List repositoryNames = - RepositoryUtil.getRepositoryNames(getRepositoryHandler(), - getDirectoryNames()); - - for (String repositoryName : repositoryNames) - { - if (logger.isTraceEnabled()) - { - logger.trace("check repository {} for import", repositoryName); - } - - Repository repository = manager.get(getTypeName(), repositoryName); - - if (repository == null) - { - importRepository(manager, repositoryName); - imported.add(repositoryName); - } - else if (logger.isDebugEnabled()) - { - logger.debug("repository {} is allready managed", repositoryName); - } - } - - return imported; + return doRepositoryImport(manager, true).getImportedDirectories(); } /** - * Method description + * {@inheritDoc} + */ + @Override + public ImportResult importRepositoriesFromDirectory(RepositoryManager manager) + { + try + { + return doRepositoryImport(manager, false); + } + catch (IOException ex) + { + + // should never happen + throw Throwables.propagate(ex); + } + catch (RepositoryException ex) + { + + // should never happen + throw Throwables.propagate(ex); + } + } + + /** + * Creates a repository. * * - * @param repositoryDirectory - * @param repositoryName + * @param repositoryDirectory repository base directory + * @param repositoryName name of the repository * - * @return + * @return repository * * @throws IOException * @throws RepositoryException @@ -154,6 +144,113 @@ public abstract class AbstactImportHandler implements ImportHandler return repository; } + /** + * Repository import. + * + * + * @param manager repository manager + * @param throwExceptions true to throw exception + * + * @return import result + * + * @throws IOException + * @throws RepositoryException + */ + private ImportResult doRepositoryImport(RepositoryManager manager, + boolean throwExceptions) + throws IOException, RepositoryException + { + Builder builder = ImportResult.builder(); + + logger.trace("search for repositories to import"); + + try + { + + List repositoryNames = + RepositoryUtil.getRepositoryNames(getRepositoryHandler(), + getDirectoryNames()); + + for (String repositoryName : repositoryNames) + { + importRepository(manager, builder, throwExceptions, repositoryName); + } + + } + catch (IOException ex) + { + handleException(ex, throwExceptions); + } + + return builder.build(); + } + + /** + * Method description + * + * + * @param ex + * @param throwExceptions + * @param + * + * @throws T + */ + private void handleException(T ex, + boolean throwExceptions) + throws T + { + logger.warn("error durring repository directory import", ex); + + if (throwExceptions) + { + throw ex; + } + } + + /** + * Method description + * + * + * @param manager + * @param builder + * @param throwExceptions + * @param repositoryName + * + * @throws IOException + * @throws RepositoryException + */ + private void importRepository(RepositoryManager manager, Builder builder, + boolean throwExceptions, String repositoryName) + throws IOException, RepositoryException + { + logger.trace("check repository {} for import", repositoryName); + + Repository repository = manager.get(getTypeName(), repositoryName); + + if (repository == null) + { + try + { + importRepository(manager, repositoryName); + builder.addImportedDirectory(repositoryName); + } + catch (IOException ex) + { + builder.addFailedDirectory(repositoryName); + handleException(ex, throwExceptions); + } + catch (RepositoryException ex) + { + builder.addFailedDirectory(repositoryName); + handleException(ex, throwExceptions); + } + } + else if (logger.isDebugEnabled()) + { + logger.debug("repository {} is allready managed", repositoryName); + } + } + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/repository/AdvancedImportHandler.java b/scm-core/src/main/java/sonia/scm/repository/AdvancedImportHandler.java new file mode 100644 index 0000000000..7c1127b4a6 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/AdvancedImportHandler.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2014, 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; + +/** + * Searches and import existing repositories. The {@link AdvancedImportHandler} + * gives more control over the result of the import as the + * {@link ImportHandler}. + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public interface AdvancedImportHandler extends ImportHandler +{ + + /** + * Import existing and non managed repositories. Returns result which + * contains names of the successfully imported directories and the names of + * the failed directories + * + * + * @param manager The global {@link RepositoryManager} + * + * @return result which contains names of the successfully imported + * directories and the names of the failed directories. + */ + public ImportResult importRepositoriesFromDirectory( + RepositoryManager manager); +} diff --git a/scm-core/src/main/java/sonia/scm/repository/ImportResult.java b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java new file mode 100644 index 0000000000..992ac33010 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java @@ -0,0 +1,230 @@ +/** + * Copyright (c) 2014, 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.common.base.Objects; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.List; + +/** + * Import result of the {@link AdvancedImportHandler}. + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public final class ImportResult +{ + + /** + * Constructs ... + * + */ + ImportResult() {} + + /** + * Constructs a new import result. + * + * + * @param importedDirectories imported directories + * @param failedDirectories failed directories + */ + public ImportResult(List importedDirectories, + List failedDirectories) + { + this.importedDirectories = importedDirectories; + this.failedDirectories = failedDirectories; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Returns a import result builder. + * + * + * @return import result builder + */ + public static Builder builder() + { + return new Builder(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final ImportResult other = (ImportResult) obj; + + return Objects.equal(importedDirectories, other.importedDirectories) + && Objects.equal(failedDirectories, other.failedDirectories); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + return Objects.hashCode(importedDirectories, failedDirectories); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("importedDirectories", importedDirectories) + .add("failedDirectories", failedDirectories) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Returns list of failed directories. + * + * + * @return list of failed directories + */ + public List getFailedDirectories() + { + return failedDirectories; + } + + /** + * Returns list of successfully imported directories. + * + * + * @return list of successfully imported directories + */ + public List getImportedDirectories() + { + return importedDirectories; + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Builder for {@link ImportResult}. + */ + public static class Builder + { + + /** + * Constructs ... + * + */ + private Builder() {} + + //~--- methods ------------------------------------------------------------ + + /** + * Adds a failed directory to the import result. + * + * + * @param name name of the directory + * + * @return {@code this} + */ + public Builder addFailedDirectory(String name) + { + this.failedDirectories.add(name); + + return this; + } + + /** + * Adds a successfully imported directory to the import result. + * + * + * @param name name of the directory + * + * @return {@code this} + */ + public Builder addImportedDirectory(String name) + { + this.importedDirectories.add(name); + + return this; + } + + /** + * Builds the final import result. + * + * + * @return final import result + */ + public ImportResult build() + { + return new ImportResult(ImmutableList.copyOf(importedDirectories), + ImmutableList.copyOf(failedDirectories)); + } + + //~--- fields ------------------------------------------------------------- + + /** successfully imported directories */ + private final List importedDirectories = Lists.newArrayList(); + + /** failed directories */ + private final List failedDirectories = Lists.newArrayList(); + } + + + //~--- fields --------------------------------------------------------------- + + /** failed directories */ + private List failedDirectories; + + /** successfully imported directories */ + private List importedDirectories; +} From 747cead7b112a792a98d916ff883337260bd9a39 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 29 Nov 2014 11:58:44 +0100 Subject: [PATCH 48/68] improve npe handling on constructor of ImportResult --- .../src/main/java/sonia/scm/repository/ImportResult.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/repository/ImportResult.java b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java index 992ac33010..2911a57030 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ImportResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java @@ -37,6 +37,8 @@ import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import static com.google.common.base.Preconditions.*; + //~--- JDK imports ------------------------------------------------------------ import java.util.List; @@ -66,8 +68,10 @@ public final class ImportResult public ImportResult(List importedDirectories, List failedDirectories) { - this.importedDirectories = importedDirectories; - this.failedDirectories = failedDirectories; + this.importedDirectories = checkNotNull(importedDirectories, + "list of imported directories is required"); + this.failedDirectories = checkNotNull(failedDirectories, + "list of failed directories is required"); } //~--- methods -------------------------------------------------------------- From 50193b37b0ed7eb30ee9a62fcffea93df35d1197 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 29 Nov 2014 12:47:19 +0100 Subject: [PATCH 49/68] added rest endpoint for new AdvancedImportHandler --- .../resources/RepositoryImportResource.java | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index 6107abcd1b..2fa6b5707a 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -37,6 +37,7 @@ package sonia.scm.api.rest.resources; import com.google.common.base.Objects; import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; import com.google.common.io.Files; import com.google.inject.Inject; @@ -50,6 +51,9 @@ import org.slf4j.LoggerFactory; import sonia.scm.NotSupportedFeatuerException; import sonia.scm.Type; +import sonia.scm.repository.AdvancedImportHandler; +import sonia.scm.repository.ImportHandler; +import sonia.scm.repository.ImportResult; import sonia.scm.repository.Repository; import sonia.scm.repository.RepositoryAllreadyExistExeption; import sonia.scm.repository.RepositoryException; @@ -67,6 +71,7 @@ import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ +import com.sun.jersey.api.client.ClientResponse.Status; import com.sun.jersey.multipart.FormDataParam; import java.io.File; @@ -153,6 +158,7 @@ public class RepositoryImportResource * * @return empty response with location header which points to the imported * repository + * @since 1.43 */ @POST @Path("{type}/bundle") @@ -237,6 +243,7 @@ public class RepositoryImportResource * * @return empty response with location header which points to the imported * repository + * @since 1.43 */ @POST @Path("{type}/bundle.html") @@ -270,6 +277,7 @@ public class RepositoryImportResource * * @return empty response with location header which points to the imported * repository + * @since 1.43 */ @POST @Path("{type}/url") @@ -386,6 +394,90 @@ public class RepositoryImportResource //J+ } + /** + * Imports repositories of the given type from the configured repository + * directory. Returns a list of successfully imported directories and a list + * of failed directories. This method requires admin privileges.
    + *
    + * Status codes: + *
      + *
    • 200 ok, successful
    • + *
    • 400 bad request, the import feature is not + * supported by this type of repositories.
    • + *
    • 500 internal server error
    • + *
    + * + * @param type repository type + * + * @return imported repositories + * @since 1.43 + */ + @POST + @Path("{type}/directory") + @TypeHint(ImportResult.class) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response importRepositoriesFromDirectory( + @PathParam("type") String type) + { + SecurityUtils.getSubject().checkRole(Role.ADMIN); + + Response response; + + RepositoryHandler handler = manager.getHandler(type); + + if (handler != null) + { + logger.info("start directory import for repository type {}", type); + + try + { + ImportResult result; + ImportHandler importHandler = handler.getImportHandler(); + + if (importHandler instanceof AdvancedImportHandler) + { + logger.debug("start directory import, using advanced import handler"); + result = + ((AdvancedImportHandler) importHandler) + .importRepositoriesFromDirectory(manager); + } + else + { + logger.debug("start directory import, using normal import handler"); + result = new ImportResult(importHandler.importRepositories(manager), + ImmutableList.of()); + } + + response = Response.ok(result).build(); + } + catch (NotSupportedFeatuerException ex) + { + logger + .warn( + "import feature is not supported by repository handler for type " + .concat(type), ex); + response = Response.status(Status.BAD_REQUEST).build(); + } + catch (IOException ex) + { + logger.warn("exception occured durring directory import", ex); + response = Response.serverError().build(); + } + catch (RepositoryException ex) + { + logger.warn("exception occured durring directory import", ex); + response = Response.serverError().build(); + } + } + else + { + logger.warn("could not find reposiotry handler for type {}", type); + response = Response.status(Status.BAD_REQUEST).build(); + } + + return response; + } + //~--- get methods ---------------------------------------------------------- /** From 337e9693ca80697c400e91351d23ab0abeaccbb0 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 29 Nov 2014 14:05:07 +0100 Subject: [PATCH 50/68] catch IllegalStateException during repository import --- .../main/java/sonia/scm/repository/AbstactImportHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java b/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java index e8bb551da8..2da506674d 100644 --- a/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java +++ b/scm-core/src/main/java/sonia/scm/repository/AbstactImportHandler.java @@ -239,6 +239,11 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler builder.addFailedDirectory(repositoryName); handleException(ex, throwExceptions); } + catch (IllegalStateException ex) + { + builder.addFailedDirectory(repositoryName); + handleException(ex, throwExceptions); + } catch (RepositoryException ex) { builder.addFailedDirectory(repositoryName); From 3be081c9d6885cd07581cb4235aca9e7ebb3560e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 29 Nov 2014 14:08:02 +0100 Subject: [PATCH 51/68] improve result panel of repository import wizard --- .../sonia.repository.importwindow.js | 167 ++++++++++-------- 1 file changed, 89 insertions(+), 78 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index aa097626ab..a60a93c73d 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -76,11 +76,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { // text backText: 'Back', nextText: 'Next', - finishText: 'Finish', + closeBtnText: 'Close', imported: [], - importJobsFinished: 0, - importJobs: 0, + failed: [], // help text importTypeDirectoryHelpText: 'Imports all repositories that are located at the repository folder of SCM-Manager.', @@ -106,32 +105,37 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { // active card activeForm: null, + + // result template + tpl: new Ext.XTemplate([ + '

    ', + ' ', + ' Imported repositories
    ', + ' ', + ' - {.}
    ', + '
    ', + '
    ', + '
    ', + ' ', + ' Failed to import the following directories
    ', + ' ', + ' - {.}
    ', + '
    ', + '
    ', + ' ', + ' No repositories to import', + ' ', + '

    ' + ]), initComponent: function(){ this.addEvents('finish'); // fix initialization bug this.imported = []; - this.importJobsFinished = 0; - this.importJobs = 0; + this.failed = []; this.activeForm = null; - var importedStore = new Ext.data.JsonStore({ - fields: ['type', 'name'] - }); - // store.loadData(this.imported); - - var importedColModel = new Ext.grid.ColumnModel({ - defaults: { - sortable: true, - scope: this - }, - columns: [ - {id: 'name', header: 'Name', dataIndex: 'name'}, - {id: 'type', header: 'Type', dataIndex: 'type'} - ] - }); - var typeItems = []; Ext.each(state.repositoryTypes, function(repositoryType){ @@ -176,8 +180,8 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { disabled: true, scope: this },{ - id: 'finish', - text: this.finishText, + id: 'closeBtn', + text: this.closeBtnText, handler: this.applyChanges, disabled: true, scope: this @@ -191,8 +195,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { columns: 1, items: [typeItems], listeners: { - change: function(){ - Ext.getCmp('move-next').setDisabled(false); + change: { + fn: function(){ + this.getNextButton().setDisabled(false); + }, + scope: this } } }] @@ -232,8 +239,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { width: '100%' }], listeners: { - change: function(){ - Ext.getCmp('move-next').setDisabled(false); + change: { + fn: function(){ + this.getNextButton().setDisabled(false); + }, + scope: this } } }] @@ -316,12 +326,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { width: 250 }, items: [{ - id: 'importedGrid', - xtype: 'grid', - autoExpandColumn: 'name', - store: importedStore, - colModel: importedColModel, - height: 100 + id: 'resultPanel', + xtype: 'panel', + bodyCssClass: 'x-panel-mc', + tpl: this.tpl }] }] }; @@ -340,7 +348,6 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { if ( id === 'repositoryTypeLayout' && direction === 1 ){ this.repositoryType = Ext.getCmp('chooseRepositoryType').getValue().getRawValue(); - console.log('rt: ' + this.repositoryType); this.enableAvailableImportTypes(); next = 1; } @@ -414,17 +421,17 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { urlFormValidityMonitor: function(form, valid){ if (this.activeForm === 'url'){ - this.formValidityMonitor(form, valid); + this.formValidityMonitor(valid); } }, fileFormValidityMonitor: function(form, valid){ if (this.activeForm === 'file'){ - this.formValidityMonitor(form, valid); + this.formValidityMonitor(valid); } }, - formValidityMonitor: function(form, valid){ + formValidityMonitor: function(valid){ var nbt = this.getNextButton(); if (valid && nbt.disabled){ nbt.setDisabled(false); @@ -433,20 +440,42 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } }, - appendImported: function(repositories){ - for (var i=0; i= this.importJobs ){ - if (debug){ - console.debug( 'import of ' + this.importJobsFinished + ' jobs finished' ); + for (var i=0; i 0 ? this.imported : null, + failed: this.failed.length > 0 ? this.failed : null, + isEmpty: function(imported, failed){ + return !imported && !failed; } - Ext.getCmp('importedGrid').getStore().loadData(this.imported); - Ext.getCmp('move-next').setDisabled(true); - Ext.getCmp('move-prev').setDisabled(true); - Ext.getCmp('finish').setDisabled(false); - } + }; + var resultPanel = Ext.getCmp('resultPanel'); + resultPanel.tpl.overwrite(resultPanel.body, model); + layout.setActiveItem(4); }, importFromFile: function(layout, form){ @@ -454,21 +483,13 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { form.submit({ url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html', scope: this, - success: function(form, action){ - this.appendImported([{ - name: form.getValues().name, - type: this.repositoryType - }]); + success: function(form){ lbox.hide(); - layout.setActiveItem(4); + this.appendImported(layout, form.getValues().name); }, - failure: function(form, action){ + failure: function(form){ lbox.hide(); - main.handleRestFailure( - action.response, - this.errorTitleText, - this.errorMsgText - ); + this.appendFailed(layout, form.getValues().name); } }); }, @@ -481,20 +502,12 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { scope: this, jsonData: repository, success: function(){ - this.appendImported([{ - name: repository.name, - type: this.repositoryType - }]); lbox.hide(); - layout.setActiveItem(4); + this.appendImported(layout, repository.name); }, - failure: function(result){ + failure: function(){ lbox.hide(); - main.handleRestFailure( - result, - this.errorTitleText, - this.errorMsgText - ); + this.appendFailed(layout, repository.name); } }); }, @@ -502,14 +515,12 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { importFromDirectory: function(layout){ var lbox = this.showLoadingBox(); Ext.Ajax.request({ - url: restUrl + 'import/repositories/' + this.repositoryType + '.json', + url: restUrl + 'import/repositories/' + this.repositoryType + '/directory.json', method: 'POST', scope: this, success: function(response){ - var obj = Ext.decode(response.responseText); - this.appendImported(obj); lbox.hide(); - layout.setActiveItem(4); + this.appendImportResult(layout, Ext.decode(response.responseText)); }, failure: function(result){ lbox.hide(); @@ -532,8 +543,8 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { if ( type !== null ){ Ext.getCmp('chooseImportType').setValue(null); - Ext.getCmp('move-next').setDisabled(true); - Ext.getCmp('move-prev').setDisabled(false); + this.getNextButton().setDisabled(true); + this.getPrevButton().setDisabled(false); Ext.getCmp('importTypeURL').setDisabled(type.supportedCommands.indexOf('PULL') < 0); Ext.getCmp('importTypeFile').setDisabled(type.supportedCommands.indexOf('UNBUNDLE') < 0); } From 8c456d76b3f0ab333785682202cca16a82b2b146 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 30 Nov 2014 22:43:42 +0100 Subject: [PATCH 52/68] prepare client api fo import commands --- .../sonia/scm/client/ImportBundleRequest.java | 70 +++++++ .../sonia/scm/client/ImportResultWrapper.java | 184 ++++++++++++++++++ .../sonia/scm/client/ImportUrlRequest.java | 118 +++++++++++ .../scm/client/RepositoryClientHandler.java | 37 ++++ scm-clients/scm-client-impl/pom.xml | 6 + .../client/JerseyRepositoryClientHandler.java | 148 ++++++++++++++ .../java/sonia/scm/url/RestUrlProvider.java | 14 ++ .../main/java/sonia/scm/url/UrlProvider.java | 12 +- .../java/sonia/scm/url/WUIUrlProvider.java | 14 ++ .../main/java/sonia/scm/util/HttpUtil.java | 6 + 10 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java create mode 100644 scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportResultWrapper.java create mode 100644 scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportUrlRequest.java diff --git a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java new file mode 100644 index 0000000000..96dbb7d79f --- /dev/null +++ b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2014, 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.client; + +import com.google.common.io.ByteSource; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class ImportBundleRequest +{ + private String type; + private String name; + private ByteSource bundle; + + ImportBundleRequest() + { + } + + public ImportBundleRequest(String type, String name, ByteSource bundle) + { + this.type = type; + this.name = name; + this.bundle = bundle; + } + + public String getType() + { + return type; + } + + public String getName() + { + return name; + } + + public ByteSource getBundle() + { + return bundle; + } + +} diff --git a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportResultWrapper.java b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportResultWrapper.java new file mode 100644 index 0000000000..1417e3b888 --- /dev/null +++ b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportResultWrapper.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) 2014, 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.client; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; + +import sonia.scm.repository.ImportResult; +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.List; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class ImportResultWrapper +{ + + /** + * Constructs ... + * + * + * @param client + * @param type + * @param result + */ + public ImportResultWrapper(RepositoryClientHandler client, String type, + ImportResult result) + { + this.client = client; + this.type = type; + this.result = result; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public List getFailedDirectories() + { + List directories = result.getFailedDirectories(); + + if (directories == null) + { + directories = ImmutableList.of(); + } + + return directories; + } + + /** + * Method description + * + * + * @return + */ + public List getImportedDirectories() + { + List directories = result.getImportedDirectories(); + + if (directories == null) + { + directories = ImmutableList.of(); + } + + return directories; + } + + /** + * Method description + * + * + * @return + */ + public Iterable getImportedRepositories() + { + return Iterables.transform(getImportedDirectories(), + new RepositoryResolver(client, type)); + } + + //~--- inner classes -------------------------------------------------------- + + /** + * Class description + * + * + * @version Enter version here..., 14/11/29 + * @author Enter your name here... + */ + private static class RepositoryResolver + implements Function + { + + /** + * Constructs ... + * + * + * @param clientHandler + * @param type + */ + public RepositoryResolver(RepositoryClientHandler clientHandler, + String type) + { + this.clientHandler = clientHandler; + this.type = type; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Method description + * + * + * @param name + * + * @return + */ + @Override + public Repository apply(String name) + { + return clientHandler.get(type, type); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private final RepositoryClientHandler clientHandler; + + /** Field description */ + private final String type; + } + + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final RepositoryClientHandler client; + + /** Field description */ + private final ImportResult result; + + /** Field description */ + private final String type; +} diff --git a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportUrlRequest.java b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportUrlRequest.java new file mode 100644 index 0000000000..66969f4a86 --- /dev/null +++ b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportUrlRequest.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2014, 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.client; + +//~--- JDK imports ------------------------------------------------------------ + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +@XmlRootElement(name = "import") +@XmlAccessorType(XmlAccessType.FIELD) +public class ImportUrlRequest +{ + + /** + * Constructs ... + * + */ + ImportUrlRequest() {} + + /** + * Constructs ... + * + * + * @param type + * @param name + * @param url + */ + public ImportUrlRequest(String type, String name, String url) + { + this.type = type; + this.name = name; + this.url = url; + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public String getName() + { + return name; + } + + /** + * Method description + * + * + * @return + */ + public String getType() + { + return type; + } + + /** + * Method description + * + * + * @return + */ + public String getUrl() + { + return url; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private String name; + + /** Field description */ + @XmlTransient + private String type; + + /** Field description */ + private String url; +} diff --git a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/RepositoryClientHandler.java b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/RepositoryClientHandler.java index b5ec335642..9c0060aaff 100644 --- a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/RepositoryClientHandler.java +++ b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/RepositoryClientHandler.java @@ -51,6 +51,43 @@ import java.util.Collection; public interface RepositoryClientHandler extends ClientHandler { + /** + * Method description + * + * + * @param type + * + * @return + * + * @since 1.43 + */ + public ImportResultWrapper importFromDirectory(String type); + + /** + * Method description + * + * + * @param request + * + * @return + * + * @since 1.43 + */ + public Repository importFromBundle(ImportBundleRequest request); + + /** + * Method description + * + * + * @param request + * @return + * + * @since 1.43 + */ + public Repository importFromUrl(ImportUrlRequest request); + + //~--- get methods ---------------------------------------------------------- + /** * Method description * diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 7bec66f275..5217a39b54 100644 --- a/scm-clients/scm-client-impl/pom.xml +++ b/scm-clients/scm-client-impl/pom.xml @@ -45,6 +45,12 @@ ${jersey.version}
    + + com.sun.jersey.contribs + jersey-multipart + ${jersey.version} + + diff --git a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java index f1c204531b..113258e117 100644 --- a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java +++ b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java @@ -35,16 +35,26 @@ package sonia.scm.client; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.base.Strings; + import sonia.scm.NotSupportedFeatuerException; import sonia.scm.Type; +import sonia.scm.repository.ImportResult; import sonia.scm.repository.Repository; import sonia.scm.repository.Tags; +import sonia.scm.util.HttpUtil; +import sonia.scm.util.IOUtil; //~--- JDK imports ------------------------------------------------------------ import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.GenericType; import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.multipart.FormDataMultiPart; +import com.sun.jersey.multipart.file.StreamDataBodyPart; + +import java.io.IOException; +import java.io.InputStream; import java.util.Collection; import java.util.List; @@ -57,6 +67,26 @@ public class JerseyRepositoryClientHandler extends AbstractClientHandler implements RepositoryClientHandler { + /** Field description */ + private static final String IMPORT_TYPE_BUNDLE = "bundle"; + + /** Field description */ + private static final String IMPORT_TYPE_DIRECTORY = "directory"; + + /** Field description */ + private static final String IMPORT_TYPE_URL = "url"; + + /** Field description */ + private static final String PARAM_BUNDLE = "bundle"; + + /** Field description */ + private static final String PARAM_NAME = "name"; + + /** Field description */ + private static final String URL_IMPORT = "import/repositories/"; + + //~--- constructors --------------------------------------------------------- + /** * Constructs ... * @@ -68,6 +98,106 @@ public class JerseyRepositoryClientHandler super(session, Repository.class); } + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param request + * + * @return + */ + @Override + public Repository importFromBundle(ImportBundleRequest request) + { + WebResource r = client.resource(getImportUrl(request.getType(), + IMPORT_TYPE_BUNDLE)); + Repository repository = null; + InputStream stream = null; + + try + { + stream = request.getBundle().openStream(); + + FormDataMultiPart form = new FormDataMultiPart(); + + form.field(PARAM_NAME, request.getName()); + form.bodyPart(new StreamDataBodyPart(PARAM_BUNDLE, stream)); + + ClientResponse response = r.post(ClientResponse.class); + + ClientUtil.checkResponse(response); + + String location = + response.getHeaders().getFirst(HttpUtil.HEADER_LOCATION); + + if (Strings.isNullOrEmpty(location)) + { + throw new ScmClientException("no location header found after import"); + } + + repository = getItemByUrl(location); + } + catch (IOException ex) + { + throw new ScmClientException("could not import bundle", ex); + } + finally + { + IOUtil.close(stream); + } + + return repository; + } + + /** + * Method description + * + * + * @param type + * + * @return + */ + @Override + public ImportResultWrapper importFromDirectory(String type) + { + WebResource r = client.resource(getImportUrl(type, IMPORT_TYPE_DIRECTORY)); + ClientResponse response = r.post(ClientResponse.class); + + ClientUtil.checkResponse(response); + + return new ImportResultWrapper(this, type, + response.getEntity(ImportResult.class)); + } + + /** + * Method description + * + * + * @param request + * + * @return + */ + @Override + public Repository importFromUrl(ImportUrlRequest request) + { + WebResource r = client.resource(getImportUrl(request.getType(), + IMPORT_TYPE_URL)); + ClientResponse response = r.post(ClientResponse.class); + + ClientUtil.checkResponse(response); + + String location = response.getHeaders().getFirst(HttpUtil.HEADER_LOCATION); + + if (Strings.isNullOrEmpty(location)) + { + throw new ScmClientException("no location header found after import"); + } + + return getItemByUrl(location); + } + //~--- get methods ---------------------------------------------------------- /** @@ -228,4 +358,22 @@ public class JerseyRepositoryClientHandler { return urlProvider.getRepositoryUrlProvider().getAllUrl(); } + + /** + * Method description + * + * + * @param type + * @param importType + * + * @return + */ + private String getImportUrl(String type, String importType) + { + StringBuilder buffer = new StringBuilder(URL_IMPORT); + + buffer.append(type).append(HttpUtil.SEPARATOR_PATH).append(importType); + + return HttpUtil.append(urlProvider.getBaseUrl(), buffer.toString()); + } } diff --git a/scm-core/src/main/java/sonia/scm/url/RestUrlProvider.java b/scm-core/src/main/java/sonia/scm/url/RestUrlProvider.java index cb0b3de82d..50f5912edb 100644 --- a/scm-core/src/main/java/sonia/scm/url/RestUrlProvider.java +++ b/scm-core/src/main/java/sonia/scm/url/RestUrlProvider.java @@ -94,6 +94,20 @@ public class RestUrlProvider implements UrlProvider return HttpUtil.append(baseUrl, PART_AUTHENTICATION).concat(extension); } + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + @Override + public String getBaseUrl() + { + return baseUrl; + } + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/url/UrlProvider.java b/scm-core/src/main/java/sonia/scm/url/UrlProvider.java index e6c3e4911a..1ab798d60b 100644 --- a/scm-core/src/main/java/sonia/scm/url/UrlProvider.java +++ b/scm-core/src/main/java/sonia/scm/url/UrlProvider.java @@ -48,6 +48,16 @@ public interface UrlProvider */ public String getAuthenticationUrl(); + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + public String getBaseUrl(); + /** * Method description * @@ -77,7 +87,7 @@ public interface UrlProvider * * * @return - * + * * @since 1.41 */ public SecurityUrlProvider getSecurityUrlProvider(); diff --git a/scm-core/src/main/java/sonia/scm/url/WUIUrlProvider.java b/scm-core/src/main/java/sonia/scm/url/WUIUrlProvider.java index e6a8388e0d..bd94bf562e 100644 --- a/scm-core/src/main/java/sonia/scm/url/WUIUrlProvider.java +++ b/scm-core/src/main/java/sonia/scm/url/WUIUrlProvider.java @@ -88,6 +88,20 @@ public class WUIUrlProvider implements UrlProvider return baseUrl; } + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + @Override + public String getBaseUrl() + { + return baseUrl; + } + /** * Method description * diff --git a/scm-core/src/main/java/sonia/scm/util/HttpUtil.java b/scm-core/src/main/java/sonia/scm/util/HttpUtil.java index 7e4c410aa4..abe7fdd089 100644 --- a/scm-core/src/main/java/sonia/scm/util/HttpUtil.java +++ b/scm-core/src/main/java/sonia/scm/util/HttpUtil.java @@ -73,6 +73,12 @@ public final class HttpUtil /** Field description */ public static final String ENCODING = "UTF-8"; + /** + * location header + * @since 1.43 + */ + public static final String HEADER_LOCATION = "Location"; + /** * header for identifying the scm-manager client * @since 1.19 From 74bf119fd713c833d3eb7f6cd5c0e5b21f92c182 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 09:05:59 +0100 Subject: [PATCH 53/68] implemented import-from-directory cli sub command --- scm-clients/scm-cli-client/pom.xml | 2 +- .../cli/cmd/ImportDirectorySubCommand.java | 120 ++++++++++++++++++ .../services/sonia.scm.cli.cmd.SubCommand | 1 + .../resources/sonia/resources/i18n.properties | 4 +- .../sonia/resources/import-from-directory.ftl | 9 ++ 5 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java create mode 100644 scm-clients/scm-cli-client/src/main/resources/sonia/resources/import-from-directory.ftl diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 2d3e28f780..231ee856d6 100644 --- a/scm-clients/scm-cli-client/pom.xml +++ b/scm-clients/scm-cli-client/pom.xml @@ -40,7 +40,7 @@ args4j args4j - 2.0.28 + 2.0.29 diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java new file mode 100644 index 0000000000..581cb3079d --- /dev/null +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java @@ -0,0 +1,120 @@ +/** + * 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.cli.cmd; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.Maps; + +import org.kohsuke.args4j.Argument; + +import sonia.scm.client.ImportResultWrapper; +import sonia.scm.client.ScmClientSession; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +@Command( + name = "import-from-directory", + usage = "usageImportDirectory", + group = "repository" +) +public class ImportDirectorySubCommand extends TemplateSubCommand +{ + + /** Field description */ + public static final String TEMPLATE = + "/sonia/resources/import-from-directory.ftl"; + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public String getType() + { + return type; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param type + */ + public void setType(String type) + { + this.type = type; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + */ + @Override + protected void run() + { + ScmClientSession session = createSession(); + ImportResultWrapper wrapper = + session.getRepositoryHandler().importFromDirectory(type); + Map env = Maps.newHashMap(); + + env.put("importedDirectories", wrapper.getImportedDirectories()); + env.put("failedDirectories", wrapper.getFailedDirectories()); + renderTemplate(env, TEMPLATE); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Argument( + usage = "optionRepositoryType", + metaVar = "repositorytype", + required = true + ) + private String type; +} diff --git a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand index b4d344adae..a135f1ff49 100644 --- a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand +++ b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand @@ -37,6 +37,7 @@ sonia.scm.cli.cmd.ModifyRepositorySubCommand sonia.scm.cli.cmd.GetRepositorySubCommand sonia.scm.cli.cmd.ListRepositoriesSubCommand sonia.scm.cli.cmd.DeleteRepositorySubCommand +sonia.scm.cli.cmd.ImportDirectorySubCommand # permission sonia.scm.cli.cmd.AddPermissionSubCommand diff --git a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties index 69d88b2cfe..c16468cce9 100644 --- a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties +++ b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties @@ -46,7 +46,7 @@ optionTemplateFile = Template file optionRepositoryId = Repository Id optionRepositoryIdOrTypeAndName = Repository Id or type/name optionRepositoryName = Repository name -optionRepositoryType = Repository name +optionRepositoryType = Repository type optionRepositoryContact = Repository contact optionRepositoryDescription = Repository description optionRepositoryPublic = Repository public readable @@ -81,6 +81,7 @@ permissiontype = value groupname = groupname repositoryid = repositoryid username = username +repositorytype = type config = Configuration misc = Miscellaneous @@ -118,6 +119,7 @@ usageModifyRepository = Modify a repository usageStoreConfig = Stores the current configuration usageVersion = Show the version of scm-cli-client usageServerVersion = Show the version of the scm-manager +usageImportDirectory = Import repositories from repository directory usageEncrypt = Encrypts the given value usageGenerateKey = Generates a unique key \ No newline at end of file diff --git a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/import-from-directory.ftl b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/import-from-directory.ftl new file mode 100644 index 0000000000..33cf9e083e --- /dev/null +++ b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/import-from-directory.ftl @@ -0,0 +1,9 @@ +Imported repositories: +<#list importedDirectories as imported> +- ${imported} + + +Repositories failed to import: +<#list failedDirectories as failed> +- ${failed} + \ No newline at end of file From c98c8c860a4b876652c9adc19e215f11fa151c5b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 09:06:42 +0100 Subject: [PATCH 54/68] fix marshaling of ImportResult --- .../src/main/java/sonia/scm/repository/ImportResult.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scm-core/src/main/java/sonia/scm/repository/ImportResult.java b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java index 2911a57030..a7d242abc4 100644 --- a/scm-core/src/main/java/sonia/scm/repository/ImportResult.java +++ b/scm-core/src/main/java/sonia/scm/repository/ImportResult.java @@ -42,6 +42,9 @@ import static com.google.common.base.Preconditions.*; //~--- JDK imports ------------------------------------------------------------ import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; /** * Import result of the {@link AdvancedImportHandler}. @@ -49,6 +52,8 @@ import java.util.List; * @author Sebastian Sdorra * @since 1.43 */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "import-result") public final class ImportResult { From 0253485461e09400e252a81ce995036a9da3538d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 09:35:01 +0100 Subject: [PATCH 55/68] fix bung in implementation of importFromUrl --- .../java/sonia/scm/client/JerseyRepositoryClientHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java index 113258e117..42caf76038 100644 --- a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java +++ b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java @@ -184,7 +184,7 @@ public class JerseyRepositoryClientHandler { WebResource r = client.resource(getImportUrl(request.getType(), IMPORT_TYPE_URL)); - ClientResponse response = r.post(ClientResponse.class); + ClientResponse response = r.post(ClientResponse.class, request); ClientUtil.checkResponse(response); From 2b3e42052f3ce0b500eb4c76116c0d8f2fe2a755 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 09:35:45 +0100 Subject: [PATCH 56/68] implement import-from-url cli sub command --- .../cli/cmd/ImportDirectorySubCommand.java | 40 +---- .../sonia/scm/cli/cmd/ImportSubCommand.java | 79 ++++++++++ .../scm/cli/cmd/ImportUrlSubCommand.java | 148 ++++++++++++++++++ .../services/sonia.scm.cli.cmd.SubCommand | 1 + .../resources/sonia/resources/i18n.properties | 3 + 5 files changed, 233 insertions(+), 38 deletions(-) create mode 100644 scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java create mode 100644 scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java index 581cb3079d..8b1eaa09de 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java @@ -56,39 +56,13 @@ import java.util.Map; usage = "usageImportDirectory", group = "repository" ) -public class ImportDirectorySubCommand extends TemplateSubCommand +public class ImportDirectorySubCommand extends ImportSubCommand { /** Field description */ public static final String TEMPLATE = "/sonia/resources/import-from-directory.ftl"; - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - public String getType() - { - return type; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param type - */ - public void setType(String type) - { - this.type = type; - } - //~--- methods -------------------------------------------------------------- /** @@ -100,21 +74,11 @@ public class ImportDirectorySubCommand extends TemplateSubCommand { ScmClientSession session = createSession(); ImportResultWrapper wrapper = - session.getRepositoryHandler().importFromDirectory(type); + session.getRepositoryHandler().importFromDirectory(getType()); Map env = Maps.newHashMap(); env.put("importedDirectories", wrapper.getImportedDirectories()); env.put("failedDirectories", wrapper.getFailedDirectories()); renderTemplate(env, TEMPLATE); } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - @Argument( - usage = "optionRepositoryType", - metaVar = "repositorytype", - required = true - ) - private String type; } diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java new file mode 100644 index 0000000000..5cdbf57d9c --- /dev/null +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2014, 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.cli.cmd; + +//~--- non-JDK imports -------------------------------------------------------- + +import org.kohsuke.args4j.Argument; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public abstract class ImportSubCommand extends TemplateSubCommand +{ + + /** + * Method description + * + * + * @return + */ + public String getType() + { + return type; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param type + */ + public void setType(String type) + { + this.type = type; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Argument( + usage = "optionRepositoryType", + metaVar = "repositorytype", + required = true + ) + private String type; +} diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java new file mode 100644 index 0000000000..8e29875198 --- /dev/null +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) 2014, 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.cli.cmd; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.collect.Maps; + +import org.kohsuke.args4j.Option; + +import sonia.scm.client.ImportUrlRequest; +import sonia.scm.client.ScmClientSession; +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.net.URL; + +import java.util.Map; + +/** + * + * @author Sebastian Sdorra + */ +@Command( + name = "import-from-url", + usage = "usageImportUrl", + group = "repository" +) +public class ImportUrlSubCommand extends ImportSubCommand +{ + + /** + * Method description + * + * + * @return + */ + public String getName() + { + return name; + } + + /** + * Method description + * + * + * @return + */ + public URL getUrl() + { + return url; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * Method description + * + * + * @param url + */ + public void setUrl(URL url) + { + this.url = url; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + */ + @Override + protected void run() + { + ScmClientSession session = createSession(); + + ImportUrlRequest request = new ImportUrlRequest(getType(), name, + url.toExternalForm()); + Repository repository = + session.getRepositoryHandler().importFromUrl(request); + Map env = Maps.newHashMap(); + + env.put("repository", repository); + renderTemplate(env, GetRepositorySubCommand.TEMPLATE); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Option( + name = "--name", + required = true, + usage = "optionRepositoryName", + aliases = { "-n" } + ) + private String name; + + /** Field description */ + @Option( + name = "--url", + required = true, + usage = "optionRemoteRepositoryUrl", + aliases = { "-r" } + ) + private URL url; +} diff --git a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand index a135f1ff49..17218a6806 100644 --- a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand +++ b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand @@ -38,6 +38,7 @@ sonia.scm.cli.cmd.GetRepositorySubCommand sonia.scm.cli.cmd.ListRepositoriesSubCommand sonia.scm.cli.cmd.DeleteRepositorySubCommand sonia.scm.cli.cmd.ImportDirectorySubCommand +sonia.scm.cli.cmd.ImportUrlSubCommand # permission sonia.scm.cli.cmd.AddPermissionSubCommand diff --git a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties index c16468cce9..1a3a7c90c4 100644 --- a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties +++ b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties @@ -51,6 +51,7 @@ optionRepositoryContact = Repository contact optionRepositoryDescription = Repository description optionRepositoryPublic = Repository public readable optionRepositoryArchive = Repository archived +optionRemoteRepositoryUrl = Remote repository url optionPermissionGroup = Group optionPermissionName = Group or user name @@ -91,6 +92,7 @@ user = User security = Security level = Logging-Level boolean = true or false +URL = url options = Options usage = scm-cli-client [options] command [command options] @@ -120,6 +122,7 @@ usageStoreConfig = Stores the current configuration usageVersion = Show the version of scm-cli-client usageServerVersion = Show the version of the scm-manager usageImportDirectory = Import repositories from repository directory +usageImportUrl = Import repository from remote url usageEncrypt = Encrypts the given value usageGenerateKey = Generates a unique key \ No newline at end of file From 9cc86f4fb17ee61f45c2a9709f26ac05ac09ae55 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 10:00:03 +0100 Subject: [PATCH 57/68] fix bundle upload --- .../main/java/sonia/scm/client/JerseyClientProvider.java | 6 +++++- .../sonia/scm/client/JerseyRepositoryClientHandler.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyClientProvider.java b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyClientProvider.java index 48111de0d8..6ad74d748a 100644 --- a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyClientProvider.java +++ b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyClientProvider.java @@ -51,8 +51,11 @@ import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.ClientFilter; import com.sun.jersey.core.util.MultivaluedMapImpl; +import com.sun.jersey.multipart.impl.MultiPartWriter; import java.util.ArrayList; import java.util.Collections; @@ -122,7 +125,8 @@ public class JerseyClientProvider implements ScmClientProvider UrlProvider urlProvider = UrlProviderFactory.createUrlProvider(url, UrlProviderFactory.TYPE_RESTAPI_XML); - Client client = Client.create(); + Client client = + Client.create(new DefaultClientConfig(MultiPartWriter.class)); client.addFilter(new CookieClientFilter()); diff --git a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java index 42caf76038..8b91db96ee 100644 --- a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java +++ b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java @@ -58,6 +58,7 @@ import java.io.InputStream; import java.util.Collection; import java.util.List; +import javax.ws.rs.core.MediaType; /** * @@ -125,7 +126,8 @@ public class JerseyRepositoryClientHandler form.field(PARAM_NAME, request.getName()); form.bodyPart(new StreamDataBodyPart(PARAM_BUNDLE, stream)); - ClientResponse response = r.post(ClientResponse.class); + ClientResponse response = + r.type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class, form); ClientUtil.checkResponse(response); From 6bc1a8100653dd0956239aa26e2c78ab25fe3a50 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 10:01:05 +0100 Subject: [PATCH 58/68] implement import-from-bundle cli sub command --- .../scm/cli/cmd/ImportBundleSubCommand.java | 152 ++++++++++++++++++ .../cli/cmd/ImportDirectorySubCommand.java | 2 - .../sonia/scm/cli/cmd/ImportSubCommand.java | 24 +++ .../scm/cli/cmd/ImportUrlSubCommand.java | 4 +- .../services/sonia.scm.cli.cmd.SubCommand | 1 + .../resources/sonia/resources/i18n.properties | 2 + 6 files changed, 180 insertions(+), 5 deletions(-) create mode 100644 scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java new file mode 100644 index 0000000000..f107255e42 --- /dev/null +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java @@ -0,0 +1,152 @@ +/** +* Copyright (c) 2014, 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.cli.cmd; + +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.io.Files; + +import org.kohsuke.args4j.Option; + +import sonia.scm.ConfigurationException; +import sonia.scm.client.ImportBundleRequest; +import sonia.scm.client.ScmClientSession; +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +@Command( + name = "import-from-bundle", + usage = "usageImportBundle", + group = "repository" +) +public class ImportBundleSubCommand extends ImportSubCommand +{ + + /** + * Method description + * + * + * @return + */ + public File getBundle() + { + return bundle; + } + + /** + * Method description + * + * + * @return + */ + public String getName() + { + return name; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param bundle + */ + public void setBundle(File bundle) + { + this.bundle = bundle; + } + + /** + * Method description + * + * + * @param name + */ + public void setName(String name) + { + this.name = name; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + */ + @Override + protected void run() + { + if (!bundle.exists()) + { + throw new ConfigurationException("could not find bundle"); + } + else + { + ScmClientSession session = createSession(); + + Repository repository = session.getRepositoryHandler().importFromBundle( + new ImportBundleRequest( + getType(), name, Files.asByteSource(bundle))); + + printImportedRepository(repository); + } + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + @Option( + name = "--bundle", + required = true, + usage = "optionRepositoryBundle", + aliases = { "-b" } + ) + private File bundle; + + /** Field description */ + @Option( + name = "--name", + required = true, + usage = "optionRepositoryName", + aliases = { "-n" } + ) + private String name; +} diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java index 8b1eaa09de..788eef4fae 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportDirectorySubCommand.java @@ -37,8 +37,6 @@ package sonia.scm.cli.cmd; import com.google.common.collect.Maps; -import org.kohsuke.args4j.Argument; - import sonia.scm.client.ImportResultWrapper; import sonia.scm.client.ScmClientSession; diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java index 5cdbf57d9c..3aea7555fe 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java @@ -33,8 +33,16 @@ package sonia.scm.cli.cmd; //~--- non-JDK imports -------------------------------------------------------- +import com.google.common.collect.Maps; + import org.kohsuke.args4j.Argument; +import sonia.scm.repository.Repository; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Map; + /** * * @author Sebastian Sdorra @@ -67,6 +75,22 @@ public abstract class ImportSubCommand extends TemplateSubCommand this.type = type; } + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param repository + */ + protected void printImportedRepository(Repository repository) + { + Map env = Maps.newHashMap(); + + env.put("repository", repository); + renderTemplate(env, GetRepositorySubCommand.TEMPLATE); + } + //~--- fields --------------------------------------------------------------- /** Field description */ diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java index 8e29875198..912a9a5fbc 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportUrlSubCommand.java @@ -120,10 +120,8 @@ public class ImportUrlSubCommand extends ImportSubCommand url.toExternalForm()); Repository repository = session.getRepositoryHandler().importFromUrl(request); - Map env = Maps.newHashMap(); - env.put("repository", repository); - renderTemplate(env, GetRepositorySubCommand.TEMPLATE); + printImportedRepository(repository); } //~--- fields --------------------------------------------------------------- diff --git a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand index 17218a6806..91f2345948 100644 --- a/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand +++ b/scm-clients/scm-cli-client/src/main/resources/META-INF/services/sonia.scm.cli.cmd.SubCommand @@ -39,6 +39,7 @@ sonia.scm.cli.cmd.ListRepositoriesSubCommand sonia.scm.cli.cmd.DeleteRepositorySubCommand sonia.scm.cli.cmd.ImportDirectorySubCommand sonia.scm.cli.cmd.ImportUrlSubCommand +sonia.scm.cli.cmd.ImportBundleSubCommand # permission sonia.scm.cli.cmd.AddPermissionSubCommand diff --git a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties index 1a3a7c90c4..47c4ee4ff2 100644 --- a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties +++ b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties @@ -52,6 +52,7 @@ optionRepositoryDescription = Repository description optionRepositoryPublic = Repository public readable optionRepositoryArchive = Repository archived optionRemoteRepositoryUrl = Remote repository url +optionRepositoryBundle = Import repository from a bundle file (e.g. svn dump) optionPermissionGroup = Group optionPermissionName = Group or user name @@ -93,6 +94,7 @@ security = Security level = Logging-Level boolean = true or false URL = url +bundle = file options = Options usage = scm-cli-client [options] command [command options] From 0cd09bf226abd012a17b7a45f307a3b139d23b16 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 10:02:32 +0100 Subject: [PATCH 59/68] fix output of import commands --- .../src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java index 3aea7555fe..7c8efe704d 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportSubCommand.java @@ -37,6 +37,7 @@ import com.google.common.collect.Maps; import org.kohsuke.args4j.Argument; +import sonia.scm.cli.wrapper.RepositoryWrapper; import sonia.scm.repository.Repository; //~--- JDK imports ------------------------------------------------------------ @@ -87,7 +88,7 @@ public abstract class ImportSubCommand extends TemplateSubCommand { Map env = Maps.newHashMap(); - env.put("repository", repository); + env.put("repository", new RepositoryWrapper(config, repository)); renderTemplate(env, GetRepositorySubCommand.TEMPLATE); } From 34d05ef3a034f8f6fedd22bf79b9903266c3a166 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 11:14:19 +0100 Subject: [PATCH 60/68] implement gzip compression for unbundle command --- .../scm/cli/cmd/ImportBundleSubCommand.java | 40 ++++++- .../resources/sonia/resources/i18n.properties | 1 + .../sonia/scm/client/ImportBundleRequest.java | 91 ++++++++++++++-- .../client/JerseyRepositoryClientHandler.java | 7 +- .../api/UnbundleCommandBuilder.java | 100 +++++++++++++++++- .../resources/RepositoryImportResource.java | 20 ++-- .../sonia.repository.importwindow.js | 9 +- 7 files changed, 241 insertions(+), 27 deletions(-) diff --git a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java index f107255e42..d746df0828 100644 --- a/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java +++ b/scm-clients/scm-cli-client/src/main/java/sonia/scm/cli/cmd/ImportBundleSubCommand.java @@ -81,6 +81,17 @@ public class ImportBundleSubCommand extends ImportSubCommand return name; } + /** + * Method description + * + * + * @return + */ + public boolean isCompressed() + { + return compressed; + } + //~--- set methods ---------------------------------------------------------- /** @@ -94,6 +105,17 @@ public class ImportBundleSubCommand extends ImportSubCommand this.bundle = bundle; } + /** + * Method description + * + * + * @param compressed + */ + public void setCompressed(boolean compressed) + { + this.compressed = compressed; + } + /** * Method description * @@ -122,9 +144,13 @@ public class ImportBundleSubCommand extends ImportSubCommand { ScmClientSession session = createSession(); - Repository repository = session.getRepositoryHandler().importFromBundle( - new ImportBundleRequest( - getType(), name, Files.asByteSource(bundle))); + ImportBundleRequest req = new ImportBundleRequest(getType(), name, + Files.asByteSource(bundle)); + + req.setCompressed(compressed); + + Repository repository = + session.getRepositoryHandler().importFromBundle(req); printImportedRepository(repository); } @@ -141,6 +167,14 @@ public class ImportBundleSubCommand extends ImportSubCommand ) private File bundle; + /** Field description */ + @Option( + name = "--compressed", + usage = "optionRepositoryBundleCompressed", + aliases = { "-c" } + ) + private boolean compressed = false; + /** Field description */ @Option( name = "--name", diff --git a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties index 47c4ee4ff2..9d6afd3dda 100644 --- a/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties +++ b/scm-clients/scm-cli-client/src/main/resources/sonia/resources/i18n.properties @@ -53,6 +53,7 @@ optionRepositoryPublic = Repository public readable optionRepositoryArchive = Repository archived optionRemoteRepositoryUrl = Remote repository url optionRepositoryBundle = Import repository from a bundle file (e.g. svn dump) +optionRepositoryBundleCompressed = Indicates that the bundle is gzip compressed optionPermissionGroup = Group optionPermissionName = Group or user name diff --git a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java index 96dbb7d79f..c6c9e71016 100644 --- a/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java +++ b/scm-clients/scm-client-api/src/main/java/sonia/scm/client/ImportBundleRequest.java @@ -26,8 +26,13 @@ * http://bitbucket.org/sdorra/scm-manager * */ + + + package sonia.scm.client; +//~--- non-JDK imports -------------------------------------------------------- + import com.google.common.io.ByteSource; /** @@ -37,14 +42,21 @@ import com.google.common.io.ByteSource; */ public class ImportBundleRequest { - private String type; - private String name; - private ByteSource bundle; - ImportBundleRequest() - { - } + /** + * Constructs ... + * + */ + ImportBundleRequest() {} + /** + * Constructs ... + * + * + * @param type + * @param name + * @param bundle + */ public ImportBundleRequest(String type, String name, ByteSource bundle) { this.type = type; @@ -52,19 +64,76 @@ public class ImportBundleRequest this.bundle = bundle; } - public String getType() + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public ByteSource getBundle() { - return type; + return bundle; } + /** + * Method description + * + * + * @return + */ public String getName() { return name; } - public ByteSource getBundle() + /** + * Method description + * + * + * @return + */ + public String getType() { - return bundle; + return type; } - + + /** + * Method description + * + * + * @return + */ + public boolean isCompressed() + { + return compressed; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param compressed + */ + public void setCompressed(boolean compressed) + { + this.compressed = compressed; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private ByteSource bundle; + + /** Field description */ + private boolean compressed = false; + + /** Field description */ + private String name; + + /** Field description */ + private String type; } diff --git a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java index 8b91db96ee..ff611c9aa2 100644 --- a/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java +++ b/scm-clients/scm-client-impl/src/main/java/sonia/scm/client/JerseyRepositoryClientHandler.java @@ -58,6 +58,7 @@ import java.io.InputStream; import java.util.Collection; import java.util.List; + import javax.ws.rs.core.MediaType; /** @@ -80,6 +81,9 @@ public class JerseyRepositoryClientHandler /** Field description */ private static final String PARAM_BUNDLE = "bundle"; + /** Field description */ + private static final String PARAM_COMPRESSED = "compressed"; + /** Field description */ private static final String PARAM_NAME = "name"; @@ -113,7 +117,8 @@ public class JerseyRepositoryClientHandler public Repository importFromBundle(ImportBundleRequest request) { WebResource r = client.resource(getImportUrl(request.getType(), - IMPORT_TYPE_BUNDLE)); + IMPORT_TYPE_BUNDLE)).queryParam(PARAM_COMPRESSED, + Boolean.toString(request.isCompressed())); Repository repository = null; InputStream stream = null; diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java index 6e94073244..7860513b51 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java @@ -56,8 +56,10 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.zip.GZIPInputStream; + /** - * The unbundle command can restore an empty repository from a bundle. The + * The unbundle command can restore an empty repository from a bundle. The * bundle can be created with the {@link BundleCommandBuilder}. * * @author Sebastian Sdorra @@ -106,7 +108,7 @@ public final class UnbundleCommandBuilder "existing file is required"); UnbundleCommandRequest request = - new UnbundleCommandRequest(Files.asByteSource(inputFile)); + createRequest(Files.asByteSource(inputFile)); logger.info("unbundle archive {} at {}", inputFile, repository.getId()); @@ -130,8 +132,7 @@ public final class UnbundleCommandBuilder checkNotNull(inputStream, "input stream is required"); logger.info("unbundle archive from stream"); - return unbundleCommand.unbundle( - new UnbundleCommandRequest(asByteSource(inputStream))); + return unbundleCommand.unbundle(createRequest(asByteSource(inputStream))); } /** @@ -151,9 +152,28 @@ public final class UnbundleCommandBuilder checkNotNull(byteSource, "byte source is required"); logger.info("unbundle from byte source"); - return unbundleCommand.unbundle(new UnbundleCommandRequest(byteSource)); + return unbundleCommand.unbundle(createRequest(byteSource)); } + //~--- set methods ---------------------------------------------------------- + + /** + * Set to {@code true} if bundle is gzip compressed. Default is {@code false}. + * + * + * @param compressed {@code true} if bundle is gzip compressed + * + * @return {@code this} + */ + public UnbundleCommandBuilder setCompressed(boolean compressed) + { + this.compressed = compressed; + + return this; + } + + //~--- methods -------------------------------------------------------------- + /** * Converts an {@link InputStream} into a {@link ByteSource}. * @@ -175,6 +195,73 @@ public final class UnbundleCommandBuilder }); } + /** + * Creates the {@link UnbundleCommandRequest}. + * + * + * @param source byte source + * + * @return the create request + */ + private UnbundleCommandRequest createRequest(ByteSource source) + { + ByteSource bs; + + if (compressed) + { + logger.debug("decode gzip stream for unbundle command"); + bs = new CompressedByteSource(source); + } + else + { + bs = source; + } + + return new UnbundleCommandRequest(bs); + } + + //~--- inner classes -------------------------------------------------------- + + /** + * ByteSource which is able to handle gzip compressed resources. + */ + private static class CompressedByteSource extends ByteSource + { + + /** + * Constructs ... + * + * + * @param wrapped + */ + public CompressedByteSource(ByteSource wrapped) + { + this.wrapped = wrapped; + } + + //~--- methods ------------------------------------------------------------ + + /** + * Opens the stream for reading the compressed source. + * + * + * @return input stream + * + * @throws IOException + */ + @Override + public InputStream openStream() throws IOException + { + return new GZIPInputStream(wrapped.openStream()); + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + private final ByteSource wrapped; + } + + //~--- fields --------------------------------------------------------------- /** repository */ @@ -182,4 +269,7 @@ public final class UnbundleCommandBuilder /** unbundle command implementation */ private final UnbundleCommand unbundleCommand; + + /** Field description */ + private boolean compressed = false; } diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java index 5a3be7dd26..c6c78b0136 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryImportResource.java @@ -87,11 +87,13 @@ import java.util.List; import java.util.Set; import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; @@ -156,6 +158,7 @@ public class RepositoryImportResource * @param type repository type * @param name name of the repository * @param inputStream input bundle + * @param compressed true if the bundle is gzip compressed * * @return empty response with location header which points to the imported * repository @@ -166,9 +169,11 @@ public class RepositoryImportResource @Consumes(MediaType.MULTIPART_FORM_DATA) public Response importFromBundle(@Context UriInfo uriInfo, @PathParam("type") String type, @FormDataParam("name") String name, - @FormDataParam("bundle") InputStream inputStream) + @FormDataParam("bundle") InputStream inputStream, @QueryParam("compressed") + @DefaultValue("false") boolean compressed) { - Repository repository = doImportFromBundle(type, name, inputStream); + Repository repository = doImportFromBundle(type, name, inputStream, + compressed); return buildResponse(uriInfo, repository); } @@ -193,6 +198,7 @@ public class RepositoryImportResource * @param type repository type * @param name name of the repository * @param inputStream input bundle + * @param compressed true if the bundle is gzip compressed * * @return empty response with location header which points to the imported * repository @@ -204,13 +210,14 @@ public class RepositoryImportResource @Produces(MediaType.TEXT_HTML) public Response importFromBundleUI(@PathParam("type") String type, @FormDataParam("name") String name, - @FormDataParam("bundle") InputStream inputStream) + @FormDataParam("bundle") InputStream inputStream, @QueryParam("compressed") + @DefaultValue("false") boolean compressed) { Response response; try { - doImportFromBundle(type, name, inputStream); + doImportFromBundle(type, name, inputStream, compressed); response = Response.ok(new RestActionUploadResult(true)).build(); } catch (WebApplicationException ex) @@ -569,11 +576,12 @@ public class RepositoryImportResource * @param type repository type * @param name name of the repository * @param inputStream bundle stream + * @param compressed true if the bundle is gzip compressed * * @return imported repository */ private Repository doImportFromBundle(String type, String name, - InputStream inputStream) + InputStream inputStream, boolean compressed) { SecurityUtils.getSubject().checkRole(Role.ADMIN); @@ -601,7 +609,7 @@ public class RepositoryImportResource logger.info("copied {} bytes to temp, start bundle import", length); service = serviceFactory.create(repository); - service.getUnbundleCommand().unbundle(file); + service.getUnbundleCommand().setCompressed(compressed).unbundle(file); } catch (RepositoryException ex) { diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index a60a93c73d..87a0380503 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -91,6 +91,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { importFileNameHelpText: 'The name of the repository in SCM-Manager.', importFileHelpText: 'Choose the dump file you want to import to SCM-Manager.', + importFileGZipCompressedHelpText: 'The file is gzip compressed.', // tips tipRepositoryType: 'Choose your repository type for the import.', @@ -314,6 +315,11 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { buttonCfg: { iconCls: 'upload-icon' } + },{ + id: 'importFileGZipCompressed', + xtype: 'checkbox', + fieldLabel: 'GZip compressed', + helpText: this.importFileGZipCompressedHelpText },{ xtype: 'scmTip', content: 'Please insert name and upload the repository file.', @@ -479,9 +485,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { }, importFromFile: function(layout, form){ + var compressed = Ext.getCmp('importFileGZipCompressed').getValue(); var lbox = this.showLoadingBox(); form.submit({ - url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html', + url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html?compressed=' + compressed, scope: this, success: function(form){ lbox.hide(); From 33b9d6770c452037dfd8476125a086094b357761 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 11:23:30 +0100 Subject: [PATCH 61/68] added tip for failed import --- .../js/repository/sonia.repository.importwindow.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 87a0380503..d92fc5b3c8 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -126,7 +126,8 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { ' ', ' No repositories to import', ' ', - '

    ' + '

    ', + '
    ' ]), initComponent: function(){ @@ -336,6 +337,12 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { xtype: 'panel', bodyCssClass: 'x-panel-mc', tpl: this.tpl + },{ + id: 'finalTip', + xtype: 'scmTip', + content: 'Please see log for details.', + width: '100%', + hidden: true }] }] }; @@ -480,6 +487,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { } }; var resultPanel = Ext.getCmp('resultPanel'); + Ext.getCmp('finalTip').setVisible(this.failed.length > 0); resultPanel.tpl.overwrite(resultPanel.body, model); layout.setActiveItem(4); }, From 9ffb8f97eaf4fa91fc14755deb488cac40b75da7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 11:33:35 +0100 Subject: [PATCH 62/68] close branch issue-634 From 895af89c127a82e8981c9cb2f21cf1f9e27d6ae0 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 14:45:43 +0100 Subject: [PATCH 63/68] fix wrong changeset count for git push and pull commands --- .../java/sonia/scm/repository/GitUtil.java | 26 +++++++++++ .../spi/AbstractGitPushOrPullCommand.java | 41 ++++++++++-------- .../scm/repository/spi/GitPullCommand.java | 43 +++++++++++-------- 3 files changed, 74 insertions(+), 36 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 6fe3211ca8..8985966220 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 @@ -697,6 +697,32 @@ public final class GitUtil //J+ } + /** + * Method description + * + * + * @param ref + * + * @return + */ + public static boolean isHead(String ref) + { + return ref.startsWith(REF_HEAD_PREFIX); + } + + /** + * Method description + * + * + * @param id + * + * @return + */ + public static boolean isValidObjectId(ObjectId id) + { + return (id != null) &&!id.equals(ObjectId.zeroId()); + } + //~--- methods -------------------------------------------------------------- /** diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java index 04838403f3..764dde47f3 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/AbstractGitPushOrPullCommand.java @@ -49,6 +49,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sonia.scm.repository.GitRepositoryHandler; +import sonia.scm.repository.GitUtil; import sonia.scm.repository.RepositoryException; //~--- JDK imports ------------------------------------------------------------ @@ -253,21 +254,24 @@ public abstract class AbstractGitPushOrPullCommand extends AbstractGitCommand { long counter = 0; - try + if (GitUtil.isHead(update.getRemoteName())) { - org.eclipse.jgit.api.LogCommand log = git.log(); - ObjectId oldId = update.getExpectedOldObjectId(); - - if (oldId != null) + try { - log.not(oldId); - } + org.eclipse.jgit.api.LogCommand log = git.log(); + ObjectId oldId = update.getExpectedOldObjectId(); - ObjectId newId = update.getNewObjectId(); + if (GitUtil.isValidObjectId(oldId)) + { + log.not(oldId); + } - if (newId != null) - { - log.add(newId); + ObjectId newId = update.getNewObjectId(); + + if (GitUtil.isValidObjectId(newId)) + { + log.add(newId); + } Iterable commits = log.call(); @@ -275,16 +279,17 @@ public abstract class AbstractGitPushOrPullCommand extends AbstractGitCommand { counter += Iterables.size(commits); } - } - else - { - logger.warn("update without new object id"); - } + logger.trace("counting {} commits for ref update {}", counter, update); + } + catch (Exception ex) + { + logger.error("could not count pushed/pulled changesets", ex); + } } - catch (Exception ex) + else { - logger.error("could not count pushed/pulled changesets", ex); + logger.debug("do not count non branch ref update {}", update); } return counter; diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java index 0c4795c619..ec0f468a57 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitPullCommand.java @@ -152,6 +152,8 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand counter += count(git, tru); } + logger.debug("received {} changesets by pull", counter); + return new PullResponse(counter); } @@ -168,21 +170,25 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand { long counter = 0; - try + if (GitUtil.isHead(tru.getLocalName())) { - org.eclipse.jgit.api.LogCommand log = git.log(); - ObjectId oldId = tru.getOldObjectId(); - - if (oldId != null) + try { - log.not(oldId); - } + org.eclipse.jgit.api.LogCommand log = git.log(); - ObjectId newId = tru.getNewObjectId(); + ObjectId oldId = tru.getOldObjectId(); - if (newId != null) - { - log.add(newId); + if (GitUtil.isValidObjectId(oldId)) + { + log.not(oldId); + } + + ObjectId newId = tru.getNewObjectId(); + + if (GitUtil.isValidObjectId(newId)) + { + log.add(newId); + } Iterable commits = log.call(); @@ -190,16 +196,17 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand { counter += Iterables.size(commits); } - } - else - { - logger.warn("update without new object id"); - } + logger.trace("counting {} commits for ref update {}", counter, tru); + } + catch (Exception ex) + { + logger.error("could not count pushed/pulled changesets", ex); + } } - catch (Exception ex) + else { - logger.error("could not count pushed/pulled changesets", ex); + logger.debug("do not count non branch ref update {}", tru); } return counter; From f8d3b8cbfd9a8815dc71de84e745098bb4b835b6 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 15:19:39 +0100 Subject: [PATCH 64/68] increase timeout for url and file upload --- .../resources/js/repository/sonia.repository.importwindow.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index d92fc5b3c8..31246c14a1 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -497,6 +497,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { var lbox = this.showLoadingBox(); form.submit({ url: restUrl + 'import/repositories/' + this.repositoryType + '/bundle.html?compressed=' + compressed, + timeout: 300000, // 5min scope: this, success: function(form){ lbox.hide(); @@ -515,6 +516,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { url: restUrl + 'import/repositories/' + this.repositoryType + '/url.json', method: 'POST', scope: this, + timeout: 300000, // 5min jsonData: repository, success: function(){ lbox.hide(); From b9af0d272e971640a42d3ea199c12af290872749 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 15:28:04 +0100 Subject: [PATCH 65/68] fix upload button on firefox --- .../resources/js/repository/sonia.repository.importwindow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 31246c14a1..84e2b4009f 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -310,6 +310,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, { fieldLabel: 'Import File', ctCls: 'import-fu', name: 'bundle', + buttonText: '', allowBlank: false, helpText: this.importFileHelpText, cls: 'import-fu', From 65ba3bdbdd971fb17b67e1d9dcbea2e5460eb425 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 15:42:51 +0100 Subject: [PATCH 66/68] [maven-release-plugin] prepare release 1.43 --- 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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index 473d1bc51a..3fd0497547 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm.maven scm-maven-plugins pom - 1.43-SNAPSHOT + 1.43 scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index 839090e2c5..f63557e5c7 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.43-SNAPSHOT + 1.43 sonia.scm.maven scm-maven-plugin - 1.43-SNAPSHOT + 1.43 maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index e27acf929e..2abfdee05a 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.43-SNAPSHOT + 1.43 sonia.scm.maven scm-plugin-archetype - 1.43-SNAPSHOT + 1.43 scm-plugin-archetype diff --git a/pom.xml b/pom.xml index c879a04202..2b819900c6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.43-SNAPSHOT + 1.43 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.43 diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 87234b5cab..6afce3ded3 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm.clients scm-clients pom - 1.43-SNAPSHOT + 1.43 scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.43-SNAPSHOT + 1.43 shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index 231ee856d6..d4146044bb 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.43-SNAPSHOT + 1.43 sonia.scm.clients scm-cli-client - 1.43-SNAPSHOT + 1.43 scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.43-SNAPSHOT + 1.43 diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 0a024a8802..70914f26c1 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.43-SNAPSHOT + 1.43 sonia.scm.clients scm-client-api jar - 1.43-SNAPSHOT + 1.43 scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 5217a39b54..3a2f35da5c 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.43-SNAPSHOT + 1.43 sonia.scm.clients scm-client-impl jar - 1.43-SNAPSHOT + 1.43 scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.43-SNAPSHOT + 1.43 @@ -70,7 +70,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index 9850e1d7f4..20dd7156a7 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 16b9f72d86..47791907b4 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-dao-orientdb - 1.43-SNAPSHOT + 1.43 scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index 04506fca8c..e2dfc588dd 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-dao-xml - 1.43-SNAPSHOT + 1.43 scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index 832ab5f679..ffa3989be6 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-plugin-backend war - 1.43-SNAPSHOT + 1.43 ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index 100a14e44b..5f34552205 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-plugins pom - 1.43-SNAPSHOT + 1.43 scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.43-SNAPSHOT + 1.43 process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 4238206529..2a4059320d 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.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-git-plugin - 1.43-SNAPSHOT + 1.43 scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 699bc2f6a8..6313583484 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.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-hg-plugin - 1.43-SNAPSHOT + 1.43 scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -42,7 +42,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index d7069097d2..ca9adde00b 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.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-svn-plugin - 1.43-SNAPSHOT + 1.43 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.43-SNAPSHOT + 1.43 test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 842b0292dd..66ba1c35f7 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm.samples scm-samples pom - 1.43-SNAPSHOT + 1.43 scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 49b2e13326..7aac871ac7 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.43-SNAPSHOT + 1.43 sonia.scm.sample scm-sample-auth - 1.43-SNAPSHOT + 1.43 scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 715210f5bd..3e2b289f1a 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.43-SNAPSHOT + 1.43 sonia.scm.sample scm-sample-hello - 1.43-SNAPSHOT + 1.43 scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 389a96db33..016a301cf5 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-server - 1.43-SNAPSHOT + 1.43 scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index 8e3cb9edc9..ce45172921 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index b230c7cb7e..b54cde252d 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm scm-webapp war - 1.43-SNAPSHOT + 1.43 scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 sonia.scm scm-dao-xml - 1.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-hg-plugin - 1.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-svn-plugin - 1.43-SNAPSHOT + 1.43 sonia.scm.plugins scm-git-plugin - 1.43-SNAPSHOT + 1.43 @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.43-SNAPSHOT + 1.43 test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.43-SNAPSHOT + 1.43 tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.43-SNAPSHOT + 1.43 tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.43-SNAPSHOT + 1.43 tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.43-SNAPSHOT + 1.43 diff --git a/support/pom.xml b/support/pom.xml index 8e7e484492..fe0d2a1ec8 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43-SNAPSHOT + 1.43 sonia.scm.support scm-support pom - 1.43-SNAPSHOT + 1.43 scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index 4d8e6bf772..471ff89177 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.43-SNAPSHOT + 1.43 sonia.scm scm-support-btrace - 1.43-SNAPSHOT + 1.43 jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.43-SNAPSHOT + 1.43 From b403864a2717dccdcfd45f558b1f6b679a80bc87 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 15:42:51 +0100 Subject: [PATCH 67/68] [maven-release-plugin] copy for tag 1.43 From 120fe9a5a4b08305be276c100ff3e2aff8fde268 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 1 Dec 2014 15:42:53 +0100 Subject: [PATCH 68/68] [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 | 6 +++--- scm-clients/scm-client-api/pom.xml | 4 ++-- scm-clients/scm-client-impl/pom.xml | 8 ++++---- 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 | 24 ++++++++++++------------ support/pom.xml | 4 ++-- support/scm-support-btrace/pom.xml | 6 +++--- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/maven/pom.xml b/maven/pom.xml index 3fd0497547..3520448e40 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm.maven scm-maven-plugins pom - 1.43 + 1.44-SNAPSHOT scm-maven-plugins diff --git a/maven/scm-maven-plugin/pom.xml b/maven/scm-maven-plugin/pom.xml index f63557e5c7..c66a350089 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.43 + 1.44-SNAPSHOT sonia.scm.maven scm-maven-plugin - 1.43 + 1.44-SNAPSHOT maven-plugin scm-maven-plugin diff --git a/maven/scm-plugin-archetype/pom.xml b/maven/scm-plugin-archetype/pom.xml index 2abfdee05a..451f9073c8 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.43 + 1.44-SNAPSHOT sonia.scm.maven scm-plugin-archetype - 1.43 + 1.44-SNAPSHOT scm-plugin-archetype diff --git a/pom.xml b/pom.xml index 2b819900c6..d182d59185 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sonia.scm scm pom - 1.43 + 1.44-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.43 + HEAD diff --git a/scm-clients/pom.xml b/scm-clients/pom.xml index 6afce3ded3..69c0aa44fc 100644 --- a/scm-clients/pom.xml +++ b/scm-clients/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm.clients scm-clients pom - 1.43 + 1.44-SNAPSHOT scm-clients @@ -32,7 +32,7 @@ scm-core sonia.scm jar - 1.43 + 1.44-SNAPSHOT shiro-core diff --git a/scm-clients/scm-cli-client/pom.xml b/scm-clients/scm-cli-client/pom.xml index d4146044bb..5b76977406 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.43 + 1.44-SNAPSHOT sonia.scm.clients scm-cli-client - 1.43 + 1.44-SNAPSHOT scm-cli-client @@ -34,7 +34,7 @@ sonia.scm.clients scm-client-impl - 1.43 + 1.44-SNAPSHOT diff --git a/scm-clients/scm-client-api/pom.xml b/scm-clients/scm-client-api/pom.xml index 70914f26c1..d610d57455 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.43 + 1.44-SNAPSHOT sonia.scm.clients scm-client-api jar - 1.43 + 1.44-SNAPSHOT scm-client-api diff --git a/scm-clients/scm-client-impl/pom.xml b/scm-clients/scm-client-impl/pom.xml index 3a2f35da5c..b0a640fd93 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.43 + 1.44-SNAPSHOT sonia.scm.clients scm-client-impl jar - 1.43 + 1.44-SNAPSHOT scm-client-impl @@ -36,7 +36,7 @@ sonia.scm.clients scm-client-api - 1.43 + 1.44-SNAPSHOT @@ -70,7 +70,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test diff --git a/scm-core/pom.xml b/scm-core/pom.xml index 20dd7156a7..a12f622f03 100644 --- a/scm-core/pom.xml +++ b/scm-core/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT scm-core diff --git a/scm-dao-orientdb/pom.xml b/scm-dao-orientdb/pom.xml index 47791907b4..8a914f3f23 100644 --- a/scm-dao-orientdb/pom.xml +++ b/scm-dao-orientdb/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-dao-orientdb - 1.43 + 1.44-SNAPSHOT scm-dao-orientdb @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT @@ -52,7 +52,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test diff --git a/scm-dao-xml/pom.xml b/scm-dao-xml/pom.xml index e2dfc588dd..7ecb0321d0 100644 --- a/scm-dao-xml/pom.xml +++ b/scm-dao-xml/pom.xml @@ -6,12 +6,12 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-dao-xml - 1.43 + 1.44-SNAPSHOT scm-dao-xml @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT @@ -34,7 +34,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml index ffa3989be6..b953853a5a 100644 --- a/scm-plugin-backend/pom.xml +++ b/scm-plugin-backend/pom.xml @@ -6,13 +6,13 @@ scm sonia.scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-plugin-backend war - 1.43 + 1.44-SNAPSHOT ${project.artifactId} @@ -62,7 +62,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT diff --git a/scm-plugins/pom.xml b/scm-plugins/pom.xml index 5f34552205..f8a7a3c7fa 100644 --- a/scm-plugins/pom.xml +++ b/scm-plugins/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-plugins pom - 1.43 + 1.44-SNAPSHOT scm-plugins @@ -26,7 +26,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT @@ -59,7 +59,7 @@ sonia.scm.maven scm-maven-plugin - 1.43 + 1.44-SNAPSHOT process-resources diff --git a/scm-plugins/scm-git-plugin/pom.xml b/scm-plugins/scm-git-plugin/pom.xml index 2a4059320d..705ce0c80b 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.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.43 + 1.44-SNAPSHOT scm-git-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Git @@ -48,7 +48,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test diff --git a/scm-plugins/scm-hg-plugin/pom.xml b/scm-plugins/scm-hg-plugin/pom.xml index 6313583484..59d8bc0409 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.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.43 + 1.44-SNAPSHOT scm-hg-plugin https://bitbucket.org/sdorra/scm-manager Plugin for the version control system Mercurial @@ -42,7 +42,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml index ca9adde00b..60a5320020 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.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.43 + 1.44-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.43 + 1.44-SNAPSHOT test diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml index 66ba1c35f7..16dd38de33 100644 --- a/scm-samples/pom.xml +++ b/scm-samples/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm.samples scm-samples pom - 1.43 + 1.44-SNAPSHOT scm-samples diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml index 7aac871ac7..d2464d632e 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.43 + 1.44-SNAPSHOT sonia.scm.sample scm-sample-auth - 1.43 + 1.44-SNAPSHOT scm-sample-auth Sample Authentication Plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml index 3e2b289f1a..9de39341be 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.43 + 1.44-SNAPSHOT sonia.scm.sample scm-sample-hello - 1.43 + 1.44-SNAPSHOT scm-sample-hello A simple hello world plugin https://bitbucket.org/sdorra/scm-manager @@ -28,7 +28,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT diff --git a/scm-server/pom.xml b/scm-server/pom.xml index 016a301cf5..aea132f962 100644 --- a/scm-server/pom.xml +++ b/scm-server/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-server - 1.43 + 1.44-SNAPSHOT scm-server jar diff --git a/scm-test/pom.xml b/scm-test/pom.xml index ce45172921..2d90b3b830 100644 --- a/scm-test/pom.xml +++ b/scm-test/pom.xml @@ -6,12 +6,12 @@ scm sonia.scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT scm-test @@ -25,7 +25,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml index b54cde252d..2b5afe1548 100644 --- a/scm-webapp/pom.xml +++ b/scm-webapp/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm scm-webapp war - 1.43 + 1.44-SNAPSHOT scm-webapp @@ -38,31 +38,31 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT sonia.scm scm-dao-xml - 1.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-hg-plugin - 1.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-svn-plugin - 1.43 + 1.44-SNAPSHOT sonia.scm.plugins scm-git-plugin - 1.43 + 1.44-SNAPSHOT @@ -280,7 +280,7 @@ sonia.scm scm-test - 1.43 + 1.44-SNAPSHOT test @@ -293,7 +293,7 @@ sonia.scm.plugins scm-git-plugin - 1.43 + 1.44-SNAPSHOT tests test @@ -301,7 +301,7 @@ sonia.scm.plugins scm-hg-plugin - 1.43 + 1.44-SNAPSHOT tests test @@ -309,7 +309,7 @@ sonia.scm.plugins scm-svn-plugin - 1.43 + 1.44-SNAPSHOT tests test @@ -535,7 +535,7 @@ sonia.scm scm-dao-orientdb - 1.43 + 1.44-SNAPSHOT diff --git a/support/pom.xml b/support/pom.xml index fe0d2a1ec8..3b85b68513 100644 --- a/support/pom.xml +++ b/support/pom.xml @@ -6,13 +6,13 @@ sonia.scm scm - 1.43 + 1.44-SNAPSHOT sonia.scm.support scm-support pom - 1.43 + 1.44-SNAPSHOT scm-support diff --git a/support/scm-support-btrace/pom.xml b/support/scm-support-btrace/pom.xml index 471ff89177..3aca5ee6b7 100644 --- a/support/scm-support-btrace/pom.xml +++ b/support/scm-support-btrace/pom.xml @@ -4,12 +4,12 @@ sonia.scm.support scm-support - 1.43 + 1.44-SNAPSHOT sonia.scm scm-support-btrace - 1.43 + 1.44-SNAPSHOT jar scm-support-btrace @@ -18,7 +18,7 @@ sonia.scm scm-core - 1.43 + 1.44-SNAPSHOT