improve svn compatibility modus

This commit is contained in:
Sebastian Sdorra
2011-04-29 14:47:38 +02:00
parent db5cbeae04
commit 2a5fbeddf0
4 changed files with 143 additions and 77 deletions

View File

@@ -0,0 +1,105 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository;
/**
*
* @author Sebastian Sdorra
*/
public enum Compatibility
{
NONE(false, false, false), PRE14(true, true, true), PRE15(false, true, true),
PRE16(false, false, true);
/**
* Field description
*
* @param pre14Compatible
* @param pre15Compatible
* @param pre16Compatible
*/
private Compatibility(boolean pre14Compatible, boolean pre15Compatible,
boolean pre16Compatible)
{
this.pre14Compatible = pre14Compatible;
this.pre15Compatible = pre15Compatible;
this.pre16Compatible = pre16Compatible;
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
public boolean isPre14Compatible()
{
return pre14Compatible;
}
/**
* Method description
*
*
* @return
*/
public boolean isPre15Compatible()
{
return pre15Compatible;
}
/**
* Method description
*
*
* @return
*/
public boolean isPre16Compatible()
{
return pre16Compatible;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private boolean pre14Compatible;
/** Field description */
private boolean pre15Compatible;
/** Field description */
private boolean pre16Compatible;
}

View File

@@ -51,31 +51,14 @@ public class SvnConfig extends SimpleRepositoryConfig
* *
* @return * @return
*/ */
public boolean isPre14Compatible() public Compatibility getCompatibility()
{ {
return pre14Compatible; if (compatibility == null)
{
compatibility = Compatibility.NONE;
} }
/** return compatibility;
* Method description
*
*
* @return
*/
public boolean isPre15Compatible()
{
return pre15Compatible;
}
/**
* Method description
*
*
* @return
*/
public boolean isPre16Compatible()
{
return pre16Compatible;
} }
//~--- set methods ---------------------------------------------------------- //~--- set methods ----------------------------------------------------------
@@ -84,43 +67,15 @@ public class SvnConfig extends SimpleRepositoryConfig
* Method description * Method description
* *
* *
* @param pre14Compatible * @param compatibility
*/ */
public void setPre14Compatible(boolean pre14Compatible) public void setCompatibility(Compatibility compatibility)
{ {
this.pre14Compatible = pre14Compatible; this.compatibility = compatibility;
}
/**
* Method description
*
*
* @param pre15Compatible
*/
public void setPre15Compatible(boolean pre15Compatible)
{
this.pre15Compatible = pre15Compatible;
}
/**
* Method description
*
*
* @param pre16Compatible
*/
public void setPre16Compatible(boolean pre16Compatible)
{
this.pre16Compatible = pre16Compatible;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** Field description */
private boolean pre14Compatible = false; private Compatibility compatibility = Compatibility.NONE;
/** Field description */
private boolean pre15Compatible = false;
/** Field description */
private boolean pre16Compatible = false;
} }

View File

@@ -154,22 +154,24 @@ public class SvnRepositoryHandler
protected void create(Repository repository, File directory) protected void create(Repository repository, File directory)
throws RepositoryException, IOException throws RepositoryException, IOException
{ {
Compatibility comp = config.getCompatibility();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder log = new StringBuilder("create svn repository \""); StringBuilder log = new StringBuilder("create svn repository \"");
log.append(directory.getName()).append("\": pre14Compatible="); log.append(directory.getName()).append("\": pre14Compatible=");
log.append(config.isPre14Compatible()).append(", pre15Compatible="); log.append(comp.isPre14Compatible()).append(", pre15Compatible=");
log.append(config.isPre15Compatible()).append(", pre16Compatible="); log.append(comp.isPre15Compatible()).append(", pre16Compatible=");
log.append(config.isPre16Compatible()); log.append(comp.isPre16Compatible());
logger.debug(log.toString()); logger.debug(log.toString());
} }
try try
{ {
SVNRepositoryFactory.createLocalRepository(directory, null, true, false, SVNRepositoryFactory.createLocalRepository(directory, null, true, false,
config.isPre14Compatible(), config.isPre15Compatible(), comp.isPre14Compatible(), comp.isPre15Compatible(),
config.isPre16Compatible()); comp.isPre16Compatible());
} }
catch (SVNException ex) catch (SVNException ex)
{ {

View File

@@ -37,6 +37,7 @@ Sonia.svn.ConfigPanel = Ext.extend(Sonia.config.SimpleConfigForm, {
titleText: 'Subversion Settings', titleText: 'Subversion Settings',
repositoryDirectoryText: 'Repository directory', repositoryDirectoryText: 'Repository directory',
// TODO i18n // TODO i18n
noneCompatibility: 'No compatibility modus',
pre14CompatibleText: 'Pre 1.4 Compatible', pre14CompatibleText: 'Pre 1.4 Compatible',
pre15CompatibleText: 'Pre 1.5 Compatible', pre15CompatibleText: 'Pre 1.5 Compatible',
pre16CompatibleText: 'Pre 1.6 Compatible', pre16CompatibleText: 'Pre 1.6 Compatible',
@@ -60,23 +61,26 @@ Sonia.svn.ConfigPanel = Ext.extend(Sonia.config.SimpleConfigForm, {
helpText: this.repositoryDirectoryHelpText, helpText: this.repositoryDirectoryHelpText,
allowBlank : false allowBlank : false
},{ },{
xtype: 'checkbox', xtype: 'radiogroup',
name: 'pre14Compatible', name: 'compatibility',
fieldLabel: this.pre14CompatibleText, columns: 1,
helpText: this.pre14CompatibleHelpText, items: [{
inputValue: 'true' boxLabel: this.noneCompatibility,
inputValue: 'NONE',
name: 'compatibility'
},{ },{
xtype: 'checkbox', boxLabel: this.pre14CompatibleText,
name: 'pre15Compatible', inputValue: 'PRE14',
fieldLabel: this.pre15CompatibleText, name: 'compatibility'
helpText: this.pre15CompatibleHelpText,
inputValue: 'true'
},{ },{
xtype: 'checkbox', boxLabel: this.pre15CompatibleText,
name: 'pre16Compatible', inputValue: 'PRE15',
fieldLabel: this.pre16CompatibleText, name: 'compatibility'
helpText: this.pre16CompatibleHelpText, },{
inputValue: 'true' boxLabel: this.pre16CompatibleText,
inputValue: 'PRE16',
name: 'compatibility'
}]
}] }]
} }