Search in sources :

Example 1 with SVNLogEntry

use of org.tmatesoft.svn.core.SVNLogEntry in project intellij-community by JetBrains.

the class LogEntry method create.

@Nullable
public static LogEntry create(@Nullable SVNLogEntry entry) {
    LogEntry result = null;
    if (entry != null) {
        LogEntry.Builder builder = new LogEntry.Builder();
        if (entry.getChangedPaths() != null) {
            for (SVNLogEntryPath path : entry.getChangedPaths().values()) {
                builder.addPath(LogEntryPath.create(path));
            }
        }
        result = builder.setRevision(entry.getRevision()).setAuthor(entry.getAuthor()).setDate(entry.getDate()).setMessage(entry.getMessage()).setHasChildren(entry.hasChildren()).build();
    }
    return result;
}
Also used : SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) SVNLogEntryPath(org.tmatesoft.svn.core.SVNLogEntryPath) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with SVNLogEntry

use of org.tmatesoft.svn.core.SVNLogEntry 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)

Example 3 with SVNLogEntry

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

the class SVNViewer method menuDiffOnAction.

/********************************
	 * 작성일 : 2016. 6. 14. 작성자 : KYJ
	 *
	 * Diff 처리 이벤트
	 *
	 * @param e
	 ********************************/
public void menuDiffOnAction(ActionEvent e) {
    ObservableList<SVNLogEntry> selectedItems = tbRevision.getSelectionModel().getSelectedItems();
    if (selectedItems != null && selectedItems.size() == 2) {
        SVNLogEntry svnLogEntry = selectedItems.get(0);
        SVNLogEntry svnLogEntry2 = selectedItems.get(1);
        if (svnLogEntry == null || svnLogEntry2 == null)
            return;
        long revision = svnLogEntry.getRevision();
        long revision2 = svnLogEntry2.getRevision();
        SVNItem svnItem = lastSelectedSVNItem.get();
        String cat = svnItem.getManager().cat(svnItem.getPath(), String.valueOf(revision));
        String cat2 = svnItem.getManager().cat(svnItem.getPath(), String.valueOf(revision2));
        try {
            //				FXMLLoader loader = new FXMLLoader();
            //				loader.setLocation(TextBaseDiffAppController.class.getResource("TextBaseDiffApp.fxml"));
            //				Parent parent = loader.load();
            //				TextBaseDiffAppController controller = loader.getController();
            //				controller.setDiff(cat, cat2);
            Parent parent = FxUtil.loadAndControllerAction(TextBaseDiffAppController.class, controller -> {
                try {
                    controller.setDiff(cat, cat2);
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            });
            Stage stage = new Stage();
            stage.setScene(new Scene(parent));
            stage.initModality(Modality.APPLICATION_MODAL);
            stage.initOwner(this.getScene().getWindow());
            stage.show();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    } else {
        DialogUtil.showMessageDialog("두개의 아이템을 선택하십시요.");
    }
}
Also used : SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) SVNException(org.tmatesoft.svn.core.SVNException)

Example 4 with SVNLogEntry

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

the class SvnChagnedCodeComposite method initialize.

@FXML
public void initialize() {
    createContextMenu();
    Collection<SVNLogEntry> allLogs = supplier.getAllLogs();
    LOGGER.debug("Log Count : {}", allLogs.size());
    String dateString = supplier.getStart().toDateString();
    String dateString2 = supplier.getEnd().toDateString();
    piChartChagendCode.setTitle(String.format("Chaned Code Count ( Rank %d )\n%s ~ %s", supplier.getRankSize(), dateString, dateString2));
    //		collectedTable = supplier.createStream(allLogs).collect(Collectors.groupingBy(v -> v.getPath()));
    Map<String, Long> collect = supplier.createStream(allLogs).collect(Collectors.groupingBy(v -> v.getPath(), LinkedHashMap::new, Collectors.counting()));
    dataList = collect.entrySet().stream().sorted((o1, o2) -> {
        return -Long.compare(o1.getValue(), o2.getValue());
    }).map(v -> new Data(v.getKey(), v.getValue())).limit(supplier.getRankSize()).collect(Collectors.toList());
    piChartChagendCode.getData().addAll(dataList);
    Set<Node> lookupAll = piChartChagendCode.lookupAll(".chart-pie-label");
    for (Data d : piChartChagendCode.getData()) {
        Node node = d.getNode();
        Tooltip.install(node, new Tooltip(String.format("Source Code : %s\nModify Count:%d", d.getName(), (int) d.getPieValue())));
        node.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> {
            dataOnMouseClick(e, d);
            e.consume();
        });
        /*animation effect. */
        node.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, ev -> {
            Platform.runLater(() -> node.setStyle("-fx-background-color:derive(-fx-color,-5%);"));
        });
        /*animation effect. */
        node.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, ev -> {
            Platform.runLater(() -> node.setStyle(null));
        });
    }
    lookupAll.stream().map(v -> (Text) v).forEach(v -> {
        String text = v.getText();
        String displayText = text;
        int count = supplier.getCollectedTable().get(displayText).size();
        int textLength = displayText.length();
        if (textLength > 15) {
            displayText = "... " + displayText.substring(textLength - 15);
            Tooltip.install(v, new Tooltip(text));
        }
        displayText = displayText.concat("   [").concat(String.valueOf(count)).concat("]");
        v.setText(displayText);
    });
