org.kuali.common.util.service.SvnService Maven / Gradle / Ivy
/**
* Copyright 2010-2014 The Kuali Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.common.util.service;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.kuali.common.util.Assert;
import org.kuali.common.util.CollectionUtils;
import org.kuali.common.util.LocationUtils;
/**
* @deprecated
*/
@Deprecated
public class SvnService extends DefaultExecService implements ScmService {
private static final String SVN = "svn";
@Override
public void version() {
executeAndValidate(SVN, Arrays.asList("--version"));
}
@Override
public void add(List paths) {
if (CollectionUtils.isEmpty(paths)) {
// Nothing to do
return;
}
String command = "add";
List cpaths = LocationUtils.getCanonicalPaths(paths);
List options = Arrays.asList("--force", "--parents", "--depth", "infinity");
List arguments = new ArrayList();
arguments.add(command);
arguments.addAll(cpaths);
arguments.addAll(options);
executeAndValidate(SVN, arguments);
}
@Override
public void delete(List paths) {
if (CollectionUtils.isEmpty(paths)) {
// Nothing to do
return;
}
String command = "delete";
List cpaths = LocationUtils.getCanonicalPaths(paths);
List options = Arrays.asList("--force");
List arguments = new ArrayList();
arguments.add(command);
arguments.addAll(cpaths);
arguments.addAll(options);
executeAndValidate(SVN, arguments);
}
@Override
public void commit(List paths, String message) {
if (CollectionUtils.isEmpty(paths)) {
// Nothing to do
return;
}
Assert.notBlank(message, "Commit message is blank");
String command = "commit";
List cpaths = LocationUtils.getCanonicalPaths(paths);
List options = Arrays.asList("--depth", "infinity", "--message", message);
List arguments = new ArrayList();
arguments.add(command);
arguments.addAll(cpaths);
arguments.addAll(options);
executeAndValidate(SVN, arguments);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy