ben-gibson/GitLink

Integrating with BitBucket server

ApeachM opened this issue · 6 comments

I am using the bitbucket server for developing the product.
However, the returned link is not correct from the plugin in JetBrains IDE.

returned link from GitLink:
https://dev.company-name.com/projects/scm/repos/{PROJECT_KEY in lowercase?}/browse/{FILE_PATH}?at=4f05127868f8eba684e590ec95cf1fc948771b5d#36-36

correct link:
https://dev.company-name.com:12354/projects/{PROJECT_KEY}/repos/{PROJECT_NAME}/browse/{FILE_PATH}?at=4f05127868f8eba684e590ec95cf1fc948771b5d#36-36

First of all, the port is ignored. And I don't know the meaning of scm.
How can I use GitLink? Your tool is pretty cool which I have used in GitHub. I am very sorry not to use it for my job.

Thank you very much.

What's the output of git remote -v in your repo?

What's the output of git remote -v in your repo?

I have the same problem (except I don't have a port) and for me git remote -v returns:
origin https://{user}@dev.company-name.com/scm/{PROJECT_KEY}/{PROJECT_NAME}.git (fetch)
origin https://{user}@dev.company-name.com/scm/{PROJECT_KEY}/{PROJECT_NAME}.git (push)

Both {PROJECT_KEY} and {PROJECT_NAME} are lowercase, but that is not an issue, since bitbucket corrects it.

I guess it's getting confused by scm in the remote URL (I don't remember it being there before). I think we can probably just strip it when we're using a bit bucket host. I'll take a look one evening this week.

This should be fixed in 4.5.0, but I don't use BitBucket server, so I'm not completely confident. Let me know.

@ben-gibson Actually, I'm still experiencing the same error. Here is the stack trace. Please take a look. (version is 4.5.0)

java.lang.RuntimeException: Cannot find service uk.co.ben_gibson.git.link.url.factory.BitbucketCloudUrlFactory (classloader=PluginClassLoader(plugin=PluginDescriptor(name=GitLink, id=uk.co.ben-gibson.remote.repository.mapper, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IdeaIC2024.2/plugins/GitLink, version=4.5.0, package=null, isBundled=false), packagePrefix=null, state=active, parents=PluginDescriptor(name=Git, id=Git4Idea, moduleName=intellij.vcs.git/terminal, descriptorPath=intellij.vcs.git.terminal.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/vcs-git, version=242.20224.419, package=git4idea.terminal, isBundled=true), PluginDescriptor(name=Git, id=Git4Idea, moduleName=intellij.vcs.git/newUiOnboarding, descriptorPath=intellij.vcs.git.newUiOnboarding.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/vcs-git, version=242.20224.419, package=git4idea.newUiOnboarding, isBundled=true), PluginDescriptor(name=Git, id=Git4Idea, moduleName=intellij.vcs.git.coverage, descriptorPath=intellij.vcs.git.coverage.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/vcs-git, version=242.20224.419, package=com.intellij.vcs.git.coverage, isBundled=true), PluginDescriptor(name=IDEA CORE, id=com.intellij, moduleName=intellij.platform.vcs.impl, descriptorPath=intellij.platform.vcs.impl.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/lib, version=242.20224.419, package=null, isBundled=true), PluginDescriptor(name=IDEA CORE, id=com.intellij, moduleName=intellij.platform.vcs.log.impl, descriptorPath=intellij.platform.vcs.log.impl.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/lib, version=242.20224.419, package=null, isBundled=true), PluginDescriptor(name=IDEA CORE, id=com.intellij, moduleName=intellij.platform.vcs.dvcs.impl, descriptorPath=intellij.platform.vcs.dvcs.impl.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/lib, version=242.20224.419, package=null, isBundled=true), PluginDescriptor(name=IDEA CORE, id=com.intellij, moduleName=intellij.platform.collaborationTools, descriptorPath=intellij.platform.collaborationTools.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/lib, version=242.20224.419, package=null, isBundled=true), PluginDescriptor(name=Git, id=Git4Idea, descriptorPath=plugin.xml, path=~/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/vcs-git, version=242.20224.419, package=git4idea, isBundled=true), ), client=null)
	at uk.co.ben_gibson.git.link.url.factory.UrlFactoryLocator.locate(UrlFactoryLocator.kt:29)
	at uk.co.ben_gibson.git.link.pipeline.middleware.GenerateUrl.invoke(GenerateUrl.kt:28)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.Timer.invoke(Timer.kt:24)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.ForceHttps.invoke(ForceHttps.kt:14)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.RecordHit.invoke(RecordHit.kt:14)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.SendSupportNotification.invoke(SendSupportNotification.kt:16)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:13)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:38)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.middleware.ResolveContext.invoke(ResolveContext.kt:30)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:37)
	at uk.co.ben_gibson.git.link.pipeline.Pipeline.accept(Pipeline.kt:31)
	at uk.co.ben_gibson.git.link.GitLinkRunnerKt$processGitLink$$inlined$runBackgroundableTask$1.run(progress.kt:56)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:249)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:96)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:96)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:249)
	at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:501)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:97)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:92)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:464)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

❯ git remote -v
origin https://bitbucket.bla.bla.project/scm/some/project.git (fetch)
origin https://bitbucket.bla.bla.project/scm/some/project.git (push)

I've just pushed 4.5.1 which should resolve the error.