diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java index b0b2f6adb7..095090b94a 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java @@ -208,7 +208,6 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase GitLogCommand command = createCommand(); Changeset c = command.getChangeset("435df2f061add3589cb3", request); - Assertions.assertThat(c.getBranches().isEmpty()).isFalse(); Assertions.assertThat(c.getBranches().contains("master")).isTrue(); Assertions.assertThat(c.getBranches().size()).isEqualTo(1); } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java index f624c40806..671ab604be 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnModifyCommand.java @@ -1,5 +1,6 @@ package sonia.scm.repository.spi; +import org.tmatesoft.svn.core.SVNCommitInfo; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.wc.SVNClientManager; @@ -72,10 +73,9 @@ public class SvnModifyCommand implements ModifyCommand { } } try { - clientManager.getCommitClient().doCommit(new File[] {workingRepository}, false, - request.getCommitMessage(), null, null, false, true, SVNDepth.INFINITY); - //I can't get the newest revision after commiting without creating a new working copy - return String.valueOf(clientManager.getStatusClient().doStatus(workingRepository, false).getCommittedRevision().getNumber() + 1); + SVNCommitInfo svnCommitInfo = clientManager.getCommitClient().doCommit(new File[]{workingRepository}, false, + request.getCommitMessage(), null, null, false, true, SVNDepth.INFINITY); + return String.valueOf(svnCommitInfo.getNewRevision()); } catch (SVNException e) { throw new InternalRepositoryException(repository, "could not commit changes on repository"); } diff --git a/scm-ui/ui-components/src/Breadcrumb.tsx b/scm-ui/ui-components/src/Breadcrumb.tsx index 63c14bbf15..5fb34b79da 100644 --- a/scm-ui/ui-components/src/Breadcrumb.tsx +++ b/scm-ui/ui-components/src/Breadcrumb.tsx @@ -8,6 +8,7 @@ import { Branch, Repository } from "@scm-manager/ui-types"; import Icon from "./Icon"; type Props = WithTranslation & { + repository: Repository; branch: Branch; defaultBranch: Branch; revision: string; @@ -58,7 +59,7 @@ class Breadcrumb extends React.Component { } render() { - const { baseUrl, branch, defaultBranch, sources, revision, path, t } = this.props; + const { repository, baseUrl, branch, defaultBranch, sources, revision, path, t } = this.props; let homeUrl = baseUrl + "/"; if (revision) { @@ -80,14 +81,15 @@ class Breadcrumb extends React.Component { {binder.hasExtension("repos.sources.actionbar") && ( - {console.log(sources)} diff --git a/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx b/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx index ba974b3dfa..8e8c9867d5 100644 --- a/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx @@ -20,6 +20,7 @@ import PermissionsNavLink from "../components/PermissionsNavLink"; import Sources from "../sources/containers/Sources"; import RepositoryNavLink from "../components/RepositoryNavLink"; import { getLinks, getRepositoriesLink } from "../../modules/indexResource"; +import SourceExtensions from "../sources/containers/SourceExtensions"; type Props = WithTranslation & { namespace: string; @@ -120,6 +121,15 @@ class RepositoryRoot extends React.Component { path={`${url}/sources/:revision/:path*`} render={() => } /> + } + /> + } + /> ( diff --git a/scm-ui/ui-webapp/src/repos/sources/containers/Content.tsx b/scm-ui/ui-webapp/src/repos/sources/containers/Content.tsx index 59f93e8453..adb56ecd97 100644 --- a/scm-ui/ui-webapp/src/repos/sources/containers/Content.tsx +++ b/scm-ui/ui-webapp/src/repos/sources/containers/Content.tsx @@ -75,7 +75,7 @@ class Content extends React.Component { }; showHeader() { - const { file, revision } = this.props; + const { repository, file, revision } = this.props; const { showHistory, collapsed } = this.state; const icon = collapsed ? "angle-right" : "angle-down"; @@ -99,6 +99,7 @@ class Content extends React.Component { void; +}; + +const extensionPointName = "repos.sources.extensions"; + +class SourceExtensions extends React.Component { + componentDidMount() { + const { fetchSources, repository, revision, path } = this.props; + // TODO get typing right + fetchSources(repository, revision || "", path || ""); + } + + render() { + const { loading, error, repository, extension, revision, path, sources } = this.props; + if (error) { + return ; + } + if (loading) { + return ; + } + + const extprops = { extension, repository, revision, path, sources }; + if (!binder.hasExtension(extensionPointName, extprops)) { + // TODO i18n + return No extension bound; + } + + return ; + } +} + +const mapStateToProps = (state: any, ownProps: Props): Partial => { + const { repository, match } = ownProps; + // TODO add query-string v6 + // see : https://www.pluralsight.com/guides/react-router-typescript + // @ts-ignore + const revision: string = match.params.revision; + // @ts-ignore + const path: string = match.params.path; + // @ts-ignore + const extension: string = match.params.extension; + const decodedRevision = revision ? decodeURIComponent(revision) : undefined; + const loading = isFetchSourcesPending(state, repository, revision, path); + const error = getFetchSourcesFailure(state, repository, revision, path); + const sources = getSources(state, repository, revision, path); + + return { + repository, + extension, + revision: decodedRevision, + path, + loading, + error, + sources + }; +}; + +const mapDispatchToProps = (dispatch: any) => { + return { + fetchSources: (repository: Repository, revision: string, path: string) => { + dispatch(fetchSources(repository, revision, path)); + } + }; +}; + +export default withRouter(connect( + mapStateToProps, + mapDispatchToProps +)(SourceExtensions)); diff --git a/scm-ui/ui-webapp/src/repos/sources/containers/Sources.tsx b/scm-ui/ui-webapp/src/repos/sources/containers/Sources.tsx index fc5c08e8d6..7a28178b51 100644 --- a/scm-ui/ui-webapp/src/repos/sources/containers/Sources.tsx +++ b/scm-ui/ui-webapp/src/repos/sources/containers/Sources.tsx @@ -149,11 +149,12 @@ class Sources extends React.Component { }; renderBreadcrumb = () => { - const { revision, path, baseUrl, branches, sources } = this.props; + const { revision, path, baseUrl, branches, sources, repository } = this.props; const { selectedBranch } = this.state; return (