Search in sources :

Example 41 with SVNException

use of org.tmatesoft.svn.core.SVNException in project Gargoyle by callakrsos.

the class SVNLog method logFileSystem.

/********************************
	 * 작성일 : 2016. 7. 13. 작성자 : KYJ
	 *
	 *
	 * @param path
	 * @param startRevision
	 * @param endDate
	 * @param exceptionHandler
	 * @return
	 ********************************/
public List<SVNLogEntry> logFileSystem(File[] path, long startRevision, Date endDate, Consumer<Exception> exceptionHandler) {
    SVNLogClient logClient = getSvnManager().getLogClient();
    List<SVNLogEntry> result = new ArrayList<>();
    try {
        ISVNLogEntryHandler handler = logEntry -> {
            LOGGER.debug("path :: {}  rivision :: {} date :: {} author :: {} message :: {} ", path, logEntry.getRevision(), logEntry.getDate(), logEntry.getAuthor(), logEntry.getMessage());
            result.add(logEntry);
        };
        doLog(path, startRevision, endDate, logClient, handler);
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
        if (exceptionHandler != null)
            exceptionHandler.accept(e);
    }
    return result;
}
Also used : ILogCommand(com.kyj.scm.manager.core.commons.ILogCommand) Properties(java.util.Properties) Logger(org.slf4j.Logger) URLDecoder(java.net.URLDecoder) SVNException(org.tmatesoft.svn.core.SVNException) Date(java.util.Date) Collection(java.util.Collection) LoggerFactory(org.slf4j.LoggerFactory) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) File(java.io.File) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) SVNLogClient(org.tmatesoft.svn.core.wc.SVNLogClient) List(java.util.List) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) ISVNLogEntryHandler(org.tmatesoft.svn.core.ISVNLogEntryHandler) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ArrayList(java.util.ArrayList) ISVNLogEntryHandler(org.tmatesoft.svn.core.ISVNLogEntryHandler) SVNException(org.tmatesoft.svn.core.SVNException) SVNLogClient(org.tmatesoft.svn.core.wc.SVNLogClient)

Example 42 with SVNException

use of org.tmatesoft.svn.core.SVNException in project Gargoyle by callakrsos.

the class SVNLog method log.

/********************************
	 * 작성일 : 2016. 5. 5. 작성자 : KYJ
	 *
	 * 이력정보 조회
	 *
	 * @param path
	 *            상대경로
	 * @param revision
	 *            리비젼번호
	 * @param exceptionHandler
	 *            에러발생시 처리할 핸들 정의
	 * @return
	 ********************************/
public List<SVNLogEntry> log(String path, String revision, Consumer<Exception> exceptionHandler) {
    SVNLogClient logClient = getSvnManager().getLogClient();
    List<SVNLogEntry> result = new ArrayList<>();
    try {
        ISVNLogEntryHandler handler = logEntry -> {
            LOGGER.debug("rivision :: {} date :: {} author :: {} message :: {} ", logEntry.getRevision(), logEntry.getDate(), logEntry.getAuthor(), logEntry.getMessage());
            result.add(logEntry);
        };
        String _path = path;
        try {
            _path = URLDecoder.decode(_path, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        logClient.doLog(getSvnURL(), new String[] { _path }, SVNRevision.create(Long.parseLong(revision)), SVNRevision.create(Long.parseLong(revision) == -1 ? 0 : Long.parseLong(revision)), SVNRevision.HEAD, true, false, 100L, handler);
    } catch (SVNException e) {
        if (exceptionHandler != null)
            exceptionHandler.accept(e);
        else
            LOGGER.error(ValueUtil.toString(e));
    }
    return result;
}
Also used : ILogCommand(com.kyj.scm.manager.core.commons.ILogCommand) Properties(java.util.Properties) Logger(org.slf4j.Logger) URLDecoder(java.net.URLDecoder) SVNException(org.tmatesoft.svn.core.SVNException) Date(java.util.Date) Collection(java.util.Collection) LoggerFactory(org.slf4j.LoggerFactory) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) File(java.io.File) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) SVNLogClient(org.tmatesoft.svn.core.wc.SVNLogClient) List(java.util.List) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) ISVNLogEntryHandler(org.tmatesoft.svn.core.ISVNLogEntryHandler) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ArrayList(java.util.ArrayList) ISVNLogEntryHandler(org.tmatesoft.svn.core.ISVNLogEntryHandler) SVNException(org.tmatesoft.svn.core.SVNException) SVNLogClient(org.tmatesoft.svn.core.wc.SVNLogClient) SVNException(org.tmatesoft.svn.core.SVNException)

