如何通过 SSH 使用 mercurial 导入?
How to import using mercurial with SSH?
是否可以通过 ssh 使用 mercurial 导入模块?
我发现很少关于将 mercurial 与 go 一起使用,而我发现的很少是与 http 一起使用。
简短的回答是肯定的。
go help importpath
或可用 here 显示的文本描述了如何设置导入路径以暗示特定的版本控制系统。有些网站是提前知道的:
A few common code hosting sites have special syntax:
[list snipped, but GitHub implies using Git protocol, Launchpad implies Bazaar, and so on]
For code hosted on other servers, import paths may either be qualified with the version control type, or the go tool can dynamically fetch the import path over https/http and discover where the code resides from a <meta> tag in the HTML.
因此,如果您无法访问或控制此类 <meta>
标签,则应使用 explicitly-specified VCS 导入:
... an import path of the form
repository.vcs/path
specifies the given repository, with or without the .vcs suffix, using the named version control system, and then the path inside that repository.
也就是说,要告诉 go get
它必须使用 Mercurial 协议来主机 example.com
,您可以使用:
import "example.com/me.hg/repo"
或:
import "example.com/me/repo.hg"
其中 .hg
表示使用 Mercurial。
一旦您选择了特定的 VCS,事情就会变得有点棘手:
When a version control system supports multiple protocols, each is tried in turn when downloading. For example, a Git download tries https://, then git+ssh://.
Go VCS 导入程序的 source code 有详细信息。 Mercurial 存储库导入首先尝试 https
,然后 ssh
。
如果可以使用<meta>
标签,那个可以提供更多的细节,这样就可以避免导入路径中比较笨拙的.hg
:
If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a <meta> tag in the document's HTML <head>.
如果您要实现对请求页面的 <meta>
响应,请阅读其余部分的 所有 ,因为这继续说:
When using modules, an additional variant of the go-import meta tag is recognized and is preferred over those listing version control systems. That variant uses "mod" as the vcs in the content value, as in:
<meta name="go-import" content="example.org mod https://code.org/moduleproxy">
This tag means to fetch modules with paths beginning with example.org from the module proxy available at the URL https://code.org/moduleproxy. See 'go help goproxy' for details about the proxy protocol.
是否可以通过 ssh 使用 mercurial 导入模块?
我发现很少关于将 mercurial 与 go 一起使用,而我发现的很少是与 http 一起使用。
简短的回答是肯定的。
go help importpath
或可用 here 显示的文本描述了如何设置导入路径以暗示特定的版本控制系统。有些网站是提前知道的:
A few common code hosting sites have special syntax:
[list snipped, but GitHub implies using Git protocol, Launchpad implies Bazaar, and so on]For code hosted on other servers, import paths may either be qualified with the version control type, or the go tool can dynamically fetch the import path over https/http and discover where the code resides from a <meta> tag in the HTML.
因此,如果您无法访问或控制此类 <meta>
标签,则应使用 explicitly-specified VCS 导入:
... an import path of the form
repository.vcs/path
specifies the given repository, with or without the .vcs suffix, using the named version control system, and then the path inside that repository.
也就是说,要告诉 go get
它必须使用 Mercurial 协议来主机 example.com
,您可以使用:
import "example.com/me.hg/repo"
或:
import "example.com/me/repo.hg"
其中 .hg
表示使用 Mercurial。
一旦您选择了特定的 VCS,事情就会变得有点棘手:
When a version control system supports multiple protocols, each is tried in turn when downloading. For example, a Git download tries https://, then git+ssh://.
Go VCS 导入程序的 source code 有详细信息。 Mercurial 存储库导入首先尝试 https
,然后 ssh
。
如果可以使用<meta>
标签,那个可以提供更多的细节,这样就可以避免导入路径中比较笨拙的.hg
:
If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a <meta> tag in the document's HTML <head>.
如果您要实现对请求页面的 <meta>
响应,请阅读其余部分的 所有 ,因为这继续说:
When using modules, an additional variant of the go-import meta tag is recognized and is preferred over those listing version control systems. That variant uses "mod" as the vcs in the content value, as in:
<meta name="go-import" content="example.org mod https://code.org/moduleproxy">
This tag means to fetch modules with paths beginning with example.org from the module proxy available at the URL https://code.org/moduleproxy. See 'go help goproxy' for details about the proxy protocol.