Giter VIP home page Giter VIP logo

subversion's Introduction

Shadowhunt Subversion Library

The Shadowhunt Subversion library provides a simple JAVA interface to Subversion servers through http or https interface. It doesn't rely on the subversion command-line client.

The main purpose of this library is to access and manipulate a subversion repository without having to checkout the repository to the local system first. Its API is based on the command-lines client.

Usage

File file = new File("/tmp/coverage_report.txt");

CredentialsProvider cp = new BasicCredentialsProvider();
Credentials credentials = new UsernamePasswordCredentials("svnuser", "secret");
cp.setCredentials(AuthScope.ANY, credentials);

HttpContext context = new BasicHttpContext();

HttpClientBuilder httpBuilder = HttpClientBuilder.create();
httpBuilder.setDefaultCredentialsProvider(cp);
httpBuilder.setRetryHandler(new SubversionRequestRetryHandler());

URIBuilder uriBuilder = new URIBuilder();
URI uri = uriBuilder //
   .setScheme("https") //
   .setHost("subversion.example.net") //
   .setPath("/repository/test") //
   .build();

RepositoryFactory factory = RepositoryFactory.getInstance();

try (ClosableHttpClient client = httpBuilder.build()) {
   Repository repository = factory.createRepository(uri, client, context, true);

   Transaction transaction = repository.createTransaction();
   try (InputStream input = new FileInputStream(file)) {
       repository.add(transaction, Resource.create("/release/test_report.txt"), true, input);
       repository.commit(transaction, "upload new test report");
   } finally {
       repository.rollbackIfNotCommitted(transaction);
   }
}

The full documentation is located at https://dev.shadowhunt.de/subversion/

# to start a test environment via docker
docker run                                      \
    --init                                      \
    --read-only                                 \
    --rm=true                                   \
    --mount type=tmpfs,destination=/tmp         \
    --mount type=tmpfs,destination=/var/run     \
    --mount type=tmpfs,destination=/var/www/svn \
    shadowhunt/subversion:<VERSION>

Starting with version 4.0.0, a command line mode is included, which allows you to execute various commands against a Subversion server without having the Subverion client tools installed on the machine or a local copy checked out.

# listing all available commands
java -jar subversion-jar-with-dependencies.jar help

# to get a list of all parameters for a command
java -jar subversion-jar-with-dependencies.jar <COMMAND> --help

# example checkin
java -jar subversion-jar-with-dependencies.jar checkin    \
    --base=https://subversion.example.net/repository/test \
    --username=svnuser                                    \
    --password=secret                                     \
    --parents                                             \
    --resource=/release/test_report.txt                   \
    --message="upload new test report"                    \
    --input=/tmp/coverage_report.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.