Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#115] Implement listRevisionProperties method #116

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
import ru.arsysop.svn.connector.internal.adapt.RepositoryDateFormat;
import ru.arsysop.svn.connector.internal.adapt.SvnNullableConstructor;

public final class RevPropertyConverter extends SvnNullableConstructor<Map<String, byte[]>, Map<String, Object>> {
public final class RevMapPropertyAdapter extends SvnNullableConstructor<Map<String, byte[]>, Map<String, Object>> {

private final DateFormat formatter = new RepositoryDateFormat().get();

public RevPropertyConverter(Map<String, byte[]> source) {
public RevMapPropertyAdapter(Map<String, byte[]> source) {
super(source);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2023, 2025 ArSysOp
*
* Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*/

package ru.arsysop.svn.connector.internal.adapt.jhlsv;

import java.util.Map;

import org.eclipse.team.svn.core.connector.SVNProperty;

import ru.arsysop.svn.connector.internal.adapt.SvnNullableConstructor;

public final class RevSvnPropertyAdapter extends SvnNullableConstructor<Map<String, byte[]>, SVNProperty[]> {

public RevSvnPropertyAdapter(Map<String, byte[]> source) {
super(source);
}

@Override
protected SVNProperty[] adapt(Map<String, byte[]> source) {
return source.entrySet()
.stream()
.map(e -> new SVNProperty(e.getKey(), e.getValue()))
.toArray(SVNProperty[]::new);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.eclipse.team.svn.core.connector.SVNProperty;

import ru.arsysop.svn.connector.internal.adapt.SvnNullableConstructor;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.RevPropertyConverter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.RevMapPropertyAdapter;

public final class AnnotationCallbackAdapter extends SvnNullableConstructor<ISVNAnnotationCallback, BlameCallback> {

Expand All @@ -46,8 +46,8 @@ protected BlameCallback adapt(ISVNAnnotationCallback source) {

public void singleLine(long number, long revision, Map<String, byte[]> irp, long mrevision,
Map<String, byte[]> imp, String mpath, String line, boolean localChange) throws ClientException {
Map<String, Object> orp = new RevPropertyConverter(irp).adapt();
Map<String, Object> omp = new RevPropertyConverter(imp).adapt();
Map<String, Object> orp = new RevMapPropertyAdapter(irp).adapt();
Map<String, Object> omp = new RevMapPropertyAdapter(imp).adapt();
source.annotate(line, new SVNAnnotationData(//
number, //
localChange, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import ru.arsysop.svn.connector.internal.adapt.SvnNullableArray;
import ru.arsysop.svn.connector.internal.adapt.SvnNullableConstructor;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.ChangePathAdapter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.RevPropertyConverter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.RevMapPropertyAdapter;

public final class LogMessageCallbackAdapter extends SvnNullableConstructor<ISVNLogEntryCallback, LogMessageCallback> {

Expand Down Expand Up @@ -74,7 +74,7 @@ private SVNLogEntry convert(ChangePath[] paths, long revision,
p -> new ChangePathAdapter(p).adapt()).adapt(), //
hasChildren);
}
Map<String, Object> converted = new RevPropertyConverter(revprops).adapt();
Map<String, Object> converted = new RevMapPropertyAdapter(revprops).adapt();
Date date = converted == null ? null : (Date) converted.get(SVNProperty.BuiltIn.REV_DATE);
return new SVNLogEntry(//
revision, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import ru.arsysop.svn.connector.internal.adapt.jhlsv.LockNullableAdapter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.MergeInfoAdapter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.NodeKindAdapter;
import ru.arsysop.svn.connector.internal.adapt.jhlsv.RevSvnPropertyAdapter;
import ru.arsysop.svn.connector.internal.adapt.svjhl.AdaptClientNotifyCallback;
import ru.arsysop.svn.connector.internal.adapt.svjhl.AnnotationCallbackAdapter;
import ru.arsysop.svn.connector.internal.adapt.svjhl.ChoiceAdapter;
Expand Down Expand Up @@ -1235,9 +1236,15 @@ public void setPropertyRemote(SVNEntryReference reference, SVNProperty property,
@Override
public SVNProperty[] listRevisionProperties(SVNEntryReference reference, ISVNProgressMonitor monitor)
throws SVNConnectorException {
System.out.println("SvnKit1_10Connector.listRevisionProperties()");
//TODO
return null;
Map<String, Object> parameters = new HashMap<>();
parameters.put("reference", reference);
parameters.put("monitor", monitor);
return watch.queryAdapt(ISVNCallListener.LIST_REVISION_PROPERTIES, //
parameters, //
callback(monitor), p -> client.revProperties(//
reference.path, //
new RevisionAdapter(reference.pegRevision).adapt()),
v -> new RevSvnPropertyAdapter(v).adapt());
}

@Override
Expand Down
Loading