remove deprecated stuff

This commit is contained in:
Sebastian Sdorra
2014-01-03 10:34:34 +01:00
parent 39ad99f5e9
commit aec7773239
82 changed files with 168 additions and 10455 deletions

View File

@@ -1,108 +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;
//~--- non-JDK imports --------------------------------------------------------
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.util.AssertUtil;
import sonia.scm.web.HgUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.Map;
/**
*
* @author Sebastian Sdorra
*/
public class HgBlameViewer extends AbstractHgHandler implements BlameViewer
{
/** the logger for HgBlameViewer */
private static final Logger logger =
LoggerFactory.getLogger(HgBlameViewer.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*
* @param handler
* @param context
* @param repository
* @param blameResultContext
*/
public HgBlameViewer(HgRepositoryHandler handler, HgContext context,
Repository repository)
{
super(handler, context, repository);
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param revision
* @param path
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public BlameResult getBlame(String revision, String path)
throws IOException, RepositoryException
{
AssertUtil.assertIsNotEmpty(path);
if (logger.isDebugEnabled())
{
logger.debug("get blame result for {} at revision {}", path,
HgUtil.getRevision(revision));
}
Map<String, String> env = createEnvironment(revision, path);
return getResultFromScript(BlameResult.class, HgPythonScript.BLAME, env);
}
}

View File

@@ -1,244 +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;
//~--- non-JDK imports --------------------------------------------------------
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.util.Util;
import sonia.scm.web.HgUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBContext;
/**
*
* @author Sebastian Sdorra
*/
public class HgChangesetViewer extends AbstractHgHandler
implements ChangesetViewer
{
/** the logger for HgChangesetViewer */
private static final Logger logger =
LoggerFactory.getLogger(HgChangesetViewer.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*
* @param handler
* @param jaxbContext
* @param context
* @param repositoryDirectory
*/
public HgChangesetViewer(HgRepositoryHandler handler, HgContext context,
File repositoryDirectory)
{
super(handler, context, null, repositoryDirectory);
}
/**
* Constructs ...
*
*
*
* @param handler
* @param jaxbContext
* @param context
* @param repository
*/
public HgChangesetViewer(HgRepositoryHandler handler,
JAXBContext jaxbContext, HgContext context,
Repository repository)
{
super(handler, context, repository);
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param revision
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public Changeset getChangeset(String revision)
throws IOException, RepositoryException
{
Map<String, String> env = new HashMap<String, String>();
env.put(ENV_REVISION, HgUtil.getRevision(revision));
env.put(ENV_PATH, Util.EMPTY_STRING);
env.put(ENV_PAGE_START, Util.EMPTY_STRING);
env.put(ENV_PAGE_LIMIT, Util.EMPTY_STRING);
env.put(ENV_REVISION_START, Util.EMPTY_STRING);
env.put(ENV_REVISION_END, Util.EMPTY_STRING);
return getResultFromScript(Changeset.class, HgPythonScript.CHANGELOG, env);
}
/**
*
*
* @param start
* @param max
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public ChangesetPagingResult getChangesets(int start, int max)
throws IOException, RepositoryException
{
if (logger.isDebugEnabled())
{
logger.debug("fetch changesets. start: {}, max: {}", start, max);
}
return getChangesets(null, null, String.valueOf(start),
String.valueOf(max), null, null);
}
/**
* Method description
*
*
* @param path
* @param revision
* @param start
* @param max
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public ChangesetPagingResult getChangesets(String path, String revision,
int start, int max)
throws IOException, RepositoryException
{
revision = HgUtil.getRevision(revision);
if (logger.isDebugEnabled())
{
logger.debug(
"fetch changesets for path {} and revision {}. start: {}, max: {}",
new Object[] { path,
revision, start, max });
}
return getChangesets(path, revision, String.valueOf(start),
String.valueOf(max), null, null);
}
/**
* Method description
*
*
*
* @param path
* @param revision
* @param pageStart
* @param pageLimit
* @param revisionStart
* @param revisionEnd
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getChangesets(String path, String revision,
String pageStart, String pageLimit, String revisionStart,
String revisionEnd)
throws IOException, RepositoryException
{
Map<String, String> env = new HashMap<String, String>();
env.put(ENV_PATH, Util.nonNull(path));
env.put(ENV_REVISION, Util.nonNull(revision));
env.put(ENV_PAGE_START, Util.nonNull(pageStart));
env.put(ENV_PAGE_LIMIT, Util.nonNull(pageLimit));
env.put(ENV_REVISION_START, Util.nonNull(revisionStart));
env.put(ENV_REVISION_END, Util.nonNull(revisionEnd));
return getResultFromScript(ChangesetPagingResult.class,
HgPythonScript.CHANGELOG, env);
}
/**
* Method description
*
*
* @param startNode
* @param endNode
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getChangesets(String startNode, String endNode)
throws IOException, RepositoryException
{
if (logger.isDebugEnabled())
{
logger.debug("fetch changesets. start-node: {}, end-node: {}", startNode,
endNode);
}
return getChangesets(null, null, null, null, startNode, endNode);
}
}

View File

@@ -1,103 +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;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.AssertUtil;
import sonia.scm.util.IOUtil;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
*
* @author Sebastian Sdorra
*/
public class HgDiffViewer extends AbstractHgHandler implements DiffViewer
{
/**
* Constructs ...
*
*
* @param handler
* @param context
* @param repository
*/
public HgDiffViewer(HgRepositoryHandler handler, HgContext context,
Repository repository)
{
super(handler, context, repository);
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param revision
* @param path
* @param output
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public void getDiff(String revision, String path, OutputStream output)
throws IOException, RepositoryException
{
AssertUtil.assertIsNotEmpty(revision);
AssertUtil.assertIsNotNull(output);
Process p = createHgProcess("diff", "-c", revision, Util.nonNull(path));
InputStream input = null;
try
{
handleErrorStream(p.getErrorStream());
input = p.getInputStream();
IOUtil.copy(input, output);
}
finally
{
IOUtil.close(input);
}
}
}

View File

@@ -1,129 +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;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.IOUtil;
import sonia.scm.util.Util;
import sonia.scm.web.HgUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
/**
*
* @author Sebastian Sdorra
*/
public class HgRepositoryBrowser extends AbstractHgHandler
implements RepositoryBrowser
{
/**
* Constructs ...
*
*
* @param handler
* @param context
* @param repository
* @param browserResultContext
*/
public HgRepositoryBrowser(HgRepositoryHandler handler, HgContext context,
Repository repository)
{
super(handler, context, repository);
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param revision
* @param path
* @param output
*
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public void getContent(String revision, String path, OutputStream output)
throws IOException, RepositoryException
{
revision = HgUtil.getRevision(revision);
Process p = createHgProcess("cat", "-r", revision, Util.nonNull(path));
InputStream input = null;
try
{
handleErrorStream(p.getErrorStream());
input = p.getInputStream();
IOUtil.copy(input, output);
}
finally
{
IOUtil.close(input);
}
}
/**
* Method description
*
*
* @param revision
* @param path
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@Override
public BrowserResult getResult(String revision, String path)
throws IOException, RepositoryException
{
Map<String, String> env = createEnvironment(revision, path);
return getResultFromScript(BrowserResult.class, HgPythonScript.FILELOG,
env);
}
}

View File

@@ -212,104 +212,6 @@ public class HgRepositoryHandler
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param repository
*
* @return
*/
@Override
public BlameViewer getBlameViewer(Repository repository)
{
BlameViewer blameViewer = null;
AssertUtil.assertIsNotNull(repository);
String type = repository.getType();
AssertUtil.assertIsNotEmpty(type);
if (TYPE_NAME.equals(type))
{
blameViewer = new HgBlameViewer(this, hgContextProvider.get(),
repository);
}
else
{
throw new IllegalArgumentException("mercurial repository is required");
}
return blameViewer;
}
/**
* Method description
*
*
* @param repository
*
* @return
*/
@Override
public ChangesetViewer getChangesetViewer(Repository repository)
{
HgChangesetViewer changesetViewer = null;
AssertUtil.assertIsNotNull(repository);
String type = repository.getType();
AssertUtil.assertIsNotEmpty(type);
if (TYPE_NAME.equals(type))
{
changesetViewer = new HgChangesetViewer(this, jaxbContext,
hgContextProvider.get(), repository);
}
else
{
throw new IllegalArgumentException("mercurial repository is required");
}
return changesetViewer;
}
/**
* Method description
*
*
* @param repository
*
* @return
*
* @throws RepositoryException
*/
@Override
public DiffViewer getDiffViewer(Repository repository)
throws RepositoryException
{
DiffViewer diffViewer = null;
AssertUtil.assertIsNotNull(repository);
String type = repository.getType();
AssertUtil.assertIsNotEmpty(type);
if (TYPE_NAME.equals(type))
{
diffViewer = new HgDiffViewer(this, hgContextProvider.get(), repository);
}
else
{
throw new IllegalArgumentException("mercurial repository is required");
}
return diffViewer;
}
/**
* Method description
*
@@ -351,20 +253,6 @@ public class HgRepositoryHandler
return jaxbContext;
}
/**
* Method description
*
*
* @param repository
*
* @return
*/
@Override
public RepositoryBrowser getRepositoryBrowser(Repository repository)
{
return new HgRepositoryBrowser(this, hgContextProvider.get(), repository);
}
/**
* Method description
*
@@ -481,44 +369,6 @@ public class HgRepositoryHandler
return write;
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param repositoryDirectory
*
* @return
*/
HgChangesetViewer getChangesetViewer(File repositoryDirectory)
{
return getChangesetViewer(repositoryDirectory, hgContextProvider.get());
}
/**
* Method description
*
*
* @param repositoryDirectory
* @param context
*
* @return
*/
HgChangesetViewer getChangesetViewer(File repositoryDirectory,
HgContext context)
{
AssertUtil.assertIsNotNull(repositoryDirectory);
AssertUtil.assertIsNotNull(context);
if (!repositoryDirectory.isDirectory())
{
throw new IllegalStateException("directory not found");
}
return new HgChangesetViewer(this, context, repositoryDirectory);
}
//~--- set methods ----------------------------------------------------------
/**
@@ -810,7 +660,7 @@ public class HgRepositoryHandler
//~--- fields ---------------------------------------------------------------
/** Field description */
private Provider<HgContext> hgContextProvider;
private final Provider<HgContext> hgContextProvider;
/** Field description */
private JAXBContext jaxbContext;