Add ConfigurationAdapterBase and extension points for trash bin

Adds the new abstract class ConfigurationAdapterBase to simplify the creation of global configuration views. In addition there is some cleanup, interfaces and extension points for the repository trash bin plugin.

Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
Eduard Heimbuch
2023-01-12 14:01:04 +01:00
parent 5c4c759bd2
commit ac419daa3f
34 changed files with 879 additions and 84 deletions

View File

@@ -87,7 +87,7 @@ public class GitMergeRebase extends GitMergeStrategy {
.include(branchToMerge, sourceRevision)
.call();
push();
return MergeCommandResult.success(getTargetRevision().name(), branchToMerge, sourceRevision.name());
return createSuccessResult(sourceRevision.name());
} catch (GitAPIException e) {
return MergeCommandResult.failure(branchToMerge, targetBranch, result.getConflicts());
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.eclipse.jgit.api.Git;
@@ -51,7 +51,7 @@ class GitMergeWithSquash extends GitMergeStrategy {
if (result.getMergeStatus().isSuccessful()) {
RevCommit revCommit = doCommit().orElseThrow(() -> new NoChangesMadeException(getRepository()));
push();
return MergeCommandResult.success(getTargetRevision().name(), revCommit.name(), extractRevisionFromRevCommit(revCommit));
return createSuccessResult(extractRevisionFromRevCommit(revCommit));
} else {
return analyseFailure(result);
}

View File

@@ -296,7 +296,7 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
Repository repository = createContext().open();
assertThat(mergeCommandResult.isSuccess()).isTrue();
assertThat(mergeCommandResult.getRevisionToMerge()).isEqualTo(mergeCommandResult.getNewHeadRevision());
assertThat(mergeCommandResult.getRevisionToMerge()).isEqualTo("35597e9e98fe53167266583848bfef985c2adb27");
assertThat(mergeCommandResult.getTargetRevision()).isEqualTo("fcd0ef1831e4002ac43ea539f4094334c79ea9ec");
Iterable<RevCommit> commits = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();