Example 43 with SVNException

use of org.tmatesoft.svn.core.SVNException in project Gargoyle by callakrsos.

the class AbstractSVN method init.

/**
	 * 접속정보 초기화
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 5. 2.
	 * @param properties
	 */
public void init(Properties properties) {
    validate();
    try {
        svnURL = SVNURL.parseURIEncoded(getUrl());
        repository = SVNRepositoryFactory.create(svnURL);
        if ((getUserId() == null && getUserPassword() == null) || (getUserId().isEmpty() && getUserPassword().isEmpty())) {
            authManager = SVNWCUtil.createDefaultAuthenticationManager(SVNWCUtil.getDefaultConfigurationDirectory());
        } else {
            authManager = SVNWCUtil.createDefaultAuthenticationManager(getUserId(), getUserPassword().toCharArray());
        }
        repository.setAuthenticationManager(authManager);
        DefaultSVNOptions options = new DefaultSVNOptions();
        svnManager = SVNClientManager.newInstance(options, authManager);
    //			svnManager.dispose();
    //			repository.closeSession();
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
    //			throw new RuntimeException(e);
    }
}
Also used : DefaultSVNOptions(org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions) SVNException(org.tmatesoft.svn.core.SVNException)

Example 44 with SVNException

use of org.tmatesoft.svn.core.SVNException in project Gargoyle by callakrsos.

the class ScmCommitComposite method load.

public void load() {
    try {
        scmHistoryWalk();
        getBarChartDayOfMonthCategory().setLabel("기간별 커밋 통계");
        getLineChartDayOfWeekCategory().setLabel("요일별 커밋 통계");
        getBarChartDayOfMonthCategory().getCategories().add(SERIES_LABEL);
        getLineChartDayOfWeekCategory().getCategories().add(SERIES_LABEL);
        Color lineColor = Color.GREEN;
        double strokeWidth = 1;
        String cssStyleClassName = ".chart-series-line";
        {
            /*start Desing css.*/
            BarChart<String, Long> barChartDayOfMonth = getBarChartDayOfMonth();
            String style = "-fx-bar-fill: ".concat(FxUtil.toWebString(lineColor)).concat(";");
            for (Node n : barChartDayOfMonth.lookupAll(".default-color0.chart-bar")) {
                n.setStyle(style);
            }
            //				barChartDayOfMonth.setStyle(
            //						".chart-legend-item-syCmbol chart-bar series0 bar-legend-symbol default-color0{- fx-background-color:green;}");
            /*end Desing css.*/
            /*start Popover*/
            //무조건 1개의 시리즈만 처리하므로 인덱스에서 바로 가져옴.
            ObservableList<Data<String, Long>> dataArr = getBarChartDayOfMonth().getData().get(0).getData();
            for (Data<String, Long> d : dataArr) {
                d.getNode().setOnMouseClicked(ev -> {
                    if (ev.getClickCount() == 1 && ev.getButton() == MouseButton.PRIMARY)
                        createPopOver(d);
                });
            }
            barChartDayOfMonth.setMinWidth(BarChart.USE_COMPUTED_SIZE);
            barChartDayOfMonth.requestLayout();
        /*end Popover*/
        }
        {
            LineChart<String, Long> lineChartDayOfWeek = getLineChartDayOfWeek();
            lineChartDayOfWeek.setStyle(".chart-series-line .series0 .default-color0{- fx-background-color:green;}");
            Set<Node> lookupAll = lineChartDayOfWeek.lookupAll(".chart-line-symbol");
            StringBuffer sb = new StringBuffer();
            sb.append("-fx-background-color: " + FxUtil.toRgbString(lineColor) + ", white;");
            sb.append(" -fx-background-insets: 0, 2;");
            sb.append("-fx-background-radius: 5px;");
            sb.append("-fx-padding: 5px;");
            for (Node n : lookupAll) {
                n.setStyle(sb.toString());
            }
            String style = "-fx-stroke: " + FxUtil.toRgbString(lineColor) + "; -fx-stroke-width: " + strokeWidth + ";";
            for (Node seriesLine : lineChartDayOfWeek.lookupAll(cssStyleClassName)) {
                seriesLine.setStyle(style);
            }
        }
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
    }
}
Also used : MouseButton(javafx.scene.input.MouseButton) ListView(javafx.scene.control.ListView) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) MouseEvent(javafx.scene.input.MouseEvent) LoggerFactory(org.slf4j.LoggerFactory) Series(javafx.scene.chart.XYChart.Series) SimpleDateFormat(java.text.SimpleDateFormat) XYChart(javafx.scene.chart.XYChart) LinkedHashMap(java.util.LinkedHashMap) LineChart(javafx.scene.chart.LineChart) ContextMenu(javafx.scene.control.ContextMenu) Map(java.util.Map) FxCollectors(com.kyj.fx.voeditor.visual.util.FxCollectors) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) SVNException(org.tmatesoft.svn.core.SVNException) Data(javafx.scene.chart.XYChart.Data) Collection(java.util.Collection) Node(javafx.scene.Node) Set(java.util.Set) MasterSlaveChartComposite(com.kyj.fx.voeditor.visual.component.MasterSlaveChartComposite) BarChart(javafx.scene.chart.BarChart) Collectors(java.util.stream.Collectors) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) TreeMap(java.util.TreeMap) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ValueUtil(kyj.Fx.dao.wizard.core.util.ValueUtil) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Set(java.util.Set) Color(javafx.scene.paint.Color) Node(javafx.scene.Node) Data(javafx.scene.chart.XYChart.Data) SVNException(org.tmatesoft.svn.core.SVNException) ObservableList(javafx.collections.ObservableList) BarChart(javafx.scene.chart.BarChart) LineChart(javafx.scene.chart.LineChart)

