use of org.tmatesoft.svn.core.SVNLogEntryPath 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;
}
use of org.tmatesoft.svn.core.SVNLogEntryPath in project Gargoyle by callakrsos.
the class FxSVNHistoryDataSupplier method createEntryListView.
// MenuItem createDiffMenu(){
//
// }
ListView<SVNLogEntry> createEntryListView(ObservableList<SVNLogEntry> list) {
ListView<SVNLogEntry> listView = new ListView<SVNLogEntry>(list);
listView.setCellFactory(new Callback<ListView<SVNLogEntry>, ListCell<SVNLogEntry>>() {
@Override
public ListCell<SVNLogEntry> call(ListView<SVNLogEntry> param) {
ListCell<SVNLogEntry> listCell = new ListCell<SVNLogEntry>() {
/* (non-Javadoc)
* @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean)
*/
@Override
protected void updateItem(SVNLogEntry item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
} else {
long revision = item.getRevision();
String author = item.getAuthor();
String dateString = YYYY_MM_DD_HH_MM_SS_PATTERN.format(item.getDate());
String message = item.getMessage();
setText(String.format("Resivion :%d author %s date :%s message :%s ", revision, author, dateString, message));
}
}
};
return listCell;
}
});
listView.setPrefSize(600, ListView.USE_COMPUTED_SIZE);
listView.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getClickCount() == 2 && ev.getButton() == MouseButton.PRIMARY) {
SVNLogEntry selectedItem = listView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
Map<String, SVNLogEntryPath> changedPaths = selectedItem.getChangedPaths();
if (ValueUtil.isNotEmpty(changedPaths)) {
ObservableList<GargoyleSVNLogEntryPath> collect = createStream(Arrays.asList(selectedItem)).collect(FxCollectors.toObservableList());
Node showing = null;
if (collect.isEmpty()) {
showing = new Label("Empty.");
showing.setStyle("-fx-text-fill:black");
} else {
showing = createHistoryListView(collect);
}
FxUtil.showPopOver(ev.getPickResult().getIntersectedNode(), showing);
}
}
}
});
return listView;
}
use of org.tmatesoft.svn.core.SVNLogEntryPath in project mycore by MyCoRe-Org.
the class MCRVersionedMetadata method listVersions.
/**
* Lists all versions of this metadata object available in the subversion
* repository
*
* @return all stored versions of this metadata object
*/
@SuppressWarnings("unchecked")
public List<MCRMetadataVersion> listVersions() throws IOException {
try {
List<MCRMetadataVersion> versions = new ArrayList<>();
SVNRepository repository = getStore().getRepository();
String path = getFilePath();
String dir = getDirectory();
Collection<SVNLogEntry> entries = null;
try {
entries = repository.log(new String[] { dir }, null, 0, repository.getLatestRevision(), true, true);
} catch (Exception ioex) {
LOGGER.error("Could not get versions", ioex);
return versions;
}
for (SVNLogEntry entry : entries) {
SVNLogEntryPath svnLogEntryPath = entry.getChangedPaths().get(path);
if (svnLogEntryPath != null) {
char type = svnLogEntryPath.getType();
versions.add(new MCRMetadataVersion(this, entry, type));
}
}
return versions;
} catch (SVNException svnExc) {
throw new IOException(svnExc);
}
}
use of org.tmatesoft.svn.core.SVNLogEntryPath in project mycore by MyCoRe-Org.
the class MCRVersionedMetadata method getRevision.
public MCRMetadataVersion getRevision(long revision) throws IOException {
try {
if (revision < 0) {
revision = getLastPresentRevision();
if (revision < 0) {
LOGGER.warn(MessageFormat.format("Metadata object {0} in store {1} has no last revision!", getID(), getStore().getID()));
return null;
}
}
SVNRepository repository = getStore().getRepository();
String path = getFilePath();
String dir = getDirectory();
@SuppressWarnings("unchecked") Collection<SVNLogEntry> log = repository.log(new String[] { dir }, null, revision, revision, true, true);
for (SVNLogEntry logEntry : log) {
SVNLogEntryPath svnLogEntryPath = logEntry.getChangedPaths().get(path);
if (svnLogEntryPath != null) {
char type = svnLogEntryPath.getType();
return new MCRMetadataVersion(this, logEntry, type);
}
}
LOGGER.warn(MessageFormat.format("Metadata object {0} in store {1} has no revision ''{2}''!", getID(), getStore().getID(), getRevision()));
return null;
} catch (SVNException svnExc) {
throw new IOException(svnExc);
}
}
Aggregations