是否可以从 Mercurial (HG) 存储库中签出单个目录?

发布于 2024-08-23 00:30:09 字数 435 浏览 7 评论 0原文

因此,我尝试从 Netbeans contrib 存储库签出 TestNG 插件。 (或者它是模块?我是 Mercurial 的新手,所以我还不太了解行话。)

当我运行以下命令时...

hg clone http://hg.netbeans.org/main/contrib/

...我得到了整个存储库,其中包含所有的 contrib插件。是否可以只拉这个位置?

http://hg.netbeans.org/main/contrib/file /提示/testng/

谢谢!

So, I'm trying to checkout just the TestNG plugin from the Netbeans contrib repository. (Or is it module? I'm new to Mercurial, so I don't really know the lingo yet.)

When I run the following command...

hg clone http://hg.netbeans.org/main/contrib/

...I get the entire repository, which contains all of the the contrib plug-ins. Is it possible to just pull this location?

http://hg.netbeans.org/main/contrib/file/tip/testng/

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

来日方长 2024-08-30 00:30:09

这个概念称为“窄克隆”,不,目前在 Mercurial 中不可能实现。

我们中一些为 Mercurial 做出贡献的人已经注意到了这一点,但这是一个很难解决的问题。例如:

  • 如果您没有存储库中的所有文件,如何计算您所做的任何新提交的哈希值?
  • 如果您尝试在 contrib/testng 中查看某个文件的历史记录(如果该文件是从另一个文件夹移动的),会发生什么情况?

This concept is called "narrow cloning" and no, it's not possible at the moment in Mercurial.

It's on the radar of some of us that contribute to Mercurial but it's a hard problem to solve. For example:

  • How do you calculate the hash of any new commits you make if you don't have all of the files in the repo?
  • What happens if you try to view the history of a file in contrib/testng if that file was moved from another folder?
恋你朝朝暮暮 2024-08-30 00:30:09

我不确定,但我认为一般情况下的答案是“可能不是”。

如果存储库是本地的(听起来不像您的情况),您可以执行以下操作:(

hg archive -R /path/to/my/repo -I /path/to/my/repo/folder/i/want export-folder-name

该命令需要导出非 VC 文件,而不是创建部分存储库,因为.hg 内容在顶层存储一次,而不是像 SVN 那样在每个文件夹中分段存储。)

但它不适用于远程存储库。 “hg log”也没有,hg 人员解释了原因

想象一下我发送了一条日志 - p 命令到 http://www.kernel.org/hg/linux-2.6,这是
接近 100k 变更集。以每秒一个差异(大量寻找),这将
服务器上大约需要 3 小时的 CPU/磁盘时间,没关系
带宽。对于每个人来说,克隆存储库会更快、更简单
并在本地进行日志记录。

我怀疑出于同样的原因,hg archive 无法远程工作。

I'm not sure, but I think the answer in the general case is "probably not".

If the repository is local (it doesn't sound like it is in your case), you can do something like:

hg archive -R /path/to/my/repo -I /path/to/my/repo/folder/i/want export-folder-name

(The command would need to be something that exports non-VC'd files, rather than creating a partial repo, since the .hg stuff is stored once at the toplevel, rather than in pieces in each folder as SVN does.)

It doesn't work on remote repositories, though. Neither does "hg log", and the hg folks explained why:

Imagine I send a log -p command to http://www.kernel.org/hg/linux-2.6, which is
approaching 100k changesets. At one diff per second (lots of seeking), this will
take about 3 hours of CPU/disk time on the server, nevermind metric tons of
bandwidth. It would be faster and simpler for everyone just to clone the repo
and do the log locally.

I suspect hg archive can't work remotely for the same reason.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文