Example 45 with SVNException

use of org.tmatesoft.svn.core.SVNException in project Gargoyle by callakrsos.

the class SVNHistoryWalkTest method historyWalkAnalysisGroupingTest.

@Test
public void historyWalkAnalysisGroupingTest() throws SVNException {
    List<GagoyleDate> periodDaysByWeek = DateUtil.getPeriodDaysByWeek();
    GagoyleDate start = periodDaysByWeek.get(0);
    GagoyleDate end = periodDaysByWeek.get(periodDaysByWeek.size() - 1);
    Calendar instance = Calendar.getInstance();
    instance.set(2016, 6, 1);
    Date time = instance.getTime();
    long startRevision = localServerManager2.getRevision(/*start.toDate()*/
    time);
    long endRevision = localServerManager2.getRevision(end.toDate());
    System.out.println("start " + start.toDateString() + " end : " + end.toDateString());
    System.out.println("startRevision " + startRevision + " endRevision : " + endRevision);
    Collection<SVNLogEntry> allLogs = localServerManager2.getAllLogs(startRevision, endRevision);
    //		allLogs.
    SimpleDateFormat format = new SimpleDateFormat(DateUtil.SYSTEM_DATEFORMAT_YYYY_MM_DD);
    TreeMap<String, Long> collect = allLogs.stream().collect(Collectors.groupingBy(v -> format.format(v.getDate()), TreeMap::new, Collectors.mapping(v -> 1, Collectors.counting())));
    //		Map<String, Long> collect = allLogs.stream()
    //				.collect(Collectors.groupingBy(v -> format.format(v.getDate()), Collectors.mapping(v -> 1, Collectors.counting())));
    System.out.println(collect);
}
Also used : ProxyInitializable(com.kyj.fx.voeditor.visual.main.initalize.ProxyInitializable) Properties(java.util.Properties) SVNException(org.tmatesoft.svn.core.SVNException) Date(java.util.Date) Collection(java.util.Collection) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test) JavaSVNManager(com.kyj.scm.manager.svn.java.JavaSVNManager) Collectors(java.util.stream.Collectors) List(java.util.List) Calendar(java.util.Calendar) TreeMap(java.util.TreeMap) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) Before(org.junit.Before) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) Test(org.junit.Test)

Aggregations

SVNException (org.tmatesoft.svn.core.SVNException)95 File (java.io.File)37 SVNURL (org.tmatesoft.svn.core.SVNURL)37 VcsException (com.intellij.openapi.vcs.VcsException)18 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)14 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)14 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)8 Collection (java.util.Collection)8 List (java.util.List)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 DefaultSVNOptions (org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions)7 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 Date (java.util.Date)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNCancelException (org.tmatesoft.svn.core.SVNCancelException)6 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)6 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5