//		Platform.runLater(() -> {
//			this.getScene().addEventFilter(KeyEvent.KEY_PRESSED, this::sceneOnKeyPressed);
//		});
}
Also used : MouseButton(javafx.scene.input.MouseButton) ListView(javafx.scene.control.ListView) MouseEvent(javafx.scene.input.MouseEvent) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) LinkedHashMap(java.util.LinkedHashMap) ContextMenu(javafx.scene.control.ContextMenu) Map(java.util.Map) Tooltip(javafx.scene.control.Tooltip) Data(javafx.scene.chart.PieChart.Data) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) SVNException(org.tmatesoft.svn.core.SVNException) Collection(java.util.Collection) Node(javafx.scene.Node) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Set(java.util.Set) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) Text(javafx.scene.text.Text) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) PieChart(javafx.scene.chart.PieChart) List(java.util.List) Region(javafx.scene.layout.Region) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) Node(javafx.scene.Node) Tooltip(javafx.scene.control.Tooltip) Data(javafx.scene.chart.PieChart.Data) Text(javafx.scene.text.Text) FXML(javafx.fxml.FXML)

Example 5 with SVNLogEntry

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

the class SVNViewer method svnTreeViewOnAction.

public void svnTreeViewOnAction(SVNItem item) {
    if (!item.isDir()) {
        lastSelectedSVNItem.set(item);
        tbRevision.getItems().clear();
        LineChart<String, String> lineHist = new LineChart<>(new CategoryAxis(), new CategoryAxis());
        //			lineHist.setRotate(90d);
        //			lineHist.scaleXProperty().set(0.7);
        //			lineHist.scaleYProperty().set(0.7);
        lineHist.autosize();
        lineHist.setLegendVisible(false);
        List<SVNLogEntry> logs = item.getManager().log(item.getPath());
        tbRevision.getItems().addAll(logs.stream().sorted(sortUpper).collect(Collectors.toList()));
        // 시리즈 생성
        ObservableList<Data<String, String>> observableArrayList = FXCollections.observableArrayList();
        logs.stream().sorted(sortLower).forEach(entry -> {
            Date date = entry.getDate();
            String dateString = DateUtil.getDateString(date.getTime(), "yy-MM-dd HH:mm");
            Data<String, String> data = new Data<>(dateString, entry.getAuthor());
            setDataNode(entry, data);
            data.getNode().setOnMouseClicked(e -> {
                if (e.getClickCount() == 2 && e.getButton() == MouseButton.PRIMARY) {
                    String path = item.path;
                    long revision = entry.getRevision();
                    String content = item.getManager().cat(path, String.valueOf(revision));
                    BorderPane pane = new BorderPane(FxUtil.createJavaTextArea(content));
                    pane.setTop(new Label(item.getManager().fromPrettySVNLogConverter().apply(entry)));
                    FxUtil.showPopOver(data.getNode(), pane);
                }
            });
            data.getNode().setOnMouseEntered(ev -> {
                data.getNode().setBlendMode(BlendMode.GREEN);
            });
            data.getNode().setOnMouseExited(ev -> {
                data.getNode().setBlendMode(null);
            });
            observableArrayList.add(data);
        });
        Series<String, String> series = new Series<>("Commitors.", observableArrayList);
        lineHist.getData().add(series);
        borChart.setCenter(lineHist);
        String cat = item.getManager().cat(item.getPath());
        //			String simpleName = item.getSimpleName();
        javaTextAre.setContent(cat);
        tabPaneSVN.getSelectionModel().select(tabHistChart);
    }
}
Also used : BorderPane(javafx.scene.layout.BorderPane) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) Label(javafx.scene.control.Label) Data(javafx.scene.chart.XYChart.Data) Date(java.util.Date) Series(javafx.scene.chart.XYChart.Series) CategoryAxis(javafx.scene.chart.CategoryAxis) LineChart(javafx.scene.chart.LineChart)

Aggregations

SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)19 SVNException (org.tmatesoft.svn.core.SVNException)9 Collection (java.util.Collection)7 List (java.util.List)7 Label (javafx.scene.control.Label)6 Logger (org.slf4j.Logger)6 LoggerFactory (org.slf4j.LoggerFactory)6 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)6 Date (java.util.Date)5 SVNLogEntryPath (org.tmatesoft.svn.core.SVNLogEntryPath)5 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)4 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)4 Collectors (java.util.stream.Collectors)4 Node (javafx.scene.Node)4 ListView (javafx.scene.control.ListView)4 BorderPane (javafx.scene.layout.BorderPane)4 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)4 GagoyleDate (com.kyj.fx.voeditor.visual.framework.model.GagoyleDate)3 DateUtil (com.kyj.fx.voeditor.visual.util.DateUtil)3