From fb25ae334bcb40656ae2501e1a644c4bf2417cdf Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Tue, 4 Dec 2018 11:43:11 +0100 Subject: [PATCH 1/2] Add possibility to clone project from self hosted gitlab with non default ssh port via the Metacello integration. Fixes #1099 /!\ This needs https://github.com/pharo-project/pharo/pull/2041 before it can work --- .../testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st | 7 +++++++ .../MCGitlabRepository.extension/instance/scpUrl.st | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st diff --git a/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st b/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st new file mode 100644 index 0000000000..71cb498fb5 --- /dev/null +++ b/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st @@ -0,0 +1,7 @@ +running +testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort + | repository | + SystemVersion current major <= 6 ifTrue: [ self skip ]. + + repository := MCGitlabRepository location: 'gitlab://git.pharo.org:1234:pharo-project/pharo'. + self assert: repository scpUrl equals: 'ssh://git@git.pharo.org:1234/pharo-project/pharo.git' \ No newline at end of file diff --git a/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st b/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st index 3d3054e7e3..a1b5cad9e9 100644 --- a/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st +++ b/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st @@ -1,3 +1,7 @@ *Iceberg scpUrl - ^ 'git@<1s>:<2s>.git' expandMacrosWith: self hostname with: projectPath \ No newline at end of file + "If the sshPort is not nil it means that we have a non default ssh port. Thus we need to add `ssh://` and th port number to the scheme" + + ^ self sshPort + ifNil: [ 'git@<1s>:<2s>.git' expandMacrosWith: self hostname with: projectPath ] + ifNotNil: [ :port | 'ssh://git@<1s>:<2s>/<3s>.git' expandMacrosWith: self hostname with: port with: projectPath ] \ No newline at end of file From 788d33ac0743515893f6923b80088dff4f128e00 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Wed, 19 Dec 2018 16:46:04 +0100 Subject: [PATCH 2/2] P6.1 compatibility --- .../MCGitlabRepository.extension/instance/scpUrl.st | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st diff --git a/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st b/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st new file mode 100644 index 0000000000..260d2135dd --- /dev/null +++ b/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st @@ -0,0 +1,6 @@ +*Iceberg-Pharo6 +sshPort + "In pharo 6 we do not have the code to be able to load gitlab with non default ssh port projects. So we return nil so that #scpUrl does not break." + + ^ nil + \ No newline at